You are not logged in.

#1 2021-04-24 12:43:53

wellohead
Member
Registered: 2011-06-30
Posts: 11

MicroSD card showing up with wrong size after crash

Hi all,

I have an 16GB micro-sd card which had a really bad time when the computer hard-crashed/rebooted while I was copying files to it. It's not completely bricked but shows up as only having 512KB capacity:

Entries in dmesg when inserting the card:

[22027.642273] mmc0: new SD card at address b368
[22027.652105] mmcblk0: mmc0:b368 SMI-S 512 KiB

Output of  fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

First I was thinking about using rufus on windows, which does a great job at fixing corrupted ID'ing of removable drives, but it only works on usb drives and I only have internal pci card readers. I tried (on my wife's computer with win installed) and it doesn't see the card at all, even with the 'show all drives' advanced option ticked.

What (hopefully linux) tools can I use to fix this? I know it's not strictly arch related but I figured it must have happened to someone here before, just couldn't get a hit with the search (probably using wrong terms).

All help most welcome!

(edited post title to remove ambiguity on the type of card, originally wrote "compact flash")

Last edited by wellohead (2021-04-27 17:28:03)

Offline

#2 2021-04-24 13:57:41

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 611

Re: MicroSD card showing up with wrong size after crash

You didn't say which type of filesystem is on the card or mention partition layout.
TestDisk maybe? https://wiki.archlinux.org/index.php/File_recovery

Offline

#3 2021-04-24 14:24:58

wellohead
Member
Registered: 2011-06-30
Posts: 11

Re: MicroSD card showing up with wrong size after crash

Thanks for the reply.

Well, I probably wansn't clear about this in the original post but I don't need to recover anything from the card. It contained a single vfat partition spanning the whole available memory (a real partition, not superdisk-style).

My goal is to get the card to show its real storage capacity of 16GB so I can continue to use it again (after proper re-partitioning and and formatting of course). I looked at the manufacturer's website (Lexar) but they only have data-recovery utilities available for download, nothing to re-initialize cards or similar.

Last edited by wellohead (2021-04-24 14:26:08)

Offline

#4 2021-04-26 20:33:11

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 611

Re: MicroSD card showing up with wrong size after crash

From the link I posted: "TestDisk allows to fix partition tables, recover deleted partitions" - isn't that what you were after?
Could you try formatting the card in other hardware, like a phone or camera for instance (there have been posts on this forum about internal card readers not working correctly)?

Did you have a go with gparted?

Last edited by paulkerry (2021-04-26 20:41:30)

Offline

#5 2021-04-27 16:14:41

wellohead
Member
Registered: 2011-06-30
Posts: 11

Re: MicroSD card showing up with wrong size after crash

Hi. The problem is not with the partitioning or lost data. The card now 'announces' itself as a 512KB card instead of 16GB) so that's what fdisk and every other tool assumes. I'm looking for a way to restore how the card presents itself properly to the system. The card wasn't new but very seldom written to, so no cell-wear problem there. Right now I'm looking into the sdcard.org whitepapers to see if there's a way to reprogram the protected registers in SPI mode, so I'll close this for now, not gonna be newbie-corner nor arch-related.

Thanks for the helping advices though, appreciated!

Offline

#6 2021-04-27 17:13:14

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: MicroSD card showing up with wrong size after crash

Please don't mark your thread as [Closed], this is reserved for threads that have been locked by the mods from any further posts.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

Board footer

Powered by FluxBB