You are not logged in.

#1 2013-10-09 07:35:26

Doctor Drive
Member
From: Poland
Registered: 2010-08-11
Posts: 167

[Solved] Canot format MicroSD. File system is read-only

I formatted it for my special needs some time ago using fdisk.
Don't remember the partition table, but there was 1 fat32 and 1 ext4 partition.
Now I want to format it fat32 clean, but I get the errors.

When I open GParted, it says

GParted wrote:

/dev/sdb contains GPT signatures, indicating that it has a GPT table.  However, it does not have a valid fake msdos partition table, as it should.  Perhaps it was corrupted -- possibly by a program that doesn't understand GPT partition tables.  Or perhaps you deleted the GPT table, and are now using an msdos partition table.  Is this a GPT partition table?

If I click yes - it shows partitions, but creating new partition table fails, as it is read-only.
If I click no - it does not show up in the device list.

Here's a picture of the structure of the device.
15r04qp.png

What also strange, I remember making 1 GiB ext4, and rest fat32. But it shows the opposite.

So I tried formatting it with fdisk

$ fdisk /dev/sdb
o
n
w
fdisk: cannot write disk label: Bad file descriptor

I made sure they are unmounted

umount: /dev/sdb1: not mounted
umount: /dev/sdb2: not mounted

Then I checked the filesystems. The second one appears to be read-only

# fsck /dev/sdb1
fsck from util-linux 2.23.2
fsck.fat 3.0.22 (2013-07-19)
/dev/sdb1: 18 files, 96978/698280 clusters
# fsck /dev/sdb2
fsck from util-linux 2.23.2
e2fsck 1.42.8 (20-Jun-2013)
fsck.ext4: Read-only file system while trying to open /dev/sdb2
Disk write-protected; use the -n option to do a read-only
check of the device.
# fsck -n /dev/sdb2
fsck from util-linux 2.23.2
e2fsck 1.42.8 (20-Jun-2013)
/dev/sdb2: clean, 860/65664 files, 56633/262144 blocks

Tried the zero trick, but failed as well.

# dd if=/dev/zero of=/dev/sdb
dd: failed to open ‘/dev/sdb’: Read-only file system
# dd if=/dev/zero of=/dev/sdb2
dd: failed to open ‘/dev/sdb2’: Read-only file system

Tried to disable the write-protection

# hdparm -r0 /dev/sdb

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

After that, fdisk still fails to format.

In Windows 8, it mounts only the fat32 part.
diskpart can't erase partition table as well.

Last edited by Doctor Drive (2013-10-09 08:28:13)

Offline

#2 2013-10-09 08:28:02

Doctor Drive
Member
From: Poland
Registered: 2010-08-11
Posts: 167

Re: [Solved] Canot format MicroSD. File system is read-only

Finally I found the solution

MicroSD adapter has a "lock" feature.
When I inserted the adapter, the lock always triggered to locked state.
So I fixed it in unlocked state using the ducktape.

http://kb.sandisk.com/app/answers/detai … -or-locked

Offline

Board footer

Powered by FluxBB