Ubuntu – Damaged SD card (badly unmounted?) How to fix

12.04filesystemsd card

First Off I'm using Ubuntu 12.04 on a laptop with a built in card reader.

I have a sandisk 8Gig micro sd card that came with my HTC Desire HD phone.

Unfortunately I had mounted it to a windows computer at work via a usb cable attached to the phone and didn't "safely remove hardware". This was not the first time I didn't "safely remove" it from windows and each time I accidentally did so, I had to restart my phone before the sd card was accessible again.

It must have worn out something though because now my phone won't recognize the card at all and when I put it into my laptop's card reader I get the following errors in /var/log/syslog

Apr  4 21:17:59 jesse-laptop kernel: [12665.532025] mmc0: error -110 whilst initialising SD card
Apr  4 21:18:00 jesse-laptop kernel: [12667.192024] mmc0: error -110 whilst initialising SD card
Apr  4 21:18:02 jesse-laptop kernel: [12668.860020] mmc0: error -110 whilst initialising SD card
Apr  4 21:18:04 jesse-laptop kernel: [12670.532020] mmc0: error -110 whilst initialising SD card

I have googled this message but can't find anywhere that explains what it means. All of the posts regarding similar errors that I found are about getting card readers to work, but my card reader works perfectly when I insert a different sd card.

Apr  4 21:26:35 jesse-laptop kernel: [13182.192121] mmc0: new SDHC card at address b368
Apr  4 21:26:35 jesse-laptop kernel: [13182.195849] mmcblk0: mmc0:b368       29.8 GiB 
Apr  4 21:26:35 jesse-laptop kernel: [13182.197931]  mmcblk0: p1

So I know the problem is with the damaged card not the reader.

The problem seems to be with initializing the card because it doesn't appear under /dev/ anywhere I can find. When I insert a working SD card it appears as /dev/mmcblk0 & the partition is /dev/mmcblk0p1.

Needless to say I can't format the card or run any recovery software until I can get it to appear as a device.

Edit: – I have discovered by looking at my syslog relevant parts available here that when I first inserted my card the error was different to what it is now. I don't really understand any of these errors. I'm guessing the card was left in a state of anticipating a transfer (if that's possible) and it didn't receive it. Now it can't be initialized (whatever that actually means)

Any help regarding what this error means and/or how to recover data from my sd card is very much appreciated. Most of my important data was backed up but there was one note taking application (on my phone) that wasn't and I'd like very much to retrieve that data.

P.S. Both the working card and the damaged card are micro sd and I'm using a card adapter to insert them into my computer.

P.P.S. I've uploaded an annotated version of my /var/log/syslog with just the relevant parts here and also the full syslog here

Best Answer

It looks like the card has been damaged due to premature removal. The messages indicate either a controller failure in the card or bad blocks. The latter may be recoverable. Try this to recover:

  • Insert card
  • Unmount it with umount /dev/mmc0 (or with whatever the drive is mounted as)
  • fsck -v /dev/mmc0
  • mount it

If this doesn't help, you have to reformat with mkfs. If the card is still unusable, the controller has probably been damaged in hardware beyond recovery.