Ever heard about those incredibly expensive file recovery tools? For recovering photos, documents and all kinda stuff? Since I run Time Machine on my Mac and since I do full backups of my valuable stuff regularly, I was pretty sure I’d never need one of those… until today!
Yesterday evening, I took some amazing photos with my Pentax DSLR. The lighting was absolutely perfect and I was looking forward to importing them in iPhoto today. I don’t sync my SD card with iPhoto every time I take a bunch of pictures. I generally wait until I need some pics immediately to copy all the previous ones over to my Mac. So this morning, I wanted to import the current batch of photos from my SD card into iPhoto. Worked as always, except for the photos I took yesterday evening. Out of the dozen or so I took, there was only one left. And that one was corrupted (a bunch of weird horizontal lines within the pic). ALL the others from yesterday were gone. And since I selected “Delete Originals after import”, the SD card was…. empty!
Having the exact same conditions as yesterday is unlikely, especially with the f’d up weather here in Belgium. Therefor, I decided to take a look at the file recovery tools out there.
Being on a Mac doesn’t help when it comes to finding free niche products. That narrowed down the available tool palette. I ended up taking a look at two tools: LC-Tech’s Photorecovery and Christophe Gernier’s photorec. The former being a commercial tool, I used the demo. The latter is an open source command line tool.
Photorecovery worked pretty well and was easy to use. However, as much as I wanted the lost photos back, I didn’t want to spend the $40 to buy a license. And since the demo only displays the recovered files as low-res thumbnails with watermark, I was unable to get the actual files back using the demo. So I went on to the open source tool photorec.
I was a bit confused at first, because although I downloaded the Mac version, I wasn’t able to find the .app executable. Being a geek but being used to Mac GUI friendliness, it took me a while to figure out that photorec is actually a command line application. The advantage of it being an open source commandline tool is that it runs on virtually any OS. The downside is the lack of documentation. All documentation links point back to the “What is photorec?” page, which isn’t really useful when it comes to using it. Fortunately, I figured out the tool without documentation. A pitfall I ran into was the “Cannot create file in current directory.” error message. Although I started it with sudo to give it privileged access to my filesystems, I kept getting that message as soon as it tried to recover the first file.
The key to that problem was the path to the directory I told photorec to store the recovered files in. It was something like
As I should have guessed from the beginning, the space in “Macintosh HD” was confusing the command line application. The fix was easy: Using a path without whitespace made the whole recovery work immediately… epic! Although some of the lost pictures still have the weird broken lines in them, I was able to recover others in perfect condition! I’m convinced this is either a camera, an SD card or a combination-of-the-two-issue, and I’m glad I’m using a Mac nontheless 🙂
photorec saved my day, thanks Mr. Grenier!