3

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.

  • 2
    Have you checked to see if your SD card has a write protect switch on the side? – Cry Havok Jun 22 '14 at 9:17
  • I tried to format it through windows also, there it shows its a read only drive – tabish Jun 22 '14 at 9:19
  • He is asking if there is a small physical button/switch on SD card which forces read-only. – phoops Jun 22 '14 at 9:19
  • no, there is no such thing – tabish Jun 22 '14 at 9:20
  • 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 Jun 22 '14 at 9:23
3

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.

6
  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,FSTYPE,MOUNTPOINT,PARTLABEL,SIZE,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

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.