Oamc

硬盘健康检测(SMART) · 修改记录

这是 server/smart-disk-check.md 的每次改动内容,按时间从新到旧。其他文章一起提交的部分不会出现在这里。

#1 2026-10-18 +67 −0 docs: 新增 23 篇网络/ Linux / Windows / 服务器文章 be5956e
 new file mode 100644
 @@ -0,0 +1,67 @@
+---
+tags: [磁盘, SMART, 坏道]
+order: 60
+---
+
+# 硬盘健康检测(SMART)
+
+## 场景
+
+机器变慢、有咔哒声,或者阵列卡报介质错误,需要确认盘是不是要坏。
+
+## 前置条件
+
+- 能进系统或带外管理
+- 直通盘用 `smartctl`,RAID 卡后面的盘要看阵列卡
+- 提前备份,检测本身不会损坏数据但坏盘可能随时挂
+
+## 配置
+
+```bash
+# 安装
+dnf install -y smartmontools || apt install -y smartmontools
+
+# 看总体健康
+smartctl -H /dev/sda
+
+# 看详细属性
+smartctl -a /dev/sda
+
+# 短测(2 分钟)/ 长测(几小时)
+smartctl -t short /dev/sda
+smartctl -t long /dev/sda
+
+# 看测试结果
+smartctl -l selftest /dev/sda
+```
+
+RAID 卡后面的盘:
+
+```bash
+storcli /c0/eall/sall show all | grep -i "media error\|predictive"
+```
+
+## 验证
+
+重点看这几个属性:
+
+| 属性 | 含义 |
+| --- | --- |
+| `Reallocated_Sector_Ct` | 已重映射扇区,非 0 就要警惕 |
+| `Current_Pending_Sector` | 待映射扇区,通常意味着坏道 |
+| `Offline_Uncorrectable` | 离线不可纠正错误 |
+| `UDMA_CRC_Error_Count` | 线缆/背板问题,不是盘坏 |
+| `Temperature_Celsius` | 温度,持续 50℃ 以上要查风道 |
+
+## 回滚
+
+检测不改数据,无需回滚。长测会占用磁盘,业务高峰别跑。
+
+## 坑
+
+- **RAID 卡后面的盘 `smartctl` 看不到**,要用 `storcli ... show all` 或 `-d megaraid,N`。
+- `Reallocated_Sector_Ct` 缓慢增长是正常老化,突然暴涨要立刻换盘。
+- 长测期间性能下降,别在生产高峰做。
+- 温度高不一定是盘的问题,可能是风扇或风道。
+- 换盘前先确认阵列已经重建完成,别同时掉两块。
+- 笔记本和桌面盘的 SMART 阈值和服务器盘不一样,别照搬。