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
- 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.
- 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.)
I’m also having the same problem. I’m not able to fix read only usb problem despite going through the procedure mentioned above.
Hello Sushil,
The solution works when there are some chances of possibility. If USB is completely malfunctioned on hardware level then it wont work in this way.
Here, in this post logic is to first convert the USB filesystem into vfat. Then run the command dosfsck . Try once again and send the out put of
df -Th
if issue still persist.Regards
Sharad
root@sujit:~# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda7 ext4 68G 3.8G 60G 6% /
none tmpfs 4.0K 0 4.0K 0% /sys/fs/cgroup
udev devtmpfs 1.9G 4.0K 1.9G 1% /dev
tmpfs tmpfs 387M 1.1M 386M 1% /run
none tmpfs 5.0M 0 5.0M 0% /run/lock
none tmpfs 1.9G 80K 1.9G 1% /run/shm
none tmpfs 100M 44K 100M 1% /run/user
/dev/sda3 fuseblk 146G 115G 31G 80% /media/sujit/study
root@sujit:~# umount /media/sujit/study
root@sujit:~# dosfsck -a /dev/sda3
dosfsck 3.0.16, 01 Mar 2013, FAT32, LFN
Currently, only 1 or 2 FATs are supported, not 0.
Filesystem type for USB is showing fuseblk . Change it to
vfat
filesystem and try again.Regards
Sharad
how do we change the filesystem?
For making vfat system , you can use the command
(Recommended reading : http://linux.die.net/man/8/mkfs.vfat)
or
Regards
Sharad
i just run both commands
1.mkfs.vfat /dev/sdc1
mkfs.fat 3.0.26 (2014-03-07)
mkfs.vfat: unable to open /dev/sdc1: Read-only file system
2.mkdosfs -F 32 -I /dev/sdc1
mkfs.fat 3.0.26 (2014-03-07)
mkdosfs: unable to open /dev/sdc1: Read-only file system
Have you any other solution for this ?
Thanks
Sachin SIngh
Hello Sachin,
Thank you for trying the method. If USB drive has hardware issue then there is no command to fix it.
You can try formatting the USB pen drive through GUI. Read our this post if this one work for you. https://sharadchhetri.com/2015/05/11/gui-format-usb-drive-on-ubuntu/
Regards
Sharad
Dear Admin,
Thanks to reply ,
I can access my pendrive can play the videos that present in my pendrive and can open and see the docs. is it possible that after all this there may be any hardware issue bcoz i just try all possible solution in all solution my system is telling same thing that I have only read access. is there any solution to save my disk or its just a toy now?
dosfsck command is not working for me, I got:
dosfsck 3.0.12, 29 Oct 2011, FAT32, LFN
FATs differ but appear to be intact. Using first FAT.
/.Trash-1001/expunged/3019349019/chap 2- preliminary/Lab_works/Jan-03-2012/bram_b/ipcore_dir
Contains a free cluster (1578960). Assuming EOF.
/…/case3.png
File size is 3927 bytes, cluster chain length is 0 bytes.
Truncating file to 0 bytes.
Unable to create unique name
it worked, thanks
Thankyou Kunal,
Glad to know it works for you.
Regards
Sharad
not solved for me either. Fresh format of usb stick under ubuntu 12.04 with gparted. Did all the steps.
root@xxxxxx# umount /media/greyone
root@xxxxxx# dosfsck -a /dev/sdb1
dosfsck 3.0.12, 29 Oct 2011, FAT32, LFN
/dev/sdb1: 1 files, 1/950884 clusters
root@xxxxxx#
plugged back in and same problem.
maybe the problem lies here?
USB-Device is, or become suddenly read only without errors
If you see “Write Protect is off” and no errors in your logfiles, than you should set filesystem type specific mount options (FS_MOUNTOPTIONS) in /etc/usbmount/usbmount.conf. Wrong gid causes mounting read only.
Thank you!
I just get the output
open: Read-only file system
Hello Minu,
Are you still facing the issue ?
Regards
Sharad
Even I’m getting the same proble as Minu.
Same problem…. any solution?
Hi i m tryed it but it still no work 🙁 tryed 3x and nothing if u can help me PM me to mail
” open: Súborový systém dovoľuje len čítanie ” ( Open : File Systems are for READ-ONLY )
Hello Sayky,
Can you try once again and take screenshot of each steps.OR make a video of it. (In rare troubleshooting cases I asked for video)
You can send the file at admin@sharadchhetri.com
Regards
Sharad
Hello Sayky,
Môžete tiež napísať Vašu otázku vo vašom jazyku danej krajiny.
You can also write your question in your country language.
Thanks and Regards
Sharad
yes , thumps up … it’s working
thank u.
Welcome Sam,
Glad to know ,issue is solved by this method
Thank you very much!!!
You are Welcome Paulo