Baidu Cloud Compute Delete or Modify File Prompting File System Read-Only
Problem description
When trying to delete or modify files on a Linux BCC instance, a "Read-only file system" error occurs, leading to operation failure.
1
Possible reasons for a Read-only file system error may include:
- File system errors can cause the file system to switch to read-only mode.
- The file system is currently mounted as read-only.
- Disk issues, such as bad sectors, may be causing the problem.
Solution
Run the command mount | grep

If the mount option is shown as "ro," it indicates the file system is mounted in read-only mode and should be remounted in read-write mode.
mount -o remount,rw mount target
If the mount option is shown as "rw," check for file system errors as the potential cause.
Use the following command to view kernel logs for file system errors (choose one of the two options):
dmesg | egrep -i "ext3|ext4|xfs" cat /var/log/messages | egrep -i "ext3|ext4|xfs"
If the kernel logs indicate file system errors, the file system must be repaired.
For repairing the system disk's file system, boot into single-user mode to perform the repair.
If the data disk's file system is damaged, unmount the data disk first before attempting repairs.
Example command: umount /dev/vdb1 or umount /mnt
The command to repair the file system is as follows:
For file systems in the ext series, execute the following command.
fsck /dev/vdb1
For file systems in the xfs series, use the corresponding command below.
xfs_repair /dev/vdb1
Note: Repairing the file system may result in data loss. Be sure to back up your data beforehand.
If the above steps do not resolve the read-only issue, check for potential physical disk failures.
