File System comprises the collections of files and directories. It occupies the physical space on the hard disk and stores the information in the files/directories. While handling the file system, one of the most common errors, “Linux read-only file system” is displayed in the system, which occurs when the file system does not have write permissions.
This post will address the reasons and the solutions to the above-stated error in Linux.
- Reason: File System Does Not Have the Write Permission
- Solution 1: Re-Mount the FileSystem
- Solution 2: Repair the File System Using GUI
Reason: File System Does Not Have the Write Permission
To secure the data in Linux, the file system goes to read-only protection. In such a case, when trying to start any service, you might get the error “Linux read-only file system”.
Solution: Re-Mount the FileSystem
To fix the issue, you must re-mount the file system to get permission. It enables users to start or modify the services after getting permission. To re-mount the filesystem, we determine which directory or file system is making issues. For this, we will execute the “fdisk” command with the “l” option to list out file systems:
$ sudo fdisk -l
Now, if we want to fix the file of “/dev/sda2”, execute the fsck command with the f option as below:
$ sudo fsck -f /dev/sda2
Remount the FileSystem
To remount the filesystem, users can utilize the “mount” command with the “o” option to with the “remount” to get the write-read (rw) permission. Specify the device name (“/dev/sda2”) and the mount point, i.e., “/boot/efi”.
$ sudo mount -o remount,rw /dev/sda2 /boot/efi
After execution of the above command, restart the Linux machine:
The disk has been repaired successfully, and the error of the read-only will be resolved.
Solution 2: Repair the File System Using GUI
Another method to resolve this error is opening the application of the “Disks”:
Select the Disk from the list which you want to display:
Then click on the “Gear” icon and then click on the “Repair Filesystem”:
The specified File System will be repaired, and the error will be resolved.
To fix the “Linux read only file system” error, repair the filesystem by using the “sudo fsck -f [filesystem path]” or “Disk” application via GUI. This article has explained all possible solutions to tackle the error mentioned above in Linux.