You are not logged in.

#1 2017-03-15 15:12:56

pstree
Member
From: Paris, France
Registered: 2013-02-24
Posts: 37

[Abandoned] Corrupted SD Card

Hi,

I have a 64 GB microSD card, formatted in FAT32 (just a single big partition). It worked fine until recently, when I tried to delete some data on it, and it refused to cooperate sad

I tried a few utilities (fdisk, gparted, even dd), but I always get a input/output error. Here is what dmesg says when I plug it in :

[ 3922.438924] mmc0: new ultra high speed SDR50 SDXC card at address e624
[ 3922.440554] mmcblk0: mmc0:e624 SU64G 59.5 GiB 
[ 3922.443867]  mmcblk0: p1
[ 3922.632985] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

I did run fsck, which told me this :

fsck from util-linux 2.29.2
fsck.fat 4.0 (2016-05-06)
0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 2
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
? 2
Reclaimed 4938 unused clusters (161808384 bytes).
Free cluster summary wrong (676227 vs. really 680990)
1) Correct
2) Don't correct
? 1
Perform changes ? (y/n) y
/dev/mmcblk0p1: 4848 files, 1267493/1948483 clusters

But it didn't change anything, and does not appear to have any effect whatsoever. Actually, when I unplug and then plug it back in, fsck does the exact same things.
It seems that the partition table is somewhat corrupted... But I can't rewrite it or format the whole thing because I always get an I/O error...

Any ideas ?

Last edited by pstree (2017-03-16 17:58:56)


: (){ : |:& };:

Offline

#2 2017-03-15 23:41:45

mpan
Member
Registered: 2012-08-01
Posts: 1,188
Website

Re: [Abandoned] Corrupted SD Card

  • ddrescue may let you recover data. However your earlier attempts to write to the card have probably destroyed lots of it already.

  • Some vendors provide software for re-uploading the firmware. You may try that. It will most probably be proprietary, will require you to use a specific version of Microsoft® Windows® and run it as Administrator. If it’s firmware-only issue and the memory itself is fine, it may help.

  • Buy a new card — usually it’s the best option.


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#3 2017-03-16 08:29:09

pstree
Member
From: Paris, France
Registered: 2013-02-24
Posts: 37

Re: [Abandoned] Corrupted SD Card

mpan wrote:

ddrescue may let you recover data. However your earlier attempts to write to the card have probably destroyed lots of it already.

Actually, I can access the data and most of it seems fine (though some of it may be corrupted). I'm fine with losing it, at this point I just want to format the card to be able to use it again.
The card seems to be functional since I can read the data. But no tool I tried seems to be able to write on it.

Do you know any tools that would bypass this weird block ?


: (){ : |:& };:

Offline

#4 2017-03-16 13:45:14

mpan
Member
Registered: 2012-08-01
Posts: 1,188
Website

Re: [Abandoned] Corrupted SD Card

The answers has been given already:

  • The firmware got corrupted → you may try some vendor’s software that re-uploads it.

  • The card is electrically damaged → buy a new card.


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#5 2017-03-16 13:54:54

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [Abandoned] Corrupted SD Card

Does the card (or adapter if you are using one) have lock slider? Make sure it is not getting moved to the locked position when you are inserting it into the card reader.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#6 2017-03-16 17:58:05

pstree
Member
From: Paris, France
Registered: 2013-02-24
Posts: 37

Re: [Abandoned] Corrupted SD Card

Well, even the vendor's software failed, so I guess I just have to buy a new one. sad
For some mysterious reason, the card seems to be forever locked in read-only mode...


: (){ : |:& };:

Offline

#7 2017-03-16 18:22:16

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: [Abandoned] Corrupted SD Card

That's actually quite common. When (some?) SDCards encounter a fault that they can't recover from, they perform a one-way switch to read-only mode, presumably to protect the data that already exists on the card from further damage. I'm not sure if this is documented anywhere, but I've seen it happen a number of times.

The cynic in me suspects this is by design so that vendors can continue to sell you replacement SDCards.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#8 2017-03-17 12:41:36

mpan
Member
Registered: 2012-08-01
Posts: 1,188
Website

Re: [Abandoned] Corrupted SD Card

R00KIE:
The lock switch doesn’t affect writing. It’s a gimmick¹ handled in software by the operating system. Since OS knows that device asked it to be used in read-only mode, it doesn’t cause I/O errors, but a graceful refusal to write to the device. From dmesg:

[153827.005172] sd 6:0:0:2: [sde] Write Protect is on

dd attempt:

dd: failed to open '/dev/sde1': Read-only file system

pstree:
It’s not a “read-only mode”: the device is simply broken. Saying that it’s some kind of special mode is like saying that if you burn a lightbulb it is in “dark-only mode”².

WorMzy:
Could you provide some additional sources on the topic? My Occam’s razor tingles :D.

