You are not logged in.

#1 2017-05-29 21:25:53

nbd
Member
Registered: 2014-08-04
Posts: 389

Cannot format microSD card

Hello,

I'm trying to repartition a 16 GB microSD card, which currently contains 2 partitions (DOS - 50 MB and Ext4 - 5 GB), but cannot do this since the card behaves as it's wtite-protected. I have read several similar questions on the net, but no one provided a working solution.

There were recommendations to use USB adapter instead of SD adapter, for inserting the card into computer. So, I insert the card via USB adapter, then run hdparm to remove the readonly flag:

[root@kw ~]# hdparm -r0 /dev/sdh

/dev/sdh:
 setting readonly to 0 (off)
 readonly      =  0 (off)

After that I run fdisk, delete both partitions and get an "Input/output error" on writing changes:

[root@kw ~]# fdisk /dev/sdh

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdh: 14.9 GiB, 16005464064 bytes, 31260672 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
Disklabel type: dos
Disk identifier: 0xe923a87e

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sdh1         2048   104447   102400   50M  c W95 FAT32 (LBA)
/dev/sdh2       104448 10344447 10240000  4.9G 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 

Partition 2 has been deleted.

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Input/output error

Inserting the card with an SD-adapter, not using hdparm, using GParted for deleting partitions - nothing changes the result: no changes are done to the card.

Can someone advise how to solve this problem and perform a new formatting of the card?

<< nbd


bing different

Offline

#2 2017-05-30 05:12:25

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Cannot format microSD card

Try formatting it from a phone.

Offline

#3 2017-05-30 06:37:07

Jristz
Member
From: America/Santiago
Registered: 2011-06-11
Posts: 1,022

Re: Cannot format microSD card

Maybe is write protected from the adaptator.
http://pad3.whstatic.com/images/thumb/8 … sion-3.jpg

modedit: replaced large image with link, please read our forum policy /Xyne

Last edited by Xyne (2017-05-30 12:58:25)


Well, I suppose that this is somekind of signature, no?

Offline

#4 2017-05-30 16:23:30

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: Cannot format microSD card

x33a,

in Android after selecting 'erase' for this card, no errors was reported, but it's content remained unmodified.

Jristz,

SD-adapter is not write-locked and USB adapter doesn't have write-protection.

I tried to write with all zeroes the whole card:

[root@kw ~]# dd if=/dev/zero of=/dev/sdb bs=16384 status=progress
15999303680 bytes (16 GB, 15 GiB) copied, 1368 s, 11.7 MB/s     
dd: error writing '/dev/sdb': No space left on device

This didn't cause any change to the card. It looks like all operations are written to cache, which is not synced to the card in the end.


bing different

Offline

#5 2017-05-30 17:48:17

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

Re: Cannot format microSD card

The card is probably broken, time to get a new one or get that one replaced if it is under warranty.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#6 2017-05-30 20:58:13

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: Cannot format microSD card

R00KIE wrote:

The card is probably broken, time to get a new one or get that one replaced if it is under warranty.

If those simptoms are not well known signs of some well known type of breakage of microSD cards, then this breakage seems strange to me. The partitions mount OK, the data on them doesn't have signs of corruption, files on those partitions can be opened,  edited and even saved. The new file versions are not last after card unmounting, though.

If someone who has happened to have a similar issue with microSD card and managed to correct it, hope s/he will share her receipt.


bing different

Offline

#7 2017-05-30 21:24:30

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

Re: Cannot format microSD card

If memory serves me right I've seen similar problems here on the forum and the usual conclusion is broken card, it probably failed read only so that's not all bad.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#8 2017-05-31 04:08:34

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: Cannot format microSD card

After some search, I downloaded an 'official' SD formatter program for that card (for Windows), and on an attempt to format the card this program shows the message that the card is write-protected, even with USB-adapter which doesn't even has a write-lock switch.

This card has been working in Raspberry Pi and maybe some unusual condition caused some card's internal flag to be set, thus making the card marked as read only. So, will search for receipt how to turn off programmable write-protection.


bing different

Offline

#9 2017-05-31 07:17:38

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: Cannot format microSD card

nbd wrote:

If those simptoms are not well known signs of some well known type of breakage of microSD cards

Yes, are.

1st off: You tried various adapters and readers, so this can be ruled out as a cause.

SD cards do not posses a HW write-lock. The fancy switch is an indicator that the reader may (or not) respect.
There's no way to "programmable" turn of such non-existing lock.
If you're lucky, it's just one of the external lines (the metal bars, can temporarily be fixed with some graphite, ie. a weak pencil) - otherwise either an internal fuse or the MLCs are dead.

SD breakage usually happens in the electronics (the card is typically dead, but random things can happen) and at some point (but inevitably) in the memory itself. In that case, NAND simply looses the ability to write new data, the present data is usually "safe" (ie. it takes quite some time for degeneration)
For good MLCs you need millions of write cycles to reach this point, but a defective product can get you there arbitrarily fast.

This card has been working in Raspberry Pi

$60.000 question: why is it no longer? Have you tried to write it in ther raspi?

Offline

#10 2017-05-31 10:42:38

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

Re: Cannot format microSD card

nbd wrote:

This card has been working in Raspberry Pi

One more reason why it's probably broken and failed read only. Depending on the filesystem and usage patterns if the same sectors keep getting written to, the flash cells where those sectors are stored will wear out quickly as SD cards do not have, as far as I know, advanced wear leveling as SSDs have.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB