Restoring FAT32 filesystem after accidentally formatting it

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
andoru
Posts: 3
Joined: 16 Jul 2016, 02:06

Restoring FAT32 filesystem after accidentally formatting it

#1 Post by andoru »

As a background to what happened: I installed a custom recovery on my Android phone, and I wanted to restore the phone's state from a backup after I experimented with something. Before restoring a backup, I usually do a factory reset, and that's what I also did this time, but this time I accidentally set it to wipe the SD card and the Phone's internal memory too...

Luckly it didn't do a secure wipe, as it took less than 4 secs to format everything, however it did make a new (blank) partition. I tried so far to recover the partition with testdisk, but all it would do is to recover the blank partition. Also I tried recovering the files with photorec, and while I did get most of the data back, the filenames and folder structure wasn't retained, so all the files were dumped in a single folder with (what I assume to be) inode reference number as filenames.

Is there any way to recover the data and restore it intact, the way it was on the SD card before wiping it? Or at least to be able to recover the files the photorec way with the proper filenames and directory structure.

I didn't do any modifications to the filesystem itself so far, left it intact as it was previously. Also did a backup with dd of the whole SD card.

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Restoring FAT32 filesystem after accidentally formatting it

#2 Post by cgrenier »

Run PhotoRec, in Options, enable the expert mode, start a recovery, answer Yes when asked if you want to try to unformat the partition, use the default values otherwise.
It may be able to recover the original filenames.

andoru
Posts: 3
Joined: 16 Jul 2016, 02:06

Re: Restoring FAT32 filesystem after accidentally formatting it

#3 Post by andoru »

Okay, I did that now, and it managed to recover some files with their original filenames, but what I forgot to mention last time was that PhotoRec doesn't recover all the files, and some of the files it does recover end up being incomplete or corrupted...
Is there really no way to entirely recover the deleted partition with testdisk?

andoru
Posts: 3
Joined: 16 Jul 2016, 02:06

Re: Restoring FAT32 filesystem after accidentally formatting it

#4 Post by andoru »

Anyone...?

Locked