____
¹ Something like holes in floppies, but implemented as a switch that connects two wires together to let the reader detect lock position.
² Strictly speaking it is, but I believe it was not the meaning of “mode” you wanted to use.


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#9 2017-03-17 13:16:24

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: [Abandoned] Corrupted SD Card

Alas, no. I only have my own experiences to draw from. You can find some similar stories on $searchengine (1, 2, 3), but I can't confirm if these are the same problem or not.

The weirdest one I experienced was where the card would pretend to be writable (you could remove files, format the card completely, fill it with random data, etc.), but as soon as you removed and reinserted the card, or rebooted, the old data was there, completely readable (for a given value of -- I didn't check every file). I may still have one or two of these cards somewhere (I'm one of those strange people who keeps old heatsinks and other junk they'll probably never use), but most of the cards I looked at were other peoples.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#10 2017-03-17 13:30:05

pstree
Member
From: Paris, France
Registered: 2013-02-24
Posts: 37

Re: [Abandoned] Corrupted SD Card

WorMzy wrote:

The weirdest one I experienced was where the card would pretend to be writable (you could remove files, format the card completely, fill it with random data, etc.), but as soon as you removed and reinserted the card, or rebooted, the old data was there, completely readable.

That's exactly what happens when I open the card with a file explorer. Yet the data being fine means that it's not a hardware failure, but some kind of stupid firmware block...


: (){ : |:& };:

Offline

#11 2017-03-17 14:36:52

Awebb
Member
Registered: 2010-05-06
Posts: 6,275

Re: [Abandoned] Corrupted SD Card

SDHX card making trouble on Linux? I bet this card worked fine, but not on this particular Linux device. Research the module option "sdhci debug_quirks=".

Offline

#12 2017-03-17 14:50:19

pstree
Member
From: Paris, France
Registered: 2013-02-24
Posts: 37

Re: [Abandoned] Corrupted SD Card

Awebb wrote:

SDHX card making trouble on Linux? I bet this card worked fine, but not on this particular Linux device. Research the module option "sdhci debug_quirks=".

Well, I tried it on several devices : three computers on Arch, two Windows, and an Android phone (and with several adaptors, just in case). Nothing worked, so I'm pretty sure the problem comes from the card.
When I was using it I always took care to unmount it properly each time, but something must have gone wrong somewhere...


: (){ : |:& };:

Offline

#13 2017-03-18 02:29:51

tlmiller
Member
Registered: 2009-06-10
Posts: 93

Re: [Abandoned] Corrupted SD Card

pstree wrote:
Awebb wrote:

SDHX card making trouble on Linux? I bet this card worked fine, but not on this particular Linux device. Research the module option "sdhci debug_quirks=".

Well, I tried it on several devices : three computers on Arch, two Windows, and an Android phone (and with several adaptors, just in case). Nothing worked, so I'm pretty sure the problem comes from the card.
When I was using it I always took care to unmount it properly each time, but something must have gone wrong somewhere...

Most likely just hardware failing.  sd-cards have a tendency to die shortly after their warranty runs out.  They're made to be small, but not reliable.  I've gone through more than I can count, expecting my current one in my phone to soon die since it's a few years old and gets used daily.

Offline

#14 2017-03-18 02:45:37

mpan
Member
Registered: 2012-08-01
Posts: 1,188
Website

Re: [Abandoned] Corrupted SD Card

WorMzy:
I was hoping for some sources that actually found that feature. People are analysing the firmware all the time and despite numerous quirks or security vulnerabilities being discovered¹, I’ve never heard of anything like feature that blocks the card in case of an error.

What you have described is nothing unusual and doesn’t require complex explanations like producers putting magic code that will break the card. It’s exactly how it looks when circuits responsible for writing are damaged. The card either detects the failure and reallocates a block (the best cards), reports a write I/O error or can’t detect the failure at all and nothing is ever notified about the condition, but also nothing is ever stored (the cheapest cards). Writing circuits can be damaged pretty easily compared to the ones for reading, because of currents they carry. Also hot-carrier injection in NOR flash wears out transistors pretty fast; and that’s governed by probability, not some counter. It’s not like 10000 write cycles are guaranteed — the failure can occur even after few dozen first writes for small amount of specimens.
____
¹ bunnie+xobs, as presented on 30c3

Last edited by mpan (2017-03-18 02:49:42)


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#15 2017-03-18 08:33:57

Awebb
Member
Registered: 2010-05-06
Posts: 6,275

Re: [Abandoned] Corrupted SD Card

Offline

#16 2017-03-18 10:14:43

pstree
Member
From: Paris, France
Registered: 2013-02-24
Posts: 37

Re: [Abandoned] Corrupted SD Card

Following the advice of mpan, I tried several softs like these, including this one and one made by the manufacturer (SanDisk in this case). None of them succeeded in formatting the card. I guess mpan is right and the writing circuits are fried. The card was approaching 4 years old, and that's pretty old for a microSD I guess.
Well at least the prices dropped. When I bought it a few years ago it was something like 50€, now it's not even half that.


: (){ : |:& };:

Offline

Board footer

Powered by FluxBB