284 瀏覽數

Linux – smartd

指令 #smartctl – http://benjr.tw/95984 是透過硬碟本身所提供的 S.M.A.R.T. (Self-Monitoring Analysis and Reporting Technology )技術 ,他可以根據檢測屬性的結果來決定該顆硬碟的使用是否快故障.但手動的總是不方便,我們可以使用 smartd (Daemon) 自動執行.

測試環境為 Ubuntu14.04

啟用 smartd, 並設定檢查間隔時間為 interval=1800 秒

root@ubuntu:~# nano /etc/default/smartmontools
start_smartd=yes
smartd_opts="--interval=1800"

剛剛設定 smartd 服務是否啟動與間隔時間,詳細的測試項目須參考這一檔案.

root@ubuntu:~# nano /etc/smartd.conf
DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner

參數說明如下:

  • -d TYPE
    1. ata – the device type is ATA.
    2. scsi – the device type is SCSI.
    3. 3ware,N – the device consists of one or more ATA disks connected to a 3ware RAID controller.
    4. removable – the device or its media is removable. This indicates to smartd that it should continue
  • -n POWERMODE
    1. never – smartd will poll (check) the device regardless of its power mode.
    2. sleep – check the device unless it is in SLEEP mode.
    3. standby – check the device unless it is in SLEEP or STANDBY mode.
    4. idle – check the device unless it is in SLEEP, STANDBY or IDLE mode.
  • -m : specifies an email address to send test reports to.
  • -M : specifies the desired type of delivery for an email report.
    1. once: sends only one warning email for each type of disk problem detected.
    2. daily: sends additional warning reminder emails, once per day, for each type of disk problem detected.
    3. diminishing: sends additional warning reminder emails, after a one-day interval, then a two-day interval, then a four-day interval, and so on for each type of disk problem detected.
    4. test: sends a single test email immediately upon smartd startup.
    5. exec PATH: runs the executable PATH instead of the default mail command.

啟動服務

root@ubuntu:~# service smartmontools start

網友的想法

  1. 自動參照通知: Linux command – smartctl – Benjr.tw

發表迴響