52

I have a MicroSD card reader in my notebook. When I insert a MicroSD memory card into it, I can't write any data on it - it's read-only. The same thing happens when I try to do it under root. And I can't change the permission policy for it. This problem happens for all microSD cards (I've tested 2 cards). I've encountered it on Ubuntu 12.04 LTS, now I'm on Ubuntu 12.10, the problem is still on it's place. When I try to insert such a "read-only" card in my mobile phone, everything's OK and I can write data on it. So, can anybody tell me, how can I write a data onto the card?

UPD: here's fdisk -l output:

Disk /dev/sdc1: 2013 MB, 2013135360 bytes
62 heads, 62 sectors/track, 1022 cylinders, total 3931905 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
Disk identifier: 0x00000000

 Device Boot      Start         End      Blocks   Id  System

The file system of the card is msdos. As to me it's weird.

UPD2: I've found a small "lock" switch on my card adapter, and it turns out, that when I insert it in my notebook, it switches on. Perhaps, I have to find some glue or something to get that switch stuck...

UPD3: There was no glue near me, so I've decided to buy another card-reader.

4
  • 1
    the problem might be the filesystem (it might be formatted to a filesystem which linux does not have write support), could you paste us the output of "sudo fdisk -l" on a pastebin (paste.ubuntu.com) and give us the link?
    – Sam
    Nov 7, 2012 at 0:43
  • @Sam fdisk -l should be small enough to post inline with code formatting. Just paste it, select it in the post editor, and press Ctrl+K.
    – nanofarad
    Nov 7, 2012 at 0:55
  • @ObsessiveSSo, nice, goot to know, i'm just starting here at ask ubuntu. thanks!
    – Sam
    Nov 7, 2012 at 1:10
  • Buy yourself a usb card-reader or a microsd USB adapter (it pretty cheap, like 50cents). Some sd card manufacturers offer such adapters for free.
    – ipse lute
    Jun 9, 2016 at 13:10

13 Answers 13

41

Two possibilities, first is that being a hardware thing, as micro SDHC have a little notch you can easily notice which matches another notch in the reader and that basically just enables it in read-only mode. That you can't change, just try to use another reader or you could put a piece of silicon or tape on notch, easiest thing is to use another reader.

Second possibility is that being a file permission issue, in which case you can do the following : In terminal, use these commands:

gksudo nautilus

This will launch nautilus in root shell and bypass all permissions. OR:

sudo fdisk -l

This will give you a list of the drives on your system, figure out which drive it is in the list, easiest way is to look for the blocks as this is the space. It will probably be /dev/sdb or /dev/sdc, then

sudo chown -hR <your username> <the SDHC drive, /dev/sdb for example>

this will change ownership of the drive to you. OR:

sudo chmod -R 777 <the SDHC drive, /dev/sdb for example>

Though if you just execute the first command sudo nautilus it will save you all this trouble, but you'll have to do it every time you use the SDHC.

If all of this doesn't work, use this command :

sudo mount --options remount,rw <the SDHC drive, /dev/sdb for example, find it using fdisk -l>

If there's anything you don't understand just comment.

15
  • 9
    Micro SDHC shouldn't have a read-only notch IIRC.
    – nanofarad
    Nov 7, 2012 at 1:13
  • 2
    Really? Micro? Or am I confisunig it with Mini/fullsize?
    – nanofarad
    Nov 7, 2012 at 13:24
  • 1
    Hmm. I know normal SD has one, and looking at images it's the adapter that has the notch. Not Mini or Micro SD.
    – nanofarad
    Nov 7, 2012 at 13:28
  • 2
    Well, my class 10 Transcend 32GB Micro SDHC indeed has one, that's all I know. Nov 7, 2012 at 13:30
  • 10
    @JackMayerz I have tried all commands you mentioned above but none of them worked for unfortunately. the last command results says mount: cannot remount block device /dev/sdb1 read-write, is write-protected so what do you suggest for me !
    – Waqas
    Nov 8, 2013 at 17:43
21

Physical write protection

For those who never used SD cards before (there's a first time for everything, mine was in my late 20's!), you have to move the LOCK switch to the unlocked position:

Image attribution.

It is analogous for a micro SD adapter with a MicroSD inside: the dongle is on the adapter:

Related: https://raspberrypi.stackexchange.com/questions/8225/trying-to-image-sd-card-not-working-read-only-file-system

5
  • 2
    I downvoted because you simply copied this answer here, bumping an old question in the process. This is not OK. I didn't downvote you on RPi.SE because you seem to work on your rep there. Sep 29, 2016 at 14:05
  • 2
    @DmitryGrigoryev thanks for feedback. Stack exchange separation into multiple websites is flawed as it creates duplicates like this, and there are not cross site duplicates. Images are the best answer possible to this question. Would you feel differently if someone else added two different analogous images there? :-) Sep 29, 2016 at 14:09
  • That question on RPi.SE was answered in 2013, and nobody seemed to have problems finding the lock. I don't believe having those pictures which take a whole screen to scroll were necessary. Besides, you have already provided a link to this answer over there, wasn't that enough? Sep 29, 2016 at 14:25
  • 1
    @DmitryGrigoryev the same applies to all answers on cross site duplicates :-) Sep 29, 2016 at 14:44
  • 1
    The BEST ANSWER!!!!!! Holy CRAP!!!!! I cant believe this fixed my problem! Oct 29, 2023 at 17:39
