Joy of FAT

Feb 16 2008

Darn, another lazyweb question time.

I was excited to see the photos I shot today. I had my desktop running when I came home, so I quickly took out a CF2 card from the USB reader which was likely mounted on a running system (had the monitor switched off) and quickly shoved the one from the camera in. No photos, only the DCIM folder appeared as a file. Unmounted, shoved it into the camera, no content. Eeeek! The empty space shows there is data on the card. So I dd the device into a file (dd if=/dev/sdd1 of=backup.vfat) and begin experimenting with fsck.vfat. It gives me 4 combinations of the following choices:

dosfsck 2.11, 12 Mar 2005, FAT32, LFN
FATs differ but appear to be intact. Use which FAT ?
1) Use first FAT
2) Use second FAT


/DCIM  and
  share clusters.
1) Truncate first to 0 bytes and restart
2) Truncate second to 0 bytes

None of the combinations end up having any files. The card is 1G and surprisingly doesn’t compress with bzip at all, but I would be thankful for any suggestions on how to get the rather fab photos back. I can’t imagine how I’d feel if this happened on my New Zealand trip for example.

Update: After some more googling (should have looked at the moderated comments here for some hints ;) I found an awesome free software recovery tool, called Photorec (packaged for opensuse even). It supports multiple filesystems and is able to recover images even on a completely hosed card or image. Man I’m so happy. PhotoRec deserves to do much better on a photo recovery linux query on google.