How to format write protected SD card

  1. I assume you (your unix user) owns the device or at least has sufficient permissions on it (for example if you are root).
  2. If the command lsblk -o NAME,RO shows your device as read only (RO=1), you can try to execute hdparm -r 0 /dev/sdb5. This disables the read only flag in the kernel (according to man hdparm).

Additional info:

These steps helped me with a micro SD card that should not have been read only (micro SD cards have no "lock" switch but my adapter did not have one either and was recognized as locked). I found this solution here.

Wikipedia explaines that the physical lock switch on SD cards can but need not be respected by the software: link to Wikipedia


The card is now useless, hope that you don't have any important data on it. I had the same happen to 3 different cards. I have tried everything I found out there, whether it works on Linux, Mac, or Windows, and nothing works.


Try to use that sd card in a phone if possible and format it. I have run into this issue previously and the phone trick did it. But most probably the card has become useless as this is a very common issue.