HowTo recover jpeg images from corrupt memory card
I've spent a significant portion of my youth messing around with file system editing and partition table editing an was not going to give up on the series of photos I'd taken over the last couple of days - luckily it didn't need anything more than a couple of simple commands to recover all the photos. Go Open Source software.
This tutorial is written for Ubuntu, but should be similar for most Linux machines
Step 1 was to make an image of the card (to have a backup of it) using the venerable dd command.
- sudo - used to perform command as root user (i.e. have correct privileges)
- dd - command to copy data a byte level
- if=/dev/sdb - read data from /dev/sdb - you may need to change this depending on where your memory card it located.
- of=sdcard.img - save this to the sdcard.img file in the current directory
- bs=1M - Copy it in 1M chunks
Once this has completed you will need to run the marvellous program recoverjpeg on it.
First lets install it:
Then run it:
and you should get something like the following:
Restored 290 pictures
Check the images out and hopefully it works as well for you as it did for me.
Cheers, Mark




Back to Ubuntu and in 30 seconds all the photos were back with us.
Thanks a million!!
Something like dd if=/dev/sdb of=disk.img bs=1M skip=<blocks copied> count=30000
I repeated the above 6 times, each time copying 30 Gigs of data. I also had to skip the first 40 megs since there was some kind of disk error.
Cheers,
Mark
$ sudo dd if=/dev/mmcblk0p1 of=sdcard.img bs=1M
dd: reading `/dev/mmcblk0p1': Input/output error
0+1 records in
0+1 records out
126976 bytes (127 kB) copied, 0.0539359 s, 2.4 MB/s
I also tried running recoverjpeg directly on /dev/mmcblk0p1, likewise to no avail.
/dev/mmcblk0p1 is definitely there; I can open it with fdisk.
Any ideas?