Troubleshooting

Fix "Read-only file system" errors on a Linux VPS

Find out why Linux remounted a disk read-only, check kernel logs for disk or filesystem errors, run fsck safely from rescue mode and recover writes without losing data.

AdvancedLinux VPS3 min read

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 ro

Ignore 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
MessageMeaning
EXT4-fs error ... Remounting filesystem read-onlyFilesystem corruption detected; ext4's errors=remount-ro kicked in
Buffer I/O error, blk_update_request: I/O errorThe virtual disk or storage behind it failed to read or write
XFS ... Corruption detected. Unmount and run xfs_repairXFS 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:

  1. Boot the VPS into the provider's rescue mode (or attach the disk to another VPS).
  2. Identify the partition: lsblk -f.
  3. Run the right tool on the unmounted partition:
    fsck.ext4 -f /dev/vda1
    For XFS: xfs_repair /dev/vda1. For LVM volumes use the logical volume path, e.g. /dev/mapper/vg-root.
  4. 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/fstab for an ro option 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: true or a :ro volume produces the same error by design.

After recovery

  • Check databases: mysqlcheck --all-databases --check or 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.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.