3

Using the Linux area since I'm using Linux apps and utilities.

My phone crashed (several times) and managed to corrupt my microSD card. It no longer appears to have partitions and shows as 32MB rather than 2GB. That's using testdisk. dd and ddrescue only pulled 30.6MB of null off of it.

It is genuine SanDisk branded, purchased from a reputable retailer, and the space has been working perfectly for a year.

I expect it's had it, but I didn't see the harm in asking. Even if I forget about the few files I'd like off of it, formatting will probably leave me with a fairly useless 32MB card.

If anyone has any method of at least repairing the card, it would be much appreciated.

2
  • This sounds like a hardware issue, perhaps the card dropping into some antique compatibility mode for some reason. What does /proc/partitions show for that device (e.g. grep sdc /proc/partitions)? Do you get any kernel messages (/var/log/kern.log) when you insert the card? – Gilles 'SO- stop being evil' Feb 16 '12 at 22:30
  • Partitions shows just sdb, no sdb1 etc. The log file says pastebin.com/mqESsNiq – antubis Feb 16 '12 at 23:11
2

I've run across cards in that condition a couple of times. I'm sorry to report that I've not been able to fix any of them. I'm thinking it's probably due to a hardware failure as no software tricks I could think of could get them going again.

2
  • I expect you're right there. A shame, but thanks. – antubis Feb 16 '12 at 21:21
  • I just tried this for an SD card I have, it didn't appear to work for me. – Gordolio Aug 15 '14 at 14:17
2

If you cannot get anything recovered and you just want to try to put it back into a usuable state, follow the dd advice from Renan. If this is your first time doing this, you will need more details.

This will delete everything, so be warned. Unplug all other drives and reboot your computer with a Live Linux disk or risk data loss on a plugged in drive.

Don't plug in your disk yet. Run this command.

sudo fdisk -l

Now plug in your disk and run the command again. You will see an entry that wasn't there before. That entry is your device. Write down that device path. If you haven't unplugged all other devices, DO NOT MIX THIS UP WITH ANOTHER ONE.

It will be something like this:

/dev/sdx

Where the x in sdx is your drives letter.

Now that you found your device type in:

sudo dd if=/dev/zero of=/dev/sdx

where the x in sdx is the letter of your drive. (There should not be a number at the end of your device for this command.)

Wait for it to zero. Now type:

sudo fdisk /dev/sdx

You will need to first create a dos disk label. So choose that option.

After creating a dos disk label, you will need to create a partition. Choose make a partition from the menu. Just hit enter and it will give you the defaults. The defaults will make the partition the maximum size of your usb.

Choose the menu item that says to exit and write changes to disk. Make sure the messages don't have errors. If errors exist, you need to repeat these previous steps (but not zeroing).

Now type

mkfs /dev/sdx1

Again, x is the letter of your drive.

Unplug and plug back in and you should see it auto mounted. It's permission will be set to root, so you may need to adjust them.

Always be weary of this drive in the future. Back everything up. I would have recommended GParted, but I believe it does not recognize zeroed drives.

6
  • I've had lots of fun with hard drives before but thank you for the details. The problem is that the device (sdb) is physically only showing as 32MB, and according to dd, is already full of zeroes. Is formatting it not going to result in a 32MB drive? Like I say, I'll try in a bit anyway. – antubis Feb 17 '12 at 13:47
  • it should not show anything after you zero. It goes over the disk label and partition info. When you dd make sure you choose /dev/sdb not /dev/sdb1. /dev/sdb is your device in general where /dev/sdb1 is the partition on the device. dd will ignore partition info and go to the physical end. I'm guessing you are showing less mem because the partition table is corrupt. – bambuntu Feb 18 '12 at 8:26
  • If it truly is a hardware problem, then this 32MB limit is not the partition table, instead a physical problem with the drive. If so, just throw it out. Don't trust it. I just had to throw out a 4gig. It sucks. – bambuntu Feb 18 '12 at 8:29
  • A way to maintain these drives best is not allow writing too much in the same area. Think of it this way, if you write a file, then delete it, it's probably going to write the next new file in that same spot. Repeatedly doing this wears out that general area. If you only trash the file, it doesn't remove it, just marks it. So let the trash fill up until you have no space left. – bambuntu Feb 18 '12 at 8:38
  • dd: writing to `/dev/sdb': No space left on device 62689+0 records in 62688+0 records out 32096256 bytes (32 MB) copied, 0.109729 s, 293 MB/s – antubis Feb 18 '12 at 12:58
1

I had this problem. First I tried various formatting methods. Ended up using windows diskpart to 'format quick fs=ntfs' just to see if it would resize properly. It didn't. Then I used this SD card formatting utility recommended on the Raspberry Pi site and it did the trick.

https://www.sdcard.org/downloads/formatter_4/

2
  • 1
    I just want to give a huge thanks to user16345 for this sdcard.org/downloads/formatter_4 . The formatter worked great and got my 32gb card showing 12mb back to 32gb. The key for those this didn't work for is to make sure format size adjustment is enabled. Running without that enabled just gave me 12mb again. I also ran it as admin incase that matters. – user139094 Oct 18 '15 at 18:06
  • It didn't work for me. Although run as administrator, I saw no option to enable size adjustment. Furthermore, trying to format at the detected (but wrong) size produced an error. – Ivan Ogai Jul 28 '18 at 18:31
1

Honest to god this is what I tried and it worked.

I took a ear bud (the little thingys with cotton on one end.. cotton swab).. and wet it with nail polish remover. Then I cleaned the contacts (which were looking very neat and clean to begin with!!) and then wiped it off with a restaurant napkin.. the one that they keep on your table to wipe your mustache.. and then did it again. This time DID NOT wipe it but let that thing dry (does not take long.. about 30 secs).. then poped it in viola.. it was as good as new. (And all that after following all the steps above including trying to write zeros).. and all those started showing 0 bytes. I could recover even old data.

1

Every time I've seen this exact failure mode, close examination of the micro SD card concerned has shown that I've actually managed to crack it - that is, physically break it - just behind the contact strip, with the crack on the opposite side of the card from the contacts.

The kind of simple micro SD socket that HardKernel uses on its ODroid development boards, which doesn't fully enclose the inserted cards, leaves them particularly susceptible to this kind of damage and SanDisk cards in particular do seem quite physically fragile in this spot.

If you were very very lucky you might be able to restore operation by chemically welding the crack back together with an aggressive solvent like nail polish remover while holding the card slightly flexed in the exact manner needed to reconnect whatever internal trackwork has become separated.

You might even be able to do this by accident while convincing yourself that what you were actually doing with your nail polish remover was cleaning the contact pads. But the card would never be reliable again; if you do manage to fix one this way, your best option would be to image it immediately to a fresh card and then turf it.

1

As much as this sounds like a hardware failure, a procedure that can be tried is:

  1. Begin by taking a disk image of whatever can be read from the device, using dd.

    $ dd if=/dev/sdX of=memory_card.img
    
  2. After, fill it with zeros, e.g.

    $ dd if=/dev/zero of=/dev/sdX
    

    then reformat it.

3
  • I did take an image from it (dd noerror and ddrescue), and it was 32MB of zero. There wasn't a single byte of anything else. I'll try writing in case it has a different effect but that 32 seems to have become a physical limit. – antubis Feb 17 '12 at 13:38
  • I should clarify, that was with if=/dev/sdb – antubis Feb 17 '12 at 13:51
  • Then yes, it most likely is a hardware problem. – Renan Feb 17 '12 at 18:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.