"Read-only file system" — The Disk or the Kernel Lost Trust

A filesystem going read-only is usually the kernel protecting data after I/O errors — or a deliberately read-only mount. Distinguish the two fast: one is a fsck, the other is a config.

What you'll see

Root causes

Kernel remounted RO after I/O errors (failing disk/cable)

EXT4 flips read-only on device errors. dmesg -T | grep -iE 'I/O error|read-only' names the device. This is the serious case: copy data off, then repair/replace.

Intentional or inherited read-only mount

mount | grep ' ro,' shows RO mounts (recovery environments, containers, VM images). Some boot environments mount root RO until remounted (dracut/initramfs shells).

VM disk detached/filled by hypervisor or snapshot quiescing

Cloud VMs can lose a data disk briefly; on return the fs may be RO. Check dmesg around the detach time.

Fix it

  1. Determine which cause: errors vs policy
    findmnt -no OPTIONS / ; sudo dmesg -T | grep -iE 'I/O error|read-only' | tail -5
  2. If policy: remount read-write
    sudo mount -o remount,rw /   # and fix fstab options (defaults vs ro) so it sticks across boots
  3. If disk errors: back up data first, then unmount and fsck
    sudo umount /dev/sdX1 && sudo fsck -y /dev/sdX1   # NEVER fsck a mounted filesystem
  4. Replace failing hardware or migrate the volume
    smartctl -a /dev/sdX | grep -iE 'reallocated|pending'   # nonzero reallocated sectors = plan the replacement now

Field note

fsck on a mounted filesystem can corrupt it — the umount is not optional. Recurring RO flips on cloud disks: check provider disk health events before swapping kernels and configs.

Common questions

Why does Linux turn my filesystem read-only without asking?

It's data protection: after I/O errors, continuing to write risks corrupting the filesystem beyond fsck's repair. The dmesg log right before the flip tells you what triggered it.

Is it safe to force-remount rw and keep working?

If the cause was I/O errors, no — you'd be writing onto a disk that already failed. Remount-rw is for policy/config cases only. Error cases get: backup → fsck/replace.

Ship it right the first time

Our most-documented failures, packaged as ready-to-ship starter kits: Docker, Kubernetes, and Terraform.

Browse the template store →

One-time. Yours to modify. Instant download from the NinjaOps template store.