How to Fix Read Only 'MSDOS' SD Card?

6,007

This may work -- I recently helped my neighbor with a similar problem. Although this could be a software issue, it may indeed be a hardware solution that solves your problem. Look for a switch on the actual card and set it to the off/unlocked position, then reinsert it and you should be able to write to it as it will no longer be write protected (locked). Regardless of brand, look at this example which clearly explains what I just briefly summarized: memory-card-is-write-protected

Share:
6,007

Related videos on Youtube

Chev_603
Author by

Chev_603

I am a programmer, system administrator, and computer enthusiast. I switched from Windows to Linux seven years ago, and have primarily ran Ubuntu on my desktop systems, and Debian on my servers. I joined this community for support, and because helping others brings me great satisfaction. I very much respect the open source community, and consider Ask Ubuntu one of the more respectful, generous, friendly, and informative tech communities on the net. In addition, I am a big advocate of and supporter of internet freedoms. I am dedicated to helping people reclaim their privacy, secure their computer systems and networks, and keep the internet open, with equal access and data traffic priority for all.

Updated on September 18, 2022

Comments

  • Chev_603
    Chev_603 over 1 year

    I know that there are a few threads around trying to answer this question, but none of the answers are working for me, so here we go. I have an 8 gig microSD card that was being used as memory for my old android phone. The card was formatted using ClockWorkMod Recovery.

    While that phone was still working, I could write to the card by plugging the phone into my computer via USB. But I accidentally deleted the entire operating system off of that phone, and now I am trying to fix it. I don't want to accidentally ruin another microsd card, so I need to gain write access to this one.

    When I insert the microsd into my computer, I cannot write to it. It says that I am not the owner, even if I am running as root. The card has 3 partitions:

    Device     Boot    Start      End Sectors   Size Id Type
    /dev/sdb1              1  7023437 7023437   3.4G  c W95 FAT32 (LBA)
    /dev/sdb2        7023438 15023437 8000000   3.8G 83 Linux
    /dev/sdb3       15023438 15523839  500402 244.3M 82 Linux swap / Solaris
    

    I tried running fsck, as suggested in another thread:

    root@dronebox:/dev# fsck -v /dev/sdb1
    fsck from util-linux 2.25.1
    fsck.fat 3.0.26 (2014-03-07)
    fsck.fat 3.0.26 (2014-03-07)
    Checking we can access the last sector of the filesystem
    Boot sector contents:
    System ID "mkdosfs"
    Media byte 0xf8 (hard disk)
    512 bytes per logical sector
    4096 bytes per cluster
    32 reserved sectors
    First FAT starts at byte 16384 (sector 32)
    2 FATs, 32 bit entries
    3506176 bytes per FAT (= 6848 sectors)
    Root directory start at cluster 2 (arbitrary size)
    Data area starts at byte 7028736 (sector 13728)
    876213 data clusters (3588968448 bytes)
    16 sectors/track, 4 heads
    0 hidden sectors
    7023437 sectors total
    Checking for unused clusters.
    Checking free cluster summary.
    
    root@dronebox:/dev# fsck -v /dev/sdb2
    fsck from util-linux 2.25.1
    e2fsck 1.42.10 (18-May-2014)
    fsck.ext4: Read-only file system while trying to open /dev/sdb2
    Disk write-protected; use the -n option to do a read-only
    
    root@dronebox:/dev# fsck -v -n /dev/sdb2
    fsck from util-linux 2.25.1
    e2fsck 1.42.10 (18-May-2014)
    /dev/sdb2: clean, 11/250480 files, 33337/1000000 blocks
    
    root@dronebox:/dev# fsck -v -n /dev/sdb3
    fsck from util-linux 2.25.1
    

    In a different thread, it was suggested that I should add myself to group "disk", because the permissions are set as:

    brw-rw---- 1 root disk 8, 16 Mar 22 16:31 sdb
    brw-rw---- 1 root disk 8, 17 Mar 22 16:31 sdb1
    brw-rw---- 1 root disk 8, 18 Mar 22 16:31 sdb2
    brw-rw---- 1 root disk 8, 19 Mar 22 16:31 sdb3
    

    I tried that, it didn't work either. I am also not familiar with the 'b' flag above. In another thread, someone suggested using a Windows machine to fix it, but I don't have one around, and I already tried doing that through a VM and it did not work correctly. Common sense tells me that because the phone was able to write to the sdcard, it is not damaged, but rather configured in an irritating way.

    So, any advice? This is driving me insane. I've tried all of the usual stuff, like gparted, remounting as read-write, the Ubuntu disc utility, editing mount options... etc. Does anyone know how to fix this?

    • mikewhatever
      mikewhatever about 9 years
      "Disk write-protected" usually means you need to flip a write protection switch on the card itself.
    • Chev_603
      Chev_603 about 9 years
      Yes, I just noticed that, on the adapter (for microsd > sd) and I flipped it, but I still cannot write to it!
    • Chev_603
      Chev_603 about 9 years
      Actually, you are correct! It turns out my adapter was broken. I inserted it into another adapter, and now I am able to format it! ... but I still can't write to it...?
    • Chev_603
      Chev_603 about 9 years
      After I realized there was that switch, I was able to gain write access on the swap partition after formatting it. Than I managed to delete all of the partitions and format the drive to one ext4 partition, and now I cannot write to it at all.
    • mikewhatever
      mikewhatever about 9 years
      So, do you still get the same "Disk write-protected" error? Does the ext4 partition mount? What are the outputs of mount and dmesg | tail?
    • Chev_603
      Chev_603 about 9 years
      $ mount : /dev/sdb1 on /media/anon/SD8G type ext2 (rw,nodev,nosuid,uhelper=udisks2) There is no entry of the card in the output of dmesg | tail . However, I am still waiting for nautilus to finish 'wiping availbe disc space'. Nautilus does say "some contents unreadable" though.
  • Chev_603
    Chev_603 about 9 years
    You are correct, that was one of the problems. Now when I mount the sd card, it no longer shows up 'read only' in the disc utility. However, when I try to write to it from nautilus, I get an error 'Cannot create folder, disc is read-only'. I changed the permissions, reformatted it a couple times, and now I am attempting to fix it by using the 'wipe available disc space'/secure delete option from nautilus. I figure there must be some corrupt sectors somewhere, hopefully this will fix them. I will report back once it's done.
  • Chev_603
    Chev_603 about 9 years
    Yes, I have access to a mac. I will try this if secure-delete does not fix the issue, I am still waiting for it to finish wiping the sd card. Thank you.
  • Chev_603
    Chev_603 about 9 years
    The answer turned out to a combination of that switch, and some other corruption issues. After shredding all available disc space, I can now write to my sd card again. Solved.