Linux smartctl命令

硬盘的SMART是S.M.A.R.T.的缩写,全称是“Self-Monitoring, Analysis and Reporting Technology”,中文意思是“自我监测分析与报告技术”,它可以对硬盘的温度、内部电路、盘片表面介质材料等进行监测,力求及时分析出硬盘可能发出的问题,并发出警告,从而保护数据不受损失。在Linux上使用smartctl命令查看硬盘的SMART信息。

安装工具:

yum install smartmontools

1、smartctl -i <device> :显示设备的身份信息,检查硬盘是否打开了SMART支持。
看到有:

SMART support is: Enabled

说明硬盘支持SMART。

如果为Disabled,使用:

smartctl --smart=on --offlineauto=on --saveauto=on <device>

启用SMART。

2、smartctl -H <device> :查看硬盘的健康状况。

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

PASSED表示硬盘健康状态良好,如果为Failure那就要立刻更换硬盘。

3、smartctl -A <device> :显示设备SMART厂商属性和值。

4、smartctl -l error <device> :显示硬盘历史错误信息。

5、smartctl –test=TEST <device> :硬盘自测。
TEST可取值:offline, short, long, conveyance, select,M-N, pending,N, afterselect,[on|off], scttempint,N[,p]
此时可以用smartctl -X中断后台测试。

6、smartctl -l selftest <device> :显示硬盘测试信息。

7、smartctl -a <device> :显示硬盘SMART的全部信息。

参考资料:
http://bbs.linuxtone.org/thread-1029-1-1.html
http://hi.baidu.com/philoman/blog/item/70304154200c625c564e003f.html