
Linux下关注硬盘的健康状态
smartmontools
CentOS 5.3默认安装,smartmontools-5.38-2.el5.i386,可以执行rpm -q smartmontools或yum info smartmontools或yum list smartmontools查看。
使用方法:
命令行执行smartctl -h查看帮助信息,更详细的帮助信息可以通过man smartctl命令获得。
smartctl -i /dev/sda //查看硬盘的基本信息
smartctl -H /dev/sda //查看硬盘的健康状态
smartctl -c /dev/sda //查看smart功能,如错误记录、离线盘面扫描、自检所需时间等信息。
smartctl -l selftest /dev/sda //查看上一次硬盘selftest结果
smartctl -l error /dev/sda //查看最近5条错误记录
smartctl -t TEST //执行磁盘测试,TEST为所要执行的测试名,如offline, short, long
smartctl -X //退出磁盘测试
smartctl -A /dev/sda //查看厂商数据
几种硬盘自检功能的说明:
1、offline
2、short
3、long
4、select,N-M
5、select,N+SIZE
6、conveyance
在执行硬盘自检的过程中如何监视进度:
如果smart -c /dev/sda命令返回的信息有说"Suspend Offline collection upon new command",那么可以通过执行smart -c /dev/sda在"Self-test execution status:"这一项来跟踪自检的进度;否则若"Abort Offline collection upon new command",则在自检的过程中不能执行其他命令,否则自检过程将被终止。
关于执行自检测试的模式:
-C选项:对于short/long以及ATA硬盘的conveyance/selective自检,-C选项表示执行captive mode自检,对应于SCSI硬盘的foregroud mode。
其他:
smartd一个守护进程,收集分析磁盘的SMART参数,并可以根据设定将其发给指定用户。通常可以用来监视硬盘状态,当存在危险情况时提醒用户备份数据。
配置文件:/etc/smartd.conf