Last night my pastor emailed me telling me that he had accidentally deleted an entire folder of photographs off his Sony compact camera, and that Sony’s technical support informed him that it would cost $200-300 for them to recover the photos. After I got a hold of the memory card, I checked some of the recovery programs I’ve used in the past, but discovered that they now require paid licenses to actual do recovery (though analysis is free). I then stumbled across PhotoRec, a free and open source command-line application that’s bundled with TestDisk, something I’ve successfully used to regain access to inaccessible external hard drives.
In this post I’m going to show you how you can use PhotoRec to recover your photos if you’ve accidentally deleted them or formatted your memory card.
1. Stop Using the Memory Card
In most cases, data that’s “deleted” from a memory card is actually still intact and recoverable. The “deletion” simply marks the space on card as “free” allowing data that’s written in the future to overwrite it. Special recovery programs can still retrieve the deleted data.
Thus, the most important step after you’ve accidentally deleted stuff is to stop using the card. In my case, my pastor had taken about 50 photographs after deleting 500 photos, which meant that at least 50 of the deleted photos were permanently lost.
2. Download PhotoRec
You can download PhotoRec for free for whatever operating system you use here.
3. Use a Card Reader
Plug the card into a card reader so your computer can access it as a storage device or drive.
4. Run the Program
You can double click the program, but if you’re on Linux or a Mac you might need to run the program with root privileges (using sudo) to see the complete list of drives. See this page for more help on running the program.
5. Step Through the Screens
PhotoRec is pretty straightforward. Make your selections for each step for things such as disk to recover, partition type, destination to save recovered files to, etc… In most cases the correct option will be pre-selected for you. Since nothing will be changed or written on the memory card, you can always just try out the default selections and see if they work (they likely will). For a visual step-by-step guide for the different options, check out this page on the PhotoRec wiki.
6. Watch as Your Photos Are Extracted
Using PhotoRec, I was able to recover all 450 of the photographs that weren’t overwritten by new images from the 512 megabyte Memory Stick card in about 4 minutes. The program can be used for normal hard drives and non-photo files as well.
There you have it — the story of how I saved someone $300 and 450 memories. If you ever accidentally delete photos or format your memory card, think back to this post and try using PhotoRec to undo your disaster.