Read-only file system errors appear when the kernel remounts a disk read-only to protect it after detecting errors, or when a filesystem was mounted read-only on purpose. Writes fail everywhere: logs, databases, package installs. Treat it as a warning about the disk and act carefully.
Before you start
- Root access and your provider's console and rescue mode.
- Recent backups. If possible, copy important data off the server before running repairs.
Confirm which filesystem is read-only
mount | grep ' ro,'or
findmnt -o TARGET,SOURCE,FSTYPE,OPTIONS | grep -w roIgnore entries that are read-only by design (for example squashfs snap images or /sys/fs/cgroup).
Read the kernel log
dmesg -T | grep -iE 'error|ext4|xfs|i/o|remount|read-only' | tail -30| Message | Meaning |
|---|---|
EXT4-fs error ... Remounting filesystem read-only | Filesystem corruption detected; ext4's errors=remount-ro kicked in |
Buffer I/O error, blk_update_request: I/O error | The virtual disk or storage behind it failed to read or write |
XFS ... Corruption detected. Unmount and run xfs_repair | XFS metadata corruption |
I/O errors on a VPS often point to a problem on the host's storage: contact support with the timestamps, as they may need to fix the node first.
Save what you can first
Even read-only, you can still read data. Copy critical files and dump databases to another server if they are still running:
rsync -a /var/www/ user@backup-host:/rescue/www/Try a remount (only if the cause is understood)
mount -o remount,rw /If the filesystem has errors, this either fails or the kernel will switch back to read-only soon. Do not keep running a corrupted filesystem read-write; repair it.
Repair the filesystem with fsck
Never run fsck on a mounted filesystem. For the root disk:
- Boot the VPS into the provider's rescue mode (or attach the disk to another VPS).
- Identify the partition:
lsblk -f. - Run the right tool on the unmounted partition:For XFS:
fsck.ext4 -f /dev/vda1xfs_repair /dev/vda1. For LVM volumes use the logical volume path, e.g./dev/mapper/vg-root. - Answer yes to fixes (or add
-y), then reboot normally.
Files the repair could not place end up in lost+found at the root of that filesystem.
Alternatively, schedule a check at next boot for ext4 on systemd systems by adding fsck.mode=force to the kernel command line once.
Other causes
- fstab mounts it read-only: check
/etc/fstabfor anrooption or a wrong UUID causing a fallback mount. - Disk completely full: gives "No space left on device", not read-only, but both may appear after crashes.
- Docker or container read-only flags: inside a container,
read_only: trueor a:rovolume produces the same error by design.
After recovery
- Check databases:
mysqlcheck --all-databases --checkor PostgreSQL's logs. - Verify recent backups restore correctly.
- If errors return, the underlying storage is failing: migrate to a new VPS or ask support to move the disk.
Read-only filesystem FAQ
Will I lose data?
Usually not, if you stop writing and repair promptly. Severe corruption can lose recent files, which is why backups matter.
Why does it go read-only instead of crashing?
It protects your data: continuing to write to a damaged filesystem can make corruption much worse.
Can I fix this on cPanel hosting?
No, it is a server-level problem. Contact support straight away.
