2007
10.22

PhotoRec

I recently purchased a new digital camera, along with my camera I purchased a SanDisk Ultra III CompactFlash card. The salesman emphasized the fact that SanDisk included file recovery software with its CompactFlash. Of course that’s commendable, however it’s not of very much use for me on Ubuntu.

But fear not, Ubuntu has PhotoRec. PhotoRec is a small curses application which is included in the testdisk Ubuntu package. PhotoRec can scan a block devices’ surface (this can be anything, from a memory card, usb stick, harddisk to a DVD) and recognize lost files. This ofcourse only works if the device has not been badly physically damaged or too much files have been written over the old lost data.

This all sounds nice ofcourse. But how does it actually fare in practice? Well I put it to the test, a fairly obvious test. Most camera’s have a built-in “format memory card” feature, which rebuilds a new and empty filesystem table on the memory card. This effectively makes all the old data inaccessible using conventional methods. Although inaccessible, the data is still there! Unless you start overwriting the data!

First I took a 1GB CompactFlash card, which I formatted in my camera. Next I started taking pictures (in RAW+JPG mode) until the CF card was full. I backupped the contents of the CF card on my computer. Then I reinserted the CF card into my camera and intentionally formatted it again (simulating an accidental format). Taking the CF card back to my computer confirmed the CF card was formatted, all the files were “gone”. Running PhotoRec immediately after the format, revealed all the old files again. PhotoRec never touches (writes to) the original media, so it will never worsten your situation. PhotoRec always saves the recovered files to another location.

Having completed the above, I had two sets of data, the original backupped files, and the recovered ones. Time for a comparison I’d say. All the JPEG files were perfectly recovered, the recovered files were byte-for-byte identical to the originals. The raw files were a different story, the checksums didn’t match, not even for a single file. The filesizes also didn’t match, they were close though, most files deviated only a 100 bytes from the original. Luckily UFRaw never even noticed, it read the recovered files asif nothing ever happened.

So if you ever accidentially erase your memory card, don’t fear, PhotoRec is here. Just stop using the card until you have time to recover it. In my test situation it fared nearly perfectly. Your mileage may vary.

No Comment.

Add Your Comment

Comments are closed.