Flash Card Recovery Project

While I was in Chiang Mai, Thailand, the 256 MB Compact Flash card that I bought in Hong Kong failed. The card could not be read using my camera. The card could also not be read with any of three different card readers on two different computers. I had the presence of mind to dump the flash card into a 246 MB raw disk dump file. Now that I am back in the United States next to my computer, I am attempting to retrieve my pictures. This is a log of my work on recovering the images on the card.

Failed N Plus Compact Flash Card

I am trying to mount the dump as a floppy drive in VMWare and run chkdsk on it.

   Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>chkdsk a:
The type of the file system is RAW.
CHKDSK is not available for RAW drives.


Unfortunately, Windows does not seem to be able to handle the dump. Since that did not work, I am now trying to fix it using Linux's filesystem checker.

   > /sbin/fsck.msdos 256mb.ima
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Both FATs appear to be corrupt. Giving up.

The damage is apparently too extensive for Linux to fix. After talking to Monty, I am inspired to try a different approach. All of the jpeg files on the disk dump start with the same four bytes. I am removing all the parts of the dump before the first jpeg header and viewing the result in an image viewer.

first recovered image

That appears to work. To see if this method is generalizable, I am attempting a similar procedure for the second picture header in the file.

second recovered image

Unfortunately, this approach appears to have stopped working. Wes Nelson just inspired me to have the optimism to check the third image.

third recovered image

After another comment from Wes, I realize that part of the second file allocation table on the dump is still there and might help reconstruct at least some of the images. Also, my success rate having gone up to 66% has given me enough optimism to write a script to actually cut the dump into pieces separated by this four byte header.

That process generated 263 files. 226 out of them are intact, and 37 of them are damaged. My mind is telling me that I should write off the 37 damaged pictures and conclude this project now.

My Cambodia pictures, including the recovered ones, are on display in my photography library.

Images hosted on flickr

Subscribe to All Posts - Wesley Tanaka