Linux Error: Input/output error — Cause, Fix, and Troubleshooting Guide
How to fix the Linux 'Input/output error' (EIO): diagnose failing disks with SMART and dmesg, distinguish device faults from NFS drops, and recover safely.
- #linux
- #troubleshooting
- #storage
- #disk
Stuck on this Linux Admins error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Summary
Input/output error maps to the errno EIO (5). It is the kernel telling you a low-level read or write against a device failed and could not be completed. Unlike a busy or permission error, Input/output error usually points at hardware or transport trouble — a failing disk, a flaky cable/controller, a dropped SAN/iSCSI path, or a broken NFS backend. Treat it as a data-integrity event first and a config problem second.
Common Symptoms
cat,cp, orddon a specific file returnsInput/output errorpartway through.dmesgfills withI/O error,blk_update_request, orEXT4-fs errorlines.- A filesystem remounts itself read-only after a write failure.
smartctlreports reallocated or pending sectors climbing.- On NFS, all access to an export returns
EIOafter the server or network faulted.
Most Likely Causes of the ‘Input/output error’ Error
The Input/output error error is a failed device operation. In production, most likely first:
- A failing or dying disk — bad/pending sectors, a drive going offline mid-operation. SMART and
dmesgwill show it. - A flaky transport — a loose/failing SATA/SAS cable, a controller (HBA) fault, or a dropped multipath/iSCSI/SAN path so the block device times out.
- A dead or faulted NFS backend — the export’s underlying storage failed, so the client surfaces
EIOrather than a hang. - Filesystem metadata corruption — the kernel hits an inconsistency (
EXT4-fs error) and returnsEIOwhile flagging the fs. - A device that went read-only or offline — the block device state flipped to
offline, so every I/O errors out.
Quick Triage
# The kernel's account of the failure (most important single command)
dmesg -T | grep -Ei 'I/O error|blk_update_request|EXT4-fs error|offline|medium error' | tail
# Which device/mount is affected?
findmnt
lsblk -o NAME,SIZE,STATE,MOUNTPOINT
dmesg almost always names the failing device (e.g. sdb) and the sector — start there.
Diagnostic Commands
# Full kernel error trail: bad sectors, resets, path failures
dmesg -T | grep -Ei 'error|reset|offline|medium|timeout' | tail -40
# Is the block device even online?
cat /sys/block/sdb/device/state # expect "running", not "offline"
# SMART health and error/reallocated-sector counters (install smartmontools)
sudo smartctl -H /dev/sdb
sudo smartctl -a /dev/sdb | grep -Ei 'Reallocated|Pending|Uncorrectable|Health'
Rising Reallocated_Sector_Ct, Current_Pending_Sector, or Offline_Uncorrectable means the drive is failing — replace it, do not repair it.
# Read-only, non-destructive surface scan (never run the write test on live data)
sudo badblocks -sv -b 4096 /dev/sdb
Warning:
badblocksin write mode (-w) destroys all data on the device. Only ever run the read-only form (-sv, no-w) on a disk you care about, and prefer running it on an unmounted device.
# NFS angle: is the backend actually reachable/exporting?
findmnt -t nfs,nfs4
showmount -e <nfs-server>
nfsstat -m
If the affected mount is NFS and showmount -e fails, the fault is the server/network, not a local disk.
Fix / Remediation
-
Back up readable data immediately. If a disk is throwing
EIO, copy what you still can before doing anything else — a failing drive gets worse:sudo ddrescue -f -n /dev/sdb /dev/sdc rescue.map # image the failing disk first -
Replace failing hardware. If SMART shows reallocated/pending/uncorrectable sectors climbing, the disk is dying — swap it and restore from backup. No filesystem repair fixes bad media.
-
Reseat/repair the transport. For cable/controller/path faults (resets in
dmesg,stateflapping), reseat cables, check the HBA, or fail over/restore the multipath/iSCSI path:sudo multipath -ll echo running | sudo tee /sys/block/sdb/device/state # re-enable an offlined device (only if hardware is sound) -
Address NFS-backend faults on the server side: restore the export’s storage, confirm
showmount -esucceeds, then remount the client. -
If the fault is filesystem corruption (
EXT4-fs errorwith sound hardware), do not repair a mounted or actively-failing filesystem.Warning:
fsck/xfs_repaircan lose or alter data and must never run on a mounted filesystem. Unmount first, image or back up the device, and run a read-only check (fsck -n/xfs_repair -n) before any repair. Full walkthrough: recovering corrupted Linux filesystems with fsck.sudo umount /dev/sdb1 sudo fsck -n /dev/sdb1 # ext4: read-only check first (Ubuntu/Debian, RHEL/Rocky) sudo xfs_repair -n /dev/sdb1 # xfs: dry run (RHEL/Rocky default fs)
Validation
# No new I/O errors after the fix
dmesg -T | grep -Ei 'I/O error|EXT4-fs error' | tail
# Device back online and SMART healthy
cat /sys/block/sdb/device/state
sudo smartctl -H /dev/sdb
# Files read end-to-end
find /mnt/data -type f -print0 | xargs -0 -I{} sh -c 'cat "{}" >/dev/null' && echo "reads clean"
Prevention
- Run scheduled SMART self-tests and alert on rising
Reallocated/Pending/Uncorrectablecounts — most diskEIOis predictable days in advance. - Deploy
smartd(smartmontools) with email/webhook alerts on every host with local disks. - Use redundant storage (RAID/mirroring, multipath) so a single failing device does not surface
EIOto applications. - For NFS, mount
hardwith a boundedtimeoso backend faults retry rather than corrupting in-flight work, and monitor the server’s disk health too. - Keep tested, restorable backups —
EIOfrom bad media is a replace-and-restore event, not a repair. - Alert on filesystems remounting read-only (a common kernel response to write
EIO).
Related Errors
- Structure needs cleaning
- Buffer I/O error on dev
- Read-only file system
- Stale file handle
- fsck: unexpected inconsistency; run fsck manually
Final Notes
Input/output error is a device-level failure, so lead with dmesg and smartctl to separate dying media from a flaky transport or a dead NFS backend. If SMART is degrading, image the disk and replace it — no repair fixes bad sectors. Only when hardware is proven sound and the fault is metadata corruption should you unmount, back up, and run fsck -n/xfs_repair -n before any write repair.
Want faster Linux incident response? Use DevOps AI Toolkit to turn production errors into clear diagnostics, remediation steps, and reusable runbooks.
Fixed it? Get 500 Linux Admins & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.