Linux EIOMedium

Linux I/O Error: Diagnosing and Resolving EIO Errors

Article describes I/O errors in Linux, their causes, and provides practical methods for diagnosis and repair using standard utilities.

Updated at February 16, 2026
15-30 min
Medium
FixPedia Team
Применимо к:Ubuntu 20.04+Debian 10+RHEL 8+Arch Linux

What Are I/O Errors in Linux

Input/Output (I/O) errors in Linux occur when the system cannot read from or write data to a disk. They typically appear as "Input/output error" messages in logs or when attempting to access files. For example, running the cat command on a file with corrupted sectors might produce:

cat: file.txt: Input/output error

These errors indicate problems at the level of the physical disk, file system, or drivers. The EIO (Error I/O) code often appears in system logs and can be caused by both temporary glitches and irreversible media damage.

Common Causes

  1. Physical disk damage — bad sectors, wear on mechanical components (for HDDs), electronic issues, or degradation of NAND cells (for SSDs).
  2. File system corruption — improper shutdowns, kernel crashes, write errors (e.g., due to sudden power loss).
  3. Cable or controller issues — faulty SATA/IDE cables, bad ports on the motherboard, RAID controller or driver failures.
  4. Insufficient system resources — memory exhaustion, swap problems, leading to disk access errors under high load.
  5. Outdated or conflicting drivers — especially for RAID arrays, specialized hardware, or new disks in older systems.
  6. Disk overheating — can cause temporary I/O errors, particularly in poorly ventilated environments.
  7. Partition or partition table damage — errors in MBR/GPT prevent proper data access.

Resolution Methods

Method 1: Check System Logs

First, identify which disks and partitions are causing errors by examining system logs. This helps localize the problem and understand its nature.

Run a command to filter error messages:

sudo dmesg | grep -i "error\|io"

Or review the main log file:

sudo grep -i "input/output error" /var/log/syslog

Look for device mentions (e.g., sda, nvme0n1, hdX) and error context in the output. For example:

[ 1234.567890] sd 0:0:0:0: [sda] FAILED RESULT
[ 1234.567895] sd 0:0:0:0: [sda] Sense Key : Medium Error [current] 
[ 1234.567900] sd 0:0:0:0: [sda] Add. Sense: Unrecovered read error

This output indicates physical damage to disk sda. Note the device name for further steps.

Method 2: Run a File System Check (fsck)

If logs point to file system corruption (e.g., superblock or inode errors), use fsck. Important: The partition must be unmounted, or data loss may occur.

  1. Identify the affected partition using lsblk or df -h. For example:
    lsblk -f
    

    Find the mount point and device (e.g., /dev/sda1).
  2. Unmount the partition:
    sudo umount /dev/sdX1
    

    If it's the root (/) partition or in use, boot from a Live-USB (e.g., Ubuntu Live) or use recovery mode.
  3. Run fsck with automatic repair:
    sudo fsck -y /dev/sdX1
    

    This is safe for ext4, but for other file systems (e.g., XFS) fsck is not supported—use xfs_repair instead.
  4. After completion, remount the partition:
    sudo mount /dev/sdX1 /mount/point
    

    Verify that file access errors are resolved.

Method 3: Diagnose the Disk with SMART

The smartctl utility from the smartmontools package analyzes SMART attributes that predict disk failure.

  1. Install smartmontools:
    # For Debian/Ubuntu
    sudo apt update && sudo apt install smartmontools
    
    # For RHEL/CentOS
    sudo yum install smartmontools
    
    # For Arch
    sudo pacman -S smartmontools
    
  2. Check the disk's overall health status:
    sudo smartctl -H /dev/sdX
    

    Example output:
    SMART overall-health self-assessment test result: PASSED
    

    If it shows FAILED, the disk needs replacement.
  3. Get detailed attribute information:
    sudo smartctl -A /dev/sdX
    

    Key attributes to analyze:
    • Reallocated_Sector_Ct — count of reallocated sectors. Non-zero values indicate wear.
    • Current_Pending_Sector — sectors awaiting reallocation. Any value is a warning.
    • UDMA_CRC_Error_Count — data transfer errors, often due to a bad cable.
    • SMART 5 (Reallocated Sectors Count) and SMART 187 (Reported Uncorrectable Errors) — critical for HDDs.
  4. Run an extended self-test (may take several hours):
    sudo smartctl -t long /dev/sdX
    

    Monitor progress:
    sudo smartctl -a /dev/sdX | grep "Self-test"
    

    After completion, review results:
    sudo smartctl -l selftest /dev/sdX
    

    Test errors confirm a hardware issue.

