smartmontoolsでS.M.A.R.T.を介してHDDの状態を監視する

  • HDDがHW的に処理しているログを監視するらしい
    • Readerror とかのデータが見れる
    • ディスクチェックをHDDのFWレベルで行わせることができる
    • アラートを飛ばすこともできる

インストール

  • CentOS5.5は標準でインストール済みだった。
    • イカ、Turbolinux 11 Serverでインストールしたときのメモ
  • ダウンロード
  • コンパイル&インストール
    • ./configure
      • daemon を起動させて常時監視体制にするなら*1
        ./configure --sbindir=/usr/sbin --sysconfdir=/etc \
        --mandir=/usr/share/man --with-initscriptdir=/etc/rc.d/init.d \
        --with-docdir=/usr/share/doc/smartmontools-VERSION
    • make
    • make install

実行

  • smartctl -a /dev/sda
    • とりあえず全部見る
  • smartctl -l selftest
    • 部分的にみる
    • selftestの他に error, selftest, selective, directory, background, scttemp[sts|hist]
  • smartctl -t short /dev/sda
    • セルフテストをさせる
    • -t short : 数分ぐらい
    • -t long : 数十分ぐらい(ディスクサイズによる)
    • そのほかにテストオプションがあるけど、ATA限定だったりするのでそこは smartctl -h
  • 詳しい(?)解説

smartd で定期監視させる

  • vi /etc/smartd.conf
    #DEVICESCAN  # ←コメントアウト
    /dev/sda -a -o on -S on -s (S/../.././02|L/../../0/03) -H -m (通報先メアド)
    /dev/sdf -a -o on -S on -s (S/../.././02|L/../../0/03) -H -m (通報先メアド)
    • たぶん
      • -a = -H -f -t -l error -l selftest -C 197 -U 198
      • -o on 自動的にオフラインテストを行う
      • -S on 自動的にエラーカウントとかを保存する(?)
      • -s (S/../.././02) セルフテスト(short)を毎月毎日毎曜日02時から開始
      • -s (L/../../0/03) セルフテスト(long)を毎月毎日0(日)曜日03時から開始
  • vi /etc/rc.d/init.d/smartd
    • init.d のスクリプトを走らせても Turbolinux は起動スクリプト対応してないよ!とか言われるので、細工をする。
      53行目
      # Red Hat or Yellow Dog or Mandrake
      if [ -f /etc/redhat-release -o -f /etc/yellowdog-release -o -f /etc/mandrake-rel
      ease -o -f /etc/whitebox-release -o -f /etc/trustix-release -o -f /etc/tinysofa-
      release -o -f /etc/turbolinux-release ] ; then
      # 最後に -o -f /etc/turbolinux-release を追加
      290行目
      #elif [ -f /etc/turbolinux-release ] ; then
      #    report_unsupported "Turbolinux"
      # 盛大にコメントアウト
  • chkconfig smartd on