Interview Prep/Linux/Disk space, inodes and filesystems

`touch /data/test` returns `touch: cannot touch '/data/test': Read-only file system`.

BeginnerTroubleshootingDisk space, inodes and filesystems
Answer

Likely causes → The kernel remounted it read-only after I/O or filesystem errors (errors=remount-ro), it was mounted ro, or the underlying device is read-only (EBS issue, snapshot).

Diagnose →

findmnt /data
dmesg -T | grep -Ei 'EXT4-fs error|XFS|I/O error|remount'
sudo smartctl -H /dev/sdb 2>/dev/null

Fix → If it was a mount option, mount -o remount,rw /data. If errors caused it: stop apps, unmount, run e2fsck -f or xfs_repair, then mount again. Replace the disk if errors are hardware.

Prevent → Alert on filesystem errors in kernel logs and on SMART health.

All Linux questions Roadmap: Linux

More on Disk space, inodes and filesystems