“Read-only File System” Error and Solutions

周六, 05/14/2022 - 03:40

昨天要给我的一些ape music转换格式为flac,但是musicbee告知我文件是写保护的。我是通过windows的samba协议和我的nas链接获取文件的,首先是试了一下在windows explorer里面创建一个文本文件,发现整个mout的网络磁盘都不能写入。这就有点尴尬了。


试着用 chmod 777 -R ./ 来更改权限,但是想不到提示了有一个error,就是 Read-only File System。




然后再执行 chmod 777 -R ./,就顺利通过了。




The “Read-only file system …” is an error that is related to the file system. This error may occur in different situations for different reasons. This error simply expresses that the target file system is mounted as read-only mode and it can not be written or changed.

Read-only File System Error Cases

There may be different “read-only file system” error cases. Generally, they are not directly causing this error. The main reason is the file system is mounted as read-only for different reasons. Below we list some cases of this error.

While trying to restart apache2 web server you may get this error like below.

$ sudo service apache2 start 
[sudo] password for username: 
sudo: unable to open /var/lib/sudo/user: Read-only file system  
* Starting web server apache2                                      

List Mounted File Systems

First, we will list already mounted file systems. The mount command can be used to listed mounted file systems. The output may a bit long but just find the lines related to the root path and home path.


Re-Mount File System

The first step to solving a read-only file system error is remounted file system. Because the file system may be mounted as read-only for different reasons which occur once in a time. So remounting file system will mount it in a normal state. Specified file systems located in the /etc/fstab configuration file can be remounted with the following command. This operation requires root privileges as expected.

sudo mount -o remount /

Reboot System

Another way to solve read-only file system error is rebooting the system. Rebooting the system make a fresh start where prevous error are cleared which may be related libraries, configuration, temporary changes etc.

sudo reboot

Check File System For Errors

Rebooting the system generally checks the file system for errors and if it is errors they are fixed. But in some cases, this may not work. We can explicitly check errors and fix them automatically by using the fsck command.

sudo fsck.ext4 -f /dev/sda2

Re-Mount File System In Read-Write

The file system is configured to be mounted as read-only by default. But these file systems can be also mounted as read and write. The rw option can be used to mount read and write.

sudo mount -oremount,rw /

Most Recent