I can't remove the read-only attribute from a Kingston 32 GB Micro SD Card. I want to wipe clean the whole card.

I was given a Raspberry Pi 3 and a 32 GB Micro SD Card and an Echo to play around with. The Micro SD Card was factory fresh when I got it. I downloaded a fresh Ubuntu 16.04 image and formatted the card using Etcher on Windows 10. After I was done, I plugged in everything for the Raspberry to work and noticed that nothing happened. I started to panic a little and thought to myself: "Good job Scrat, you utter moron. Why couldn't you simply wait a little and google a freaking tutorial."

I googled what could possibly have gone wrong and what I should've done, and had to discover that you can't just put any random Ubuntu image on it. It has to be one of the images the creator provides (in my case Ubuntu Mate or Raspbian).

Attempted fixes with Windows

When trying to reformat by right-clicking and reformating via the Windows Explorer, the first thing I encountered that the card was in read-only mode. Trying to access it in the Windows Explorer only showed me the EFI directory, of which I wasn't surprised by.

First thing I found on the internet is about a switch/lock on the card, but my card does not have any lock at all. Neither the card itself, nor the Robson Mini Card Reader I use for reading.

Afterwards I tried to remember how to edit disks.
Mind that I'm still using Windows 10 at that moment, because I would've had to copy my old VM-Ware and system image from my external drive, and I didn't know where that was.

I opened a command line, run diskpart, and list all my disks via

list disk

Which output my 931 GB HDD, my 119 GB SSD (Where Windows is installed on) and the 29 GB Micro SD Card:

Datenträger ###  Status         Größe    Frei     Dyn  GPT  
---------------  -------------  -------  -------  ---  ---   
Datenträger 0    Online          119 GB      0 B        *  
Datenträger 1    Online          931 GB      0 B        *  
Datenträger 2    Online           29 GB    29 GB

Following the information I've got, I knew that Datenträger 2 aka Disk 2 is the card I wanted to edit by doing:

select disk 2

So far so good. Then I wanted to remove the read-only attribute by doing:

attributes disk clear readonly

Which was also successfully executed.

But when I tried to do:


