Corrupt CF card

1220512680000 » Tagged as: photography

Last december, I lost some important images thanks to the Compact Flash card on my Nikon D70S becoming corrupt. That time though, only a small number of files had disappeared from the listing or had gremlins in their file names. That time, I managed to recover most of them by using fsck.vfat on the CF card. So in actual fact only a small number of images were lost.

This time though the card was totally messed up , every single file in the directory listing had gremlins on them. I tried to do a manual fsck.vfat but there were simply too many errors. I soon gave up and re-ran with the -a option. The process seemed to run for an eternity thousands of filenames scrolled through the screen. These automatically renamed filenames are sequentially numbered and when it reached 9999 fsck crashed!

Now this calls for desparate measures. I searched around and came up with a life saving bit of C code that a gentleman by the name of Mark Oskin had written. The best solution to any problem is usually a simple one - and this bit of code was really simple. I did read about the FAT file system in one of those famous Peter Norton books about 20 years ago but that has long been forgotten. Apparently mark hasn't!

The code worked like a charm and i believe almost all the files were recovered. It cannot be run on the device itself but fortunately I had already taken a backup with 'dd if=/dev/sdd1 of=cfcard'. Wish I had tried it last time.

comments powered by Disqus