Linux上使用SMART检测硬盘

SMART(Self-Monitoring, Analysis, and Reporting Technology)是一种普及度比较高的磁盘分析检测工具,磁盘运行过程当中,该工具搜集磁盘的状态参数,如型号、容量、温度、密度、扇区、寻道时间、传输、误码率等。能够作到动态检测磁盘状态,当某些参数达到阈值时,会警示磁盘故障。html

SMART包括2个工具,守护进程smartd和应用程序smartctl。守护进程用来检测、监控、分析、上报磁盘信息,有对应的配置维护。smartctl用以检查磁盘的运行状态信息。工具

下面简单列举smartctrl的经常使用用法:.net

smartctl -a #检查是否启用smart
smartctl -s on #启用smart
smartctl -H #检查磁盘健康情况
smartctl -A #查看硬盘的详细信息
smartctl -t long #后台检测,消耗时间长
smartctl -t short #后台检测,消耗时间短
smartctl -C -t #前台检测硬盘,CPU、内存消耗
smartctl -X #中断后台检测硬盘
smartctl -l selftest #显示硬盘检测日志
smartctl -l error #显示硬盘错误汇总
日志

通常会在守护进程smartd中配置一些高级功能,好比,定时检测、分析汇总、上报等。能够编辑smartd.conf进行配置。经常使用的配置项:htm

  1. 邮件告警
    /dev/sda -a -m admin@example.com,root@localhost #监控磁盘的全部属性,出现 Failure,邮件通知
    /dev/sda -H -m admin@example.com,root@localhost #监控磁盘的健康状态,出现 Failure,邮件通知
    /dev/sdb -m admin@example.com -M test #启用时,发送test消息
  2. 定时检测

/dev/sde -d hpt,1/1 -a -s S/../.././01 #天天1:00-2:00 am,进行短自检
/dev/sde -d hpt,1/2 -a -s S/../.././02 #天天2:00-3:00 am,进行短自检
/dev/sde -d hpt,1/3 -a -s S/../.././03 #天天3:00-4:00 am,进行短自检
/dev/sde -d hpt,1/4/1 -a -s L/../../7/00 #每周日00:00-01:00 am,进行长自检
/dev/sde -d hpt,1/4/2 -a -s L/../../7/02 #每周日02+00-03:00 am,进行长自检
【参考】http://smartmontools.sourceforge.net/man/smartd.conf.5.html进程

相关文章
相关标签/搜索