I’ve just come back from my sister-in-laws wedding. It was great and we took some really good photos. (When I see we, I mean Jude took some really great photos, and I cut some peoples head off). Unfortunately, we accidentally formatted the card and lost all of our photos.
Being fairly geeky, Jude and I thought we might be able to recover some of the photos. Never tried it before, but thought it should be possible.Â If they can do it on CSI, it must be possible.Â Right?
When you delete a file on a computer, usually the contents of the file remain on the disk but the information that tells the computer where the file is is deleted. Knowing this, we decided the best thing to do was to remove the memory card and take photos using a different one. This would stop us from overwriting any data that might still be on the card.
To reduce the chance of corrupting any data on the card, I made a copy of the entire disk. Using the command ‘dd’ I made an image of the disk.
dd if=/dev/disk/by-label/EOS_DIGITAL of=/home/toeknee/cf/backup.img bs=512 conv=notrunc
This made a 2 gigabyte file on my computer containing all the data from the compact flash card.
Fairly happy that I had a copy of the card, I unmounted and removed it and put it in a safe place. I looked around google for a while trying to find other examples of people recovering images, but I didn’t find much of use. I thought I have a quick look in the ol’ package manager for programs that could recover files from FAT file systems (FAT is the file system used by most cameras). I came across a program called PhotoRec in the package testdisk.
PhotoRec is described as “file data recovery software designed to recover lost pictures from digital camera memory or even Hard Disks.”
Sounds good to me.
Enter the directory that the photos should be restored to, start it up and wait.
15 minutes later I had 200-odd pictures of the wedding and some that I had deleted months ago.
Very happy Tony, Very happy Jude. Very happy group photo…
conv=notrunc to the dd command as suggested by docatomic