Recovering images from a Compact Flash card

My Nikon D70 uses Compact Flash (CF) storage – not the smallest form factor but certainly one of the more established types (and when I bought the camera it was important for my camera to also support IBM/Hitachi microdrives, although with the increasing availability of large-capacity flash cards that’s no longer an issue). I use Lexar Professional cards – usually a 2GB 133x speed card with write acceleration – but this week I’ve had some problems.

In the middle of taking photos of my children, struggling to get them to sit still with my grandparents and for everyone to look towards me (I hate taking portraits), my camera reported an error before it decided that the card was not formatted. I turned the camera off and on again, then shot off a few frames, before the battery indicator told me that I needed to recharge (maybe that was the issue all along). I switched to my spare battery and then continued taking photos with no issues.

When I tried to read the card on my Mac, everything seemed fine (pictures were all there), except that when I ejected it (by right clicking and selecting eject, waiting for the icon to disappear and then waiting a few more seconds) OS X told me that I had removed a device incorrectly and there could be some damage to files. That would be fine if I had just removed the card, but as I had ejected the card properly and the icon had disappeared, it was logical to think that it was safe to remove (Windows may have many faults but at least it confirms when it’s safe to remove a device).

This afternoon, I wanted to copy files from the card before wiping it for a new shoot. Strangely, instead of all my files being neatly numbered DSC_xxxx.JPG, I had DWC_xxxx.JPG and DSC[xxxx.JPG files. They all seemed to preview with no issues in-camera, but some of the files failed to copy to the Mac. I tried again on a Windows Vista PC but with similar issues (at least Windows let me skip the offending files and continue the copy) then, after removing the card and looking again in-camera, I switched back to the Windows machine, where Vista told me that the media appeared to have some damage – did I want to scan and fix it. Thinking that might help me, I let Windows do it’s stuff and, after a very brief interval, it told me that it had succeeded; however all I could see was one 32KB file where the folder used to be with over 700 images in it!

After a mild panic (I had most of those images backed up but there were 16 still to recover), I remembered the Lexar Image Rescue 2 software that came pre-loaded on the CF card when I bought it. I loaded that up on a Windows XP machine (in case there were compatibility issues with Vista) and successfully recovered 747 files from a low level search (which took about an hour for my 2GB card). The 747 resulting .THM files appeared to be JPEGs – at least renaming them *.JPG seemed to work. Then I tried a high-level search – this time I got a number of .CHK files including 712 which corresponded to JPEGs – the difference would appear to be the number of files present in the directory compared with files on disk marked for deletion but not yet overwritten.

Crucially, the recovered files still have the EXIF data letting me work out when they were taken (and therefore helping to narrow down the search for my missing pictures). Once renamed to *.JPG, I could also preview the images with the exception of one files which appear to have been irretrievably corrupted, either by my camera losing power during a write, or by my Mac failing to eject the card properly.

4 thoughts on “Recovering images from a Compact Flash card

  1. Hi Mark,

    After reading your article I thought you might also be interested in PhotoRec

    An open source media recovery tool. I used a few months ago to recover 90Gb worth of video I lost after a the partition table got corrupted on a disk.

    It recovered all the files, which is something that the commercial applications I bought just couldn’t do.

  2. Hi Matt,
    Thanks for that – the software that came with my card seemed to work for me this time, but it’s handy to know of an open-source alternative.

    Cheers, Mark

  3. The next time you have a problem like this and can’t find the Lexar software, use the excellent opensource photorec utility. It performs similar to Lexar’s tool and also works for harddisks etc. Basically any storage drive connnected to the computer.

Leave a Reply