I got a "Hardware Error Message" (In German, thats why I'm not copying it here, but it essentially only said Hardware Error). That error also followed when trying to create primary partition or do other things.

At this point the panic in me started to grow more and more. But I tried to keep calm because I still had a few tricks up my sleeves.

I tried using the programs: EaseUS Partition Master, Etcher (again) and SD Card Formatter which all failed due to the card being protected (read-only, write-protected).

I also tried using the registry edit to change the behaviour of Windows towards storage devices by creating the key (which was not there yet):


and creating a new keyword (DWORD WriteProtect) and setting it to 0, which means no read-only.

Attempted fixes with Linux

That didn't work either and I began losing my nerves with Windows, so I got off my butt and searched for my external drive and installed VM-Ware and ran the Ubuntu 16.04 virtual machine I use for school.

Starting the VM I already noticed that Ubuntu was able to help me way more than Windows (or at least I thought so, because my Linux skills are limited in this aspect). The first thing I see is a linked icon on the Desktop to the card called "Ubuntu 16.04.2 LTS amd64" in it are contained the various stuff Ubuntu needs to work seen in the image here.

But that wouldn't help me. So I went ahead and started a terminal and wrote:


Which confirmed that the card is visible (sdb):

sda      8:0    0   30G  0 disk 
└─sda1   8:1    0   30G  0 part /
sdb      8:16   1 29,2G  1 disk 
├─sdb1   8:17   1  1,5G  1 part /media/pose/Ubuntu 16.04.2 LTS amd64
└─sdb2   8:18   1  2,4M  1 part 
sr0     11:0    1 1024M  0 rom  

But lsblk wasn't very precise so I also used the command we learned in school:

fdisk -l

Which was a bit more precise:

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 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: 0xa14a8cb2

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1        2048 62914559 62912512  30G 83 Linux

Disk /dev/sdb: 29,2 GiB, 31306285056 bytes, 61145088 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: 0x15e2543d

Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1  *        0 3035519 3035520  1,5G  0 Empty
/dev/sdb2       14432   19295    4864  2,4M ef EFI (FAT-12/16/32)

And I was euphoric because I thought I finally cracked the goddamn Davinci code or something, so I ran


Which Immediately opened with an error message:

The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes.

Which I ignored because I thought it was no biggie, but right after ignoring the previous one the next error message popped up:

Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.

So I did what the message told me and rebooted. But that was of no use either, because the same two errors popped up again. I ignored them both this time and the good old trusty gparted window I knew from school opened.

Once I changed to /dev/sdb it became confusing really fast. As you can see here, things are pretty weird, because now sdb is somehow considered my SSD instead of the card, but the image from the card is still mounted. At this point I was too angsty to continue doing anything further in fear of accidentally screwing up my laptop as well.

By the way, I have also tried giving myself permissions to access the disk and try to use the dd command, but with the same error message (Access denied, read-only or something, I'm not exactly sure, but something in this direction).

I have already ordered another 32 GB Micro SD card from Amazon, in case there is no more hope for the old one. But I'm not giving up yet.

(Sorry that some things are in German but I think those things are for the most part self-explanatory.)

  • The disks probably switched order because you rebooted with the SD card connected (next time reboot without it connected). Your second image is mighty interesting... If I understand correctly, that is from within the VM? The VM which has only a 30GiB disk, and the 29.2GiB SD card?
    – Attie
    Jul 22, 2017 at 18:40
  • Yes, from within the VM. I did reboot without it connected, though, so I dunno if that was it. In /dev/sda its the attributed memory space you can give your VM when installing it, which should be the 30GiB. But somehow it got all mixed up with this damn card plugged in.
    – LordScrat
    Jul 22, 2017 at 18:46
  • 4

5 Answers 5


Well, your post was certainly entertaining enough. Thanks for that.

I know it's not the answer you are looking for. But, it does look like the SD card is stuck in read-only mode. You've done everything you can. It really isn't that difficult.

It acts like it would if there was a write-protect switch on the card. It sounds like you confirmed it did not, but maybe just double check, one more time? The thought that came to mind was maybe you are using a mini-SD card in a mini-sd to sd adapter. And maybe you looked on the adapter, but not the mini-sd card itself? I don't know, just throwing that out there. If there is an adapter, maybe the adapter itself went bad? I don't remember if you mentioned if you tried a different card reader. Maybe the reader went bad?

Other than that, it's a pretty common failure for something like this to "fail" in a read-only mode. So, my gut tells me the card went bad.

Looks like you are on the right track, just replacing it. Maybe you can get the bad one replaced under warranty being it is new. Let us know what you figure out.

  • 3
    I think this is a good response, but that it is not really an answer, but is a comment and a hope. :)
    – Xavierjazz
    Jul 22, 2017 at 19:14
  • Yeah I'll tell my boss that the card can't be written anymore and to simply send it back to Amazon (he got it like the thursday before the last one, so I think thats no problem) and get his money back. I'll come up for the debaucle with my own money hence it probably is my fault for installing the wrong Ubuntu on it and maybe soft-locking it. Guess I'll have 16 bucks less to spend haha. Thanks for your comment, though. I appreciate every comment I get.
    – LordScrat
    Jul 22, 2017 at 20:52
  • 2
    Well, that's commendable of you. But, nothing you do with software is going to destroy the hardware. Sometimes things just go bad. Jul 22, 2017 at 22:54

Such read-only issues happen to me all the time when I use iso-images.

What I do to fix such problems:

Note that <yoursdcard> is a device and not a partition, so for example sdc

  1. Boot some kind of linux
  2. Open a terminal
  3. Find out what device your sd card is and verify it by using sudo fdisk /dev/<yoursdcard> -l or to get the device name too you could also use sudo parted /dev/<yoursdcard> -l

WARNING: The following command will destroy all data on /dev/<yoursdcard> so make sure that <yoursdcard> is the right device!!!!

  1. Execute sudo dd if=/dev/zero of=/dev/<yoursdcard> bs=1000000 count=50
  2. Execute sudo fdisk /dev/<yoursdcard>
  3. Now use the command o to create a new MSDOS partition table on your sdcard, then use the n command to add a new partition and use w to write the changes to your sdcard and exit fdisk
  4. Now use sudo mkfs -t <filesystem you want> /dev/<yoursdcard>1 to format your partition
  5. Now your sdcard should work again

If that doesn't work:

  1. Open terminal
  2. Find out what device <yoursdcard> is
  3. Execute sudo su
  4. Execute echo "0" > /sys/block/<yoursdcard>/ro
  • I would love to try that out, but as you can see in my second picture Ubuntu kinda confuses /dev/sdb, which should be my Micro SD, as my SSD (Or the other way around, but its wrong thats what I know), and I really don't wanna delete that by accident, do I.
    – LordScrat
    Jul 22, 2017 at 21:22
  • Of course you don't want, but fdisk is much more reliable than gparted and you would see if it detects your sdcard right or not.(See step 3)
    – testeaxeax
    Jul 22, 2017 at 21:36
  • 1
    You can use de /dev/disk/by-id aliases that are automatically created. They have the manufacturer and connection bus in them so you know for sure what device it is. Jul 23, 2017 at 1:07

Keep in mind the card might simply be broken. They have some flash and a controller on board. If the card thinks it has issues it will go offline completely or go read-only if it has not enough working flash cells to write. Sometimes the controller keeps accounting information for the flash chip, which can get corrupted causing it to start in safe mode and not allow anything. To get past this type of stuff, you need a 'true' SD card reader, not a Mass Storage-only reader. The 'real' SD interfaces have access to the controller and might give you the information you need.


Ah, yes. The Ubuntu image uses some sort of weird format that breaks most formatting utilities. I imagine it's some sort of thing they do so that the images work on DVDs. I know this well (read: I keep needing to make Ubuntu install disks, and I hate formatting them afterward), and it is very annoying.

Use Gparted on Ubuntu (the VM) to delete all partitions on the drive, then add a new FAT32 partition. Note: I am pretty sure that GParted uses the root password, not the normal one you use to log in. If you do not know your root password, it is likely that you have not set it. Run "sudo passwd" to set a root password, and then use that to open GParted. You can also use "sudo gparted".

Or, find and install the free program SDFormatter4 on Windows (Note: Works under WINE in Ubuntu, too) and use it to format the card in overwrite mode. This has a better chance of working, as much as I dislike proprietary software.

Both of these have better luck at formatting the cards than the built-in utilities.

Of course, SD cards and USB drives purposely fail into read-only mode to give you a chance at data recovery. If that card is remotely new, this should not happen, but it is possible. I also suggest Samsung or Sandisk cards, as Kingston cards are often fakes and rapidly fail. I actually had this very problem occur once, and it was actually a card failure. I hope that this is not the case for you.


Hmmm. I should link this post because I kind of began here and somehow ended on another post.

enter link description here

First make sure it is not the card reader!

This issue is caused by a corrupted file system very easily. The problem could be caused by many things. If you format it on Linux without unmounting it or if you repartition it will it is mounted or if the partitions are corrupt this could happen. The best thing to do is use the Linux command fsck /dev/sdb1 or whatever your drive designation is /dev/sdd1. It may see it as /dev/sdb1 if the file system is corrupt on a microSD. This mistake is easy to make because look at this...

root@w3tech-Satellite-C655:/home/w3tech# umount /dev/sdc*
umount: /dev/sdc: not mounted.
umount: /dev/sdc2: not mounted.
root@w3tech-Satellite-C655:/home/w3tech# umount /dev/sdc*
umount: /dev/sdc: not mounted.
umount: /dev/sdc1: not mounted.
umount: /dev/sdc2: not mounted.

I had to unmount the drive twice to unmount both partitions...and yes that is a microSD that should be /dev/sdd, /dev/sde, or after.

Yet, just running fsck might not remove the dirty bit if it thinks it is read-only. Until then the Linux kernel will still use the old partition, which means you get the read-only error because there is no way a user can have permissions granted for an old partition. Sometimes booting the drive will allow the kernel to switch to the new partition, such as if you used a program to create a new partition table.

You must log in to answer this question.

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