Method 4: Check for Bad Blocks

The badblocks utility scans for physically damaged blocks. Warning: The write option (-w) destroys all data on the disk! Use only on empty or backup disks.

  1. For a safe read-only scan:
    sudo badblocks -sv /dev/sdX
    

    -s shows progress, -v provides verbose output. Scanning a 1 TB disk may take 10+ hours.
  2. If badblocks finds errors, create a list and pass it to fsck to mark bad blocks:
    sudo badblocks -sv /dev/sdX > badblocks.txt
    sudo fsck -l badblocks.txt /dev/sdX1
    

    This prevents the file system from using corrupted blocks.
  3. For full erase and verification (dangerous, data is permanently deleted):
    sudo badblocks -wsv /dev/sdX
    

    Then recreate the file system:
    sudo mkfs.ext4 /dev/sdX1
    

    Use only if the disk is new or you are prepared to lose data.

Method 5: Check Cables and Controllers

Hardware issues often cause intermittent I/O errors.

  • Cables: Replace SATA/IDE cables with new ones, check connector integrity. For NVMe, ensure the card is properly seated in the slot.
  • Ports: Connect the disk to a different motherboard port or use a separate PCIe controller (e.g., for SATA).
  • RAID arrays: if using software RAID (mdadm), check status:
    cat /proc/mdstat
    sudo mdadm --detail /dev/mdX
    

    For hardware RAID, use the vendor's utilities (e.g., storcli for LSI).
  • Power: ensure the disk receives stable power. With multiple disks, check the PSU's wattage capacity.

Method 6: Replace the Disk for Critical Errors

If diagnostics (SMART, badblocks) show disk failure and fsck doesn't help, the disk is likely physically damaged. In this case:

  1. Replace the disk immediately with a new equivalent or higher-capacity model.
  2. Restore data from the latest backup. If none exists, try:
    • Mounting the disk read-only on another system.
    • Using recovery tools (testdisk, photorec), but success is not guaranteed with physical damage.
  3. After replacement:
    • Create a new file system: sudo mkfs.ext4 /dev/sdX1.
    • Restore data from the backup.
    • Set up SMART monitoring for the new disk.

Prevention

To minimize future I/O error risks:

  • Regular backups: use rsync, borg, or cloud services. Store copies on a different physical medium.
  • SMART monitoring: configure the smartd daemon for daily tests and email alerts. Example configuration in /etc/smartd.conf:
    DEVICESCAN -a -o on -S on -s (S/../.././02|L/../../6/03)
    
  • Quality components: choose high-reliability disks (e.g., NAS or server models) and verified cables.
  • Power failure protection: use a UPS and configure proper shutdown on power loss.
  • Temperature control: install utilities like hddtemp or smartctl for monitoring. HDD temperatures above 50°C, SSD above 70°C, warrant better cooling.
  • System updates: regularly update the kernel and drivers, especially for RAID controllers and new disks.
  • Avoid disk overload: don't run multiple intensive write operations simultaneously, especially on older HDDs.

F.A.Q.

What causes I/O errors in Linux?
How to check disk for bad blocks?
Can I/O errors be fixed without data loss?
What to do if fsck doesn't help?

Hints

Check system logs
Run filesystem check (fsck)
Diagnose disk with SMART
Check for bad blocks
Check cables and controllers
Replace disk on critical errors
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community