DEBUG.WIKI
野草云;香港 200Mbps 峰值;不限月流量 · BGP VPS;查看套餐 →
IPPeak:从目标地区访问网页,住宅代理、SEO 监测、广告验证
V.PS:让项目靠近用户,亚太、欧洲、北美 KVM VPS

解决 Linux 报错 Input/output error 硬件坏道只读修复

排查 Linux 复制或访问特定文件报 Input/output error (EIO),分析 smartctl 坏道检测、ddrescue 数据抢救与更换硬盘。

问题现象

读取特定文件或备份数据时中断:

cp: error reading '/data/backup.tar.gz': Input/output error

系统日志记录 I/O error, dev sda, sector 12456789。

触发根因

  1. 机械硬盘或 SSD 出现了物理坏道(Bad Sector),底层固件重试读取超时放弃;
  2. SATA 数据线老化或接触不良导致传输 CRC 校验错误骤增。

解决步骤

使用 smartctl 检查磁盘健康度与重映射扇区数

查看 SMART 属性:

sudo smartctl -a /dev/sda | grep -E 'Reallocated_Sector|Current_Pending'

使用 ddrescue 尽可能抢救抢读健康数据

在只读模式下将完好区块抢救出来:

sudo ddrescue -d -r 3 /dev/sda1 /mnt/new_disk/rescued.img /mnt/new_disk/rescue.log

验证确认

更换新磁盘并恢复镜像:

新盘数据完整导入,无任何 I/O 读取失败阻断。