Monday, March 22, 2010

Recovering files from a corrupt memory card

Yesterday was a busy and frustrating day. Well, most of it.

The memory card of my mobile phone suddenly decided to go bust. I searched the entire web for programs which would allow me to recover data from my memory card. Unfortunately most of them were Windows ones and none of them worked with wine (the demo versions that is, because the full versions of those softwares cost a bomb!).

So there I was stuck with my corrupt memory card. I had loads of important data on it so losing all those meant losing quite a lot of data. Fortunately help was right at hand! I came across some very useful posts ( and which made things easy.

What I did was as follows:

1. I made an image of the memory card on my PC. How? By typing the following in the Terminal:

dd if=/dev/sdb1 of=memory_card.img bs=512

"memory_card.img" was saved under my /home folder. sda is the device name of the memory card, it might not be the same for you. To check what the assigned name of the memory card is, I opened System Monitor (available under System > Administration > System Monitor) and then clicked on the tab called File Systems. Also, please note, this 'creating image' process can take some time. It took the program around 20 mins to scan a 1GB RS-MMC memory card.

2. Next, I installed Testdisk

sudo apt-get install testdisk

3. Next I used Photorec, a free data recovery tool to scan the image of the memory card

sudo photorec memory_card.img

memory_card is of course the name you have used to save the image on your hard drive.

I simply followed the instructions of Photorec and the lost files were back, saved under the /home folder. Phew! I cannot explain how relieved i was! Open source saved the day!


1 comment:

  1. You are a lifesaver! The combination of my new MB Pro and rubbish Lexar cardreader rendered my CF card unreadable, which contained all of the photos from my daughter's 2nd birthday party. Fortunately your tips have allowed me to restore the images! Thanks!