I have a 8 GB usb drive. Yesterday suddenly its started mounting read only in Fedora 20. This issue has occurred earlier also but I formatted drive and it worked fine. This time I had important data and wanted to resolve this issue read only usb drive without formatting disk. So I did some research to resolve the issue.
In this post I’ll try to explain – How to make read only usb drive writable without formatting drive and the reason behind of this silly occurrence ?
- The commands/steps written here were tested on Fedora 20. It should work on Fedora (17-20)/Redhat 7/Centos 7. I’ll explain where needed, so that commands work on other distros/versions also.
- Please always take backup of your important data before doing any R&D with your storage devices.
- If you are in hurry and don’t want to read whole post, as you may found it little geeky :p. Click here for a Quick Fix.
1- Open terminal and login with root credentials
2- Run mount command to find out where it is mounted and what are the permissions
3- Run umount command to unmount drive
4- Disconnect the drive from system
5- Run journalctl command to find out exact problem
6- Connect USB drive now and monitor the messages appearing in the terminal
Note – Journalctl is a component of systemd for viewing and managing logs in Fedora. In older Fedora version rsyslogd is used to manage logs.
On older fedora/Redhat versions use tail command instead of journalctl
In logviewer you can find out exactly what is happening. In my case I was getting fat_get_cluster – invalid cluster chain error. To understand error, lets find out some basic information
In FAT (File Allocation Table) file system, partition is logically divided in equal sizes small blocks called clusters. Cluster sizes depends on the size of partition. While saving file in cluster if file size is greater than cluster size it is saved in more than one cluster.
At the time of formatting, a disk map table also known as FAT (File Allocation Table) is created at the known position on the disk. This table (FAT) contains entries of each cluster. Thus number of entries is equal to number of clusters on disk.
Possible values in FAT
|0x0002 – 0xFFEF||Used cluster, value points to next cluster|
|0xFFF0 – 0xFFF6||Reserved Values|
If there is any error in FAT entry, OS may not be able to read data or it may overwrite data.
Therefore while mounting disk, Operating system check consistency of FAT and if it finds any error it mounts drive as read only to save drive from any further damage.
Possible causes of errors
There may be many reasons for the read only usb disk problem. I am listing some of the possible reasons so that you can avoid them in future.
- You disconnected drive while reading/writing data.
- Hard power off of system while reading/writing data.
- Physically damaged drive.
- Virus infected drive.
I hope you got clear idea what is happening to your drive.
Follow the following steps to resolve the issue.
1- Press ctrl+c, to close journalctl command if not closed already.
2- unmount the drive
3- run fsck command to repair the disk
<span style="font-family: Terminal, Monaco;">a = automatically repair the file system</span> <span style="font-family: Terminal, Monaco;">f = salvage unused chains to files</span> <span style="font-family: Terminal, Monaco;">v = verbose mode</span>
4- Disconnect your drive and re-plug your USB. DONE! It is ready.
Do you have something to add in story ? Please share in the comment.