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進程

相關文章
相關標籤/搜索