Two simple ways to recover photos from a broken SD card

A Tech article with View Comments posted 1 February 2008.
Tags: , , , ,

I just got back from a 18 day trip to Israel and Palestine, and my classmate Dave’s SD card for his digital camera gave out right at the end of the trip. He gave me the card to try to recover the pictures, and I was pretty successful. Here’s what I did.

I needed to grab a pristine copy of the SD card’s data without hardware errors getting in the way. So I used dd to take a snapshot of the card:

sudo dd if=/dev/mmcblk0 of=sdcard.img bs=512b skip=1 conv=noerror

The /dev/mmcblk0 should be replaced with the location of your SD card reader. The magic sauce is conv=noerror, which prevented me from getting an error with Dave’s card about 40% into a 1G card.

First I tried recoverjpeg, available from your friendly local ubuntu repository. Run this program like so:

recoverjpeg -v sdcard.img

Simple and straightforward. This program recovered 108 pictures, all with EXIF data intact (except for no date/timestamps – oh well).

I also tried photorec, which is part of the testdisk package in Ubuntu. Photorec is more complicated, but it recovers more kinds of data too. Fortunately, it’s menu driven and pretty self explanatory. Invoke that program with:

photorec sdcard.img

Not only did this program recover most of the pictures (106), but it also grabbed all sorts of interesting metadata in the form of txt and xml files. It also did a good job with the EXIF data, except for the date/timestamps.

Altogether, I got slightly better results with recoverjpeg, and it was easier to use. Your Mileage May Vary. I was surprised at how easy it was to recover these images!

Special thanks to Cédric Blancher, whose article “Digital Photos Recovery” was very useful as I prepared this article.

You might also enjoy:

  1. Wedding and Honeymoon Photos
  2. Restoring from backups with F-Spot
  3. Family Photos, May 2009
  4. Photos of Family Visits
  5. Java printing broken in Ubuntu Gutsy

  • Frankie
    Thank you so much for this article, it helped me out recovering pictures from a friends SD-card.
    Thanks again :)
  • You're welcome - since I learned how to do this and wrote this up two years ago, it's come in handy numerous times.
blog comments powered by Disqus