Page 1 of 1

Restoring FAT32 filesystem after accidentally formatting it

Posted: 16 Jul 2016, 02:11
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.

Re: Restoring FAT32 filesystem after accidentally formatting it

Posted: 16 Jul 2016, 08:35
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.

Re: Restoring FAT32 filesystem after accidentally formatting it

Posted: 16 Jul 2016, 22:48
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?

Re: Restoring FAT32 filesystem after accidentally formatting it

Posted: 21 Jul 2016, 23:40
by andoru
Anyone...?