Every write fails: the file system has gone read-only. Applications can no longer write their logs, the database refuses transactions, and sometimes the server stays reachable over SSH, which makes the diagnosis all the more confusing. The question to settle first is not "how do I remount read-write", but was it wanted or suffered. The two situations have neither the same cause nor the same repair, and the error message tells them apart.
What you will learn
- Tell a deliberate read-only mount from an unwanted remount-ro after a disk error, thanks to the exact message
- Read ext4 errors in the kernel log, the only reliable source
- Understand why
findmntandtune2fscan lie to you - Repair with
fsckand prove that writing is back
The error message names the cause
Two write failures, two distinct messages. This distinction is the heart of the diagnosis, and many administrators miss it:
touch /mnt/data/essai| Message received | Code | What it means |
|---|---|---|
Read-only file system | EROFS | The mount is read-only on purpose: ro option in /etc/fstab or at mount time |
Input/output error | EIO | The device has failed. The file system protected itself |
"Read-only file system" is a decision. "Input/output error" is an accident. The first is fixed by changing a mount option. The second signals a hardware or device error, and remounting read-write without doing anything else would only hide a problem that will come back, with data corruption at stake.
Case 1: read-only is intended
It is the simple case. The mount carries the ro option, and owns it:
touch /mnt/data/interditfindmnt -o TARGET,OPTIONS /mnt/datatouch: cannot touch '/mnt/data/interdit': Read-only file system/mnt/data ro,relatimeThe message says Read-only file system, and findmnt confirms it by
showing ro. Everything is consistent. Look for the ro option in
/etc/fstab, fix it, then remount:
mount -o remount,rw /mnt/datafindmnt -o TARGET,OPTIONS /mnt/dataIf the mount refuses to go back to read-write while fstab is correct,
you are not in this case: move on to the next one.
Case 2: read-only is suffered, and your tools lie to you
Here, nobody asked for read-only. The kernel imposed it because the device
returned errors, as set by the errors=remount-ro option.
Check the effective setting, in two places. The mount option, when it comes
from /etc/fstab, takes precedence and shows up in findmnt -o OPTIONS
(errors=remount-ro). The behaviour recorded in the superblock is read with
tune2fs:
tune2fs -l /dev/sdb1 | grep -i 'errors behavior'Errors behavior: Remount read-onlyThis setting is a protection, not a failure. Faced with a write error, the file system can choose between carrying on (and corrupting data), panicking (and stopping the machine), or freezing read-only. The third option preserves what can be preserved and leaves you in control. It is the one the installer sets on the root of a Debian or Ubuntu system, and the one to set yourself on your data volumes.
The trap: nothing you look at shows the failure
Here is the real state of a server whose disk has just failed. The outputs on
this page come from a lab where the failure is simulated by a device-mapper
device of type flakey, which starts refusing writes on demand: it shows up as
/dev/mapper/disque_flakey. On a real server, it is the device named in
the commands, here /dev/sdb1.
touch /mnt/data/nouveaufindmnt -o TARGET,SOURCE,FSTYPE,OPTIONS /mnt/datatune2fs -l /dev/sdb1 | grep -i 'filesystem state'touch: cannot touch '/mnt/data/nouveau': Input/output errorTARGET SOURCE FSTYPE OPTIONS/mnt/data /dev/mapper/disque_flakey ext4 rw,relatimeFilesystem state: cleanRead these three outputs carefully. Writes fail. And yet:
findmntshowsrw. The mount still claims to be read-write. The options shown in/proc/mountswere not updated by the kernel's internal switch to read-only.tune2fsshowsclean. The file system state is read from the disk, but the kernel could not write the superblock to mark it in error, precisely because the disk no longer answers. The tool therefore reports a stale state.
The only source that tells the truth: the kernel log
journalctl -k | tail -20# or, outside systemd:dmesg | grep -iE 'EXT4-fs|I/O error'EXT4-fs error (device dm-1): ext4_journal_check_start:84: Detected aborted journalEXT4-fs (dm-1): I/O error while writing superblockEXT4-fs (dm-1): Remounting filesystem read-onlyThree lines, the whole diagnosis. The kernel hit a write error, it could
not even update the superblock, it aborted the journal and remounted the
file system read-only. The term aborted journal also explains why you get
Input/output error and not Read-only file system: as long as the journal is
aborted, every operation fails with EIO, even those that should simply be
refused.
Also look for Buffer I/O error on dev lines, which point to the faulty
device, and work back up the chain: if it is a physical disk,
smartctl -H /dev/sdX will give its health status.
The disk comes back, the failure stays
A counter-intuitive point, with heavy consequences. Even when the device works perfectly again, the file system does not come back on its own to read-write:
dd if=/dev/mapper/disque_flakey of=/dev/null bs=4k count=1touch /mnt/data/apres_hoquet4096 bytes (4.1 kB, 4.0 KiB) copied, 1.1602e-05 s, 353 MB/stouch: cannot touch '/mnt/data/apres_hoquet': Input/output errorThe disk reads at 353 MB/s: it is perfectly fine. Writing still fails. A
mount -o remount,rw is not enough in this state, because the journal
stays aborted. You must unmount and repair.
Repair
The repair follows three steps, in this order. Deal first with the hardware cause if there is one: repairing a file system on a dying disk only postpones the inevitable.
1. Unmount
You never repair a mounted file system. If unmounting is refused
because processes hold open files, identify them with
lsof +f -- /mnt/data, stop them, and only use umount -l (lazy unmount) as
a last resort.
umount /mnt/dataIf the file system concerned is the root, unmounting is impossible: you must reboot into a rescue system, or force a check at the next boot. See Shut down, reboot, recover.
2. Check and repair with fsck
fsck.ext4 -fy /dev/sdb1 ; echo "exit=$?"e2fsck 1.47.2 (1-Jan-2025)/dev/mapper/disque_flakey: recovering journalPass 1: Checking inodes, blocks, and sizesPass 5: Checking group summary informationFree inodes count wrong (32756, counted=32755).Fix? yes***** FILE SYSTEM WAS MODIFIED *****exit=1-f forces the check even if the file system believes it is clean
(remember that it calls itself clean), and -y answers yes to every
question. On XFS, the default file system of RHEL, fsck checks
nothing: it prints a pointer to xfs_repair(8) and exits with 0
(measured on Debian 13 and AlmaLinux 10). Repairing an unmounted XFS goes
through xfs_repair, and a script that tests the $? of fsck wrongly
concludes that the volume is healthy.
If you wish to check the consistency of an XFS filesystem orrepair a damaged filesystem, see xfs_repair(8).3. Remount and prove that writing is back
mount /dev/sdb1 /mnt/datafindmnt -o TARGET,SOURCE,FSTYPE,OPTIONS /mnt/dataecho "reparation" > /mnt/data/verif.txt && echo "ecriture de nouveau possible"/mnt/data /dev/mapper/disque_flakey ext4 rw,relatimeecriture de nouveau possibleSeeing no error is not enough: actually write a file. It is the only proof that the service running on this mount will be able to work.
Troubleshooting
The table starts from what you observe, from the error message to a tool's misleading output, and gives the check that settles it. Remember the middle column: in the middle of a failure, only the kernel log can be trusted.
| Symptom | Likely cause | Verification | Fix |
|---|---|---|---|
Read-only file system | Deliberate ro mount | findmnt -o OPTIONS shows ro | Fix /etc/fstab, mount -o remount,rw |
Input/output error | Disk error, aborted journal | journalctl -k | grep EXT4-fs | Unmount, fsck -fy, remount |
findmnt says rw but nothing gets written | Internal remount-ro after an error | The kernel log, never findmnt | fsck after unmounting |
tune2fs says clean while everything breaks | Superblock not written (silent disk) | journalctl -k | Do not trust tune2fs in the middle of a failure |
remount,rw changes nothing | Aborted journal | journalctl -k: aborted journal | Unmount and fsck, a remount is not enough |
umount refused (target is busy) | Processes holding open files | lsof +f -- /mnt/data | Stop the processes, umount -l as a last resort |
The root / is read-only | System disk in error | Console, journalctl -k | Reboot into rescue mode |
Prevention
A triggered errors=remount-ro is a symptom, not the disease. Two reflexes
prevent a recurrence. Monitor disk health with smartctl and monitoring
that reports I/O errors: the disk has almost always given signs before failing.
And monitor the kernel log: Buffer I/O error lines often appear days
before the outright failure, without any application complaining yet.
Put it into practice
Faced with a stuck mount, theory evaporates fast: you need to have run through the sequence once already. The lab confronts you with a broken fstab that has left a mount read-only: it is up to you to read the kernel log, fix the faulty line and prove that writing is back with a real file.
Key points
- The error message names the cause:
Read-only file system(EROFS) is a wantedromount,Input/output error(EIO) is a suffered failure. errors=remount-rois not the default of amkfs.ext4: a new volume comes out withErrors behavior: Continue, to be fixed withtune2fs -e remount-ro.fsckon an XFS checks nothing and exits with 0: it points toxfs_repair(8). A script that tests$?wrongly concludes that the system is healthy.errors=remount-rois a protection, not a bug: ext4 freezes to avoid corrupting your data.findmntcan showrwwhile the file system is blocked. Mount options are not updated by the internal switch to read-only.tune2fscan showcleanduring the failure: it reads the superblock from a disk that no longer answers.- The kernel log is the only reliable source:
journalctl -kordmesg, and look forEXT4-fs error,aborted journal,Buffer I/O error. - A disk that works again does not repair the mount. You must unmount,
fsck, remount. fsckreturning 1 has corrected errors: it is a success, not a failure.- Prove the repair by writing a file, do not settle for the absence of an error message.
Knowledge check
Check that the essentials of this guide are acquired. The questions only cover what has just been explained here.
Knowledge check
Check what you have learned with this interactive quiz
How it works
- The timer starts when you click Start
- Multiple choice, true/false and short answer questions
- You can move between questions
- Detailed results are shown at the end
Starts the quiz and the timer
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
Continue the course: A server that does not finish booting
A new full quiz with random questions
Work again only on the questions you missed