21

This command from the console might remove write protection:

sudo hdparm -R0 /dev/sdc

If it works, now you type

mount /media/ur_pen_drive_name(like mine is HSR)/ -o remount,rw

NOTE: sometimes a microsd card may be set to READONLY state because it has detected that the media is no longer reliable (this can happen after too many writes). It is meant to allow the user to get any data off before it becomes totally unusable. If you find that your microsd card enters this state by no action of your own, consider that it may make sense to recover any data and trash the microsd card anyway.*

And that's it.... remember windows can't do this because there is a virus in your pen drive ok... now it doesn't any permission to be changed so if you find any .exe file not getting deleted from your pd just do the above two step and than you'll be able to delete it...

8

While in the command window, you could see if the system objects to making the disk read-write. Suppose for example it is mounted as /dev/sdb1. Become root or use sudo:

mount -orw,remount /dev/sdb1 

will either make the disk writable or give you an error message indicating why it can't.

1
  • 1
    $ sudo mount -orw,remount /dev/sdf1 gave me no error message and I still can't write to it. Sep 13, 2018 at 20:47
4

I was just having the same problem and read in another post that Ubuntu somehow locks the SD once it's been improperly removed. Anyone who gets the "Destination is read-only" message check that the locking switch in the SD to MicroSD adapter is not in Lock mode, and if that's true, try again after logging out of Ubuntu and logging back in.

Worked for me in Ubuntu 16.04.

1
  • That is the same what Angstrem said in his second update UPD2: I've found a small "lock" switch on my card adapter, ... Jun 9, 2016 at 13:17
3

Tried everything above. Still read-only. Asked Samsung and found someone who actually knows something about microSD cards. Was told that when the card fails (not the reader) it sometimes goes into read-only mode. Try replacing the card. Samsung will replace cards more than 30 days old.

1
  • some failure cases can be from normal wear and tear (say the media is known to crap out after a certain number of writes/reads)
    – Marc
    Mar 13 at 19:03
2

I too had this problem. I first noticed it when it wouldn't let me empty the bin. I searched on here for a solution and nothing I tried worked. Then, I noticed on the SD Adapter a little sliding tab which 'locks' the card. Slide that so that it isn't locked. Simple. Never noticed it. After hours of beating my head against a wall, it was a simple mecahnical solution.

2
  • Actually this was exactly the cause of my problems. I had to move the glider on SD adapter properly, my first try did not succeed. May 27, 2015 at 7:39
  • The read-only glider on my SD adaptor is too easy to move, so when I insert the adaptor into slot, the glider moves and changes read-only status. I had to insert it very carefully and try it few times to succeed. Sometime the software problems are simply caused by poor hardware design or manufacturing. May 27, 2015 at 8:38
2

I had the same issue. Try to reboot system with SD card inserted. After reboot my SD card surprisingly became writable.

2
  • I stared at this answer for a while thinking "nah, that cant be it", but then it solved the problem. If you have been through this page looking for answers, no reason not to try this one.
    – Humdinger
    Apr 4, 2019 at 4:43
  • while true @Humdinger , it may also be indicative of a microsd that is coming to the end of life.
    – Marc
    Mar 13 at 19:04
1

FYI, I had a microSD card that failed (read-only) with its original Samsung SD adapter with the OPs symptoms. A final throw of the dice, putting it in a different SD adapter, this time from SanDisk made it operational again.

0

Ran into same issue. used 2 cards, 2 adapters and system build in card reader.

Could using some ways mentioned in this forum write data to the card as root but got 'read-only' error in Nautilis.

Then formatted the cards using windows 8 (dual boot, same system) as FAT 32, now everything works fine.

fdisk output:

ubx@UB1-001:~$ fdisk -l /dev/sdd

Disk /dev/sdd: 1977 MB, 1977614336 bytes
64 heads, 63 sectors/track, 957 cylinders, total 3862528 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1             135     3858623     1929244+   b  W95 FAT32

ubx@UB1-001:~$ fdisk -l /dev/sdd

Disk /dev/sdd: 32.9 GB, 32883343360 bytes
64 heads, 32 sectors/track, 31360 cylinders, total 64225280 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
Disk identifier: 0x000a65fd

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1              32    64225279    32112624    c  W95 FAT32 (LBA)

Removed partition, and created new one with FAT using disk utility tool. Writing goes fine.

Reformatted using disk utility as master boot record (as done earlier) and recreated partition (FAT, as done earlier). Now it also works...

Strange... had the same issue with another card few months ago, did the same procedure and it also works.

Can't explain.. but thing that worked for me:

  • Format card in windows
0

You have to use the Gnome Disk Utility and reformat ALL data, taking them to zeros. It will work perfectly after that. There is some proprietary junk in there that will get in the way, straight out of the package.

0

I had this issue, and somehow my Dell laptop BIOS had writing to SD cards disable. Here's the checkbox that must be unchecked in order to write to SD cards via the laptop's built-in microSD card reader Dell BIOS SD card read-only checkbox

0

I had this problem. I used the Repair Filesystem option in Gnome Disks. It worked!

However the operation did reorg and rename some files.

You must log in to answer this question.

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