I want to format my SD card using Ubuntu, for this I follow this tutorial

After typing df command , I got list of storage devices.From here I can see my SD card name is /dev/sdb5 so I replace /dev/sdb1 with /dev/sdb5 in all next commands.Now umount command works fine but after this when I type mkdosfs -F 32 -v /dev/sdb5 I am getting these lines:

mkdosfs 3.0.12 (29 Oct 2011)
mkdosfs: unable to open /dev/sdb5: Read-only file system

so, how to fix this.

  • 4
    Have you checked to see if your SD card has a write protect switch on the side?
    – Cry Havok
    Commented Jun 22, 2014 at 9:17
  • 1
    I tried to format it through windows also, there it shows its a read only drive
    – tabish
    Commented Jun 22, 2014 at 9:19
  • 1
    no, there is no such thing
    – tabish
    Commented Jun 22, 2014 at 9:20
  • 1
    Actually I have install Debian in it for beaglebone black and was using it for last 10 days, now I want to put Ubuntu in it, for this when tried to format it , I got this problem, may be something happens because of debian
    – tabish
    Commented Jun 22, 2014 at 9:23
  • 1
    Have you tried to use for example sudo fdisk /dev/sdb and just delete all partitions and recreate them?
    – Alko
    Commented Dec 4, 2014 at 8:30

4 Answers 4

  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.


Yeah I had the same problem and after striving for it for a long time now, I have finally come up with a solution.

There are some SD cards available in the market with microSD input. i.e. micrSD card fits into the SD card.

You can use it disable the lock switch in the SD card and format... works like a charm.

You must log in to answer this question.

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