3

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

/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. enter image description here

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. diskpart output is translated from Russian, so it might not read well.

> diskpart
> select disk 1
> clean
diskpart encoundered an error: input-output error on the device

> convert mbr
This drive can't be converted. Ones that can't be converted are CD and DVD disks.

2 Answers 2

2

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/detail/a_id/1102/~/memory-card-is-write-protected-or-locked

1

Well, @Yaroslav solved the problem on his own by following instructions in this link, I am just making it more clear.

Problem : Cannot format MicroSD. File system is read-only

While this problem may arise due to any number of issues that can include :

  • Physical write Protection
  • File Permission Issue
  • Corrupted partitions
  • Unable to mount partition
  • Anything else

Root Cause : Physical Write Protection

It means that your SD Card Reader has some kind of lock, using which you can switch the read-only mode. Below Image shows the usual position of locks in devices, although It may vary.

Lock Position in SD Card Readers

Attribution : WikiMedia Commons

Solution

Since, It's a hardware thing, so no software or command (correct me, If I'm wrong) is going to help you much. What you can do is :

  • Unlock the memory card by Toggling the switch

    Just Make sure that the lock switch is in Unlocked position that is Up

  • Get a new Card Reader

    If the lock switch is loose and moves easily, then it is likely the switch is sliding to the locked position as the card is placed in your host device. In that case the card will need to be replaced.

Feel free to add-in more details.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .