Two simple ways to recover photos from a broken SD card

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.

7 thoughts on “Two simple ways to recover photos from a broken SD card

  1. Thank you so much for this article, it helped me out recovering pictures from a friends SD-card.
    Thanks again :)

  2. Thank you so much for this article, it helped me out recovering pictures from a friends SD-card.
    Thanks again :)

  3. I’m not sure what all the computer terms mean but my mini SD has been snapped in half and I have both parts and was wondering if you could explain to me in dummy terms what I meed to do to retrieve them. Thanks.

    1. I’m afraid your snapped in half SD card is toast. If you really need the data off of it, you can send it for very expensive forensic recovery but even then the force of breaking it probably damaged quite a bit. Good luck.

  4. Ted Carnahan I need your help! My SD card isn’t damaged but the tiny orange clip that locks the card has somehow broken off! :( I really need the pics on this card and I’m so frustrated about this. Is it possible for me to retreive my pics ?

    1. The orange clip, I think, is just the control for read-only vs. read-write capability. So you should be able to stick it in your reader and make it work. Otherwise, take it to a competant local repair tech, who may be able to finagle it for you.

Comments are closed.