Recover data after factory reset

Hi! I did a factory reset of my FP2 running Fairphone Open. I want to get my data (pictures) back. Searched the FP forum but no luck (all entries outdated, or not working).

What I did: I put an SD card into the phone, went into TWRP recovery, in terminal: “dd if=/dev/block/mmcblk0 of=/external_sd/image.dd count=8000000”

The “count=8000000” limits it to 4GB, which is max size for the SD card FAT system. I created several of these 4GB image dumps. Then run photorec on each of them. But no luck in recovering anything useful…

Wildly guessing: /dev/block/mmcblk0 as far as I know is the entire device. And I could imagine that phptorect needs to be run on a single filesystem/partition. So it should be something like /dev/block/mmcblk0p1 or so. You “just” need to find out which is the correct partition for the user data.

1 Like

Should be /dev/block/mmcblk0p20 then.

1 Like

Was the device encrypted? Factory reset destroys the encryption key as far as I know…

1 Like

Good point. Encryption would make things rather difficult.

No. A factory reset on the Fairphone 2 will leave encryption intact, because it only deletes files (in the TWRP recovery that would be “Wipe”). To get rid of encryption you would have to explicitly format the data partition (in the TWRP recovery that would be “Format Data”).

1 Like

So far no luck. No encryption was used, so that should not be an issue. I did copy the first 4GB chunk of data from mmcblk0p20 (ie “dd if=/dev/block/mmcblk0p20 of=/external_sd/20.dd”) and run photorec over it. All I get is many .txt and .elf files.

PS: How did this all happen? I was about to install OpenGAPPS, which did not work (zip signature check failed - even so I disabled it). So I cleared the cache, still no luck. Then in TWRP menu -> Wipe, the text says "Wipe Factory Reset, Wipes Data, Cache, Dalvik, not including internal storage). But obviously it DID wipe the internal storage. Now that’s the mess!

Even mounting a NTFS or EXTF formatted SD card on the phone is so non-trivial that I gave it up. And with FAT32, the max file size is limited to 4GB, so no way to dump the entire userdata partition that is 20 GB or so.

Running photorec on those 4GB chunks results in several .java .txt .jpg (system icons) etc files to be found, but none of my camera pics/vids.

I can’t believe it will be that hard to recover data from a wiped phone… Am I the only one who has this problem?..

@Ingo: As photorec searches for file signatures, should it not be able to work on the entire disk as well, ie. on a stream of bytes?

For the record and perhaps others who read along: To avoid this particular issue in the first place, just use the latest community TWRP available at twrp.me instead of Fairphone’s own older TWRP version which is bundled with Fairphone’s OSes currently.

@z3ntu: Do you know how community TWRP handles this?

Well, I don’t know how the tool works. In the past, some tools I read about were searching for specific positions in a partition that usually contains some inode table backup to find references to files. Those tools AFAIK didn’t read the entire stream of bytes but made assumptions based on the filesystem.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.