How to fix read only USB pen drive in Ubuntu

While copying some large file I mistakenly taken out USB pen drive before the copy get completed. Later I again attached the USB pen drive in Ubuntu system but found that the USB pen drive showing read only filesystem message. I was not able to copy, create and delete any file. To solve this issue I followed some steps which I am sharing in this article.

Table of Contents

Method Of Fixing Read Only USB Pen Drive In Ubuntu

In this section, we will follow the steps to fix the read only USB Pen Drive.

Disclaimer

  1. Some of you might be carrying the important data in USB / Pen Drive. In this method, we will format the USB drive. So due to this , the data will be erased and non recoverable.
  2. This solution works most of the time but in case there is Hardware issue in your USB/Pen drive then this solution won’t work. You should buy new USB/ Pen drive instead.

Find Out The Mounted Path Of USB Pen Drive

Step 1: Attach USB pen drive in system’s USB port. Automatically the Ubuntu will mount the USB pen drive and show icon on Desktop or Menu bar.

Open the terminal and become super user by running below given command

sudo su -

Step 2: First we have to find out in which directory the USB pen drive has been automatically mounted.For this run the df -Th command.
In given below output you can see,in my system the USB pen drive is mounted in /media/linux/C38C-099C ,partition is /dev/sdd1 and filesystem is vfat.

Note: When you run df -Th command in your system,the USB pen drive may mount in different directory and the partition might also be different.Hence the output value which you will get, use the same values in further steps.

root@tuxworld:~# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda5      ext4       28G   25G  1.3G  96% /
udev           devtmpfs  2.0G  4.0K  2.0G   1% /dev
tmpfs          tmpfs     796M  1.1M  795M   1% /run
none           tmpfs     5.0M  8.0K  5.0M   1% /run/lock
none           tmpfs     2.0G  528K  2.0G   1% /run/shm
none           tmpfs     100M  104K  100M   1% /run/user
cgroup         tmpfs     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda7      ext4      9.2G  8.2G  539M  94% /partition7
/dev/sda8      ext3       46G   38G  6.2G  86% /partition8
/dev/sda9      ext3       74G   67G  3.1G  96% /partition9
/dev/sda21     ext4       14G  4.9G  8.3G  37% /partition10
/dev/sdd1      vfat       15G   12G  3.6G  77% /media/linux/C38C-099C 

Unmount USB Pen Drive

Step 2: Now unmount the directory in which the USB pen drive is automatically mounted . (As you can see mounted directory path in above ‘Step 1’)

Note: Replace the/media/linux/C38C-099C with the mounted USB pen drive directory path which is showing output in your system after running df -Th command.

umount /media/linux/C38C-099C

Check And Repair

Step 3: As we know the USB pen drive got /dev/sdd1 partition
and filesystem is vfat(see in Step 1). Now we will run dosfsck command to check and repair the filesystem

Note: The dosfsck command check and repair MS-DOS filesystems.Because the filesystem of USB pen drive is vfat hence we are using this command

dosfsck -a /dev/sdd1

Re-Attach USB Pen Drive

Step 4: After the dosfsck command get completed.Remove the USB pen drive from system and then re-attach back to system.Now your USB pen drive should working and it should not have read only filesystem.

Note** After mounting the USB pen drive you may see a new file with extension .REC which was created because of dosfsck command.

Reboot The System

Step 5 Reboot the system after completing all the steps. (This step we have added after receiving lots of suggestion in comments section from our readers around the world. Thank you for providing feedback and sure it will help many people.)

207 thoughts on “How to fix read only USB pen drive in Ubuntu”

  1. Thank you for this article. I was able to save my files. It’s important to substitute your personal files instead of using the authors. For example, my USB pen drive was mounted in “/media/user/08E7-563B,” the partition was “/dev/sdb1” and the filesystem was “vfat.”

    The commands I had to use were:
    sudo su –
    df -Th
    umount /media/user/08E7-563B
    dosfsck -a /dev/sdb1

    Then all I had to was wait for it to finish, unplug my USB drive when it was done, and plug it back in. Works perfectly now, and it even has the file that failed to copy over and locked my drive up. This couldn’t have been more simple.

    Reply
  2. I have a 32G USB memory stick with a FAT32 file system that mounts read only
    blkid is /dev/sdc1: UUID=”551C-2AA9″ TYPE=”vfat” PARTUUID=”2b71fb4e-01

    It mounts on /run/media/saejin/551C-2AA9
    I tried installing it in a windows machine and ejecting it. It did not fix the problem.

    # umount /dev/sdc1
    #mkdosfs -F 32 -I /dev/sdc1
    mkfs.fat 3.0.27 (2014-11-12)
    mkdosfs: unable to open /dev/sdc1: Read-only file system

    # umount /dev/sdc1
    #dosfsck -a /dev/sdc1
    mkfs.fat 3.0.27 (2014-11-12)
    open Read-only file system

    Reply
  3. It worked… ubuntu 12.04 and the filesystem is vfat. dosfsck found the problematic file.
    Thank you Sharad for your help!

    Reply
  4. I don’t this it’s working for me 🙁
    root@abhi-dell:~# umount “/media/abhijith/NEW VOLUME”
    root@abhi-dell:~# dosfsck -a /dev/sdb1
    fsck.fat 3.0.26 (2014-03-07)
    open: Read-only file system
    root@abhi-dell:~#

    Reply
  5. After running “umount /media/ubuntu/Ubuntu 14.10 amd64”
    I got this output:
    umount: /media/ubuntu/Ubuntu: mountpoint not found
    umount: 14.10: mountpoint not found
    umount: amd64: mountpoint not found

    What this means and what should I do to rectify?

    Thank you!

    Reply
    • Hello Friend,

      df -h command will help to find mounted partition on system .
      Just run the command and check if /media/ubuntu/Ubuntu 14.10 amd64 is mounted.

      The message itself shows /media/ubuntu/Ubuntu 14.10 amd64 is not mounted on system.

      Regards
      Sharad

      Reply
      • Same output came on “mounted on”
        root@Heaven:~# df -Th
        Filesystem Type Size Used Avail Use% Mounted on
        /dev/sda6 ext4 221G 51G 159G 25% /
        none tmpfs 4.0K 0 4.0K 0% /sys/fs/cgroup
        udev devtmpfs 1.9G 4.0K 1.9G 1% /dev
        tmpfs tmpfs 385M 1.2M 384M 1% /run
        none tmpfs 5.0M 4.0K 5.0M 1% /run/lock
        none tmpfs 1.9G 160K 1.9G 1% /run/shm
        none tmpfs 100M 64K 100M 1% /run/user
        /dev/sdb1 vfat 7.5G 638M 6.9G 9% /media/ubuntu/Ubuntu 14.10 amd64
        root@Heaven:~# df -h
        Filesystem Size Used Avail Use% Mounted on
        /dev/sda6 221G 51G 159G 25% /
        none 4.0K 0 4.0K 0% /sys/fs/cgroup
        udev 1.9G 4.0K 1.9G 1% /dev
        tmpfs 385M 1.3M 384M 1% /run
        none 5.0M 4.0K 5.0M 1% /run/lock
        none 1.9G 160K 1.9G 1% /run/shm
        none 100M 64K 100M 1% /run/user
        /dev/sdb1 7.5G 638M 6.9G 9% /media/ubuntu/Ubuntu 14.10 amd64
        What shall I do?

        Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.