Interview Prep/Linux/Disk space, inodes and filesystems

`ls` on a directory prints `ls: cannot access 'file': Input/output error` and `dmesg` shows `blk_update_request: I/O error, dev sda, sector ...`.

AdvancedTroubleshootingDisk space, inodes and filesystems
Answer

Likely causes → Failing disk (bad sectors), controller or cable fault, or a cloud volume impairment.

Diagnose →

dmesg -T | grep -Ei 'I/O error|medium|reset'
sudo smartctl -a /dev/sda | grep -Ei 'Reallocated|Pending|Uncorrectable'
cat /proc/mdstat

Fix → Copy off readable data immediately (ddrescue /dev/sda /mnt/new/sda.img /mnt/new/map for a failing disk). Replace the disk or restore the volume from snapshot, then fsck the copy.

Prevent → RAID or replicated storage, SMART monitoring, tested backups.

All Linux questions Roadmap: Linux

More on Disk space, inodes and filesystems