【コラム】

システムの評価、できてますか?

11 もっと高度なS.M.A.R.T監視を体験

    鶴田展之  [2007/03/01]

    前回はLinuxのhddtempコマンドを使って、ハードディスクドライブのS.M.A.R.T値を参照してみたが、今回はもっと高度なS.M.A.R.Tアプリケーションを使ってみよう。Linux等のUNIX系アプリケーションはもちろん、Mac OS XやWindowsでも利用できるS.M.A.R.T監視ツール、「smartmontools」である。

    まず導入方法だが、開発プロジェクトのWebサイトからソースコードが入手出来る他、Windows用のインストーラやRPMパッケージも配布されている。Linuxディストリビューションによってはバイナリパッケージが整備されているものもあり、例えばDebian GNU/Linuxでは、aptを使った簡単な導入が可能だ。

    # apt-get install smartmontools

    以下、Debian GNU/Linuxでインストールした環境を前提に、smartmontoolsの基本的な使い方を解説しよう。

    smartmontoolsは、主にS.M.A.R.Tディスク監視デーモン「smartd」と、ユーティリティプログラムの「smartctl」で構成されている。まず、「/etc/default/smartmontools」を編集して、最低限smartdが起動できるように設定しよう。

    「enable_smart」パラメータには、smartdが監視対象とするディスクを指定する。

    # list of devices you want to explicitly enable S.M.A.R.T. for
    # not needed if the device is monitored by smartd
    enable_smart="/dev/sda"

    システムの起動時にsmartdを自動的に起動するには、「start_smartd=yes」を有効にしよう。

    # uncomment to start smartd on system startup
    start_smartd=yes

    さてsmartdは、一度起動すると「smartd.conf」設定ファイルの記述に従い常駐プロセスとして動作する。smartd.confには最初からいくつかの代表的な設定パターンが記述されているので、サンプルとして参考にしながら必要な設定を行おう。例えば、ディスクに問題が起きた時に管理者にメールを送信するには、以下の設定を有効にして、ドライブとメールアドレスの指定を書き換えればよい。

    # A very silent check. Only report SMART health status if it fails
    # But send an email in this case
    /dev/sda -H -m admin@example.com

    そうそう、一点だけ注意しなければならない。smartd.conf中で「DEVICESCAN」の行が有効になっていると、以降の設定は全て無視されてしまう。「DEVICESCAN」とだけ書いておくと、接続されたデバイスから自動的に監視可能なディスク装置を見つけ出してくれるので便利だが、その分、自分で細かい設定を行うことができなくなる。行頭に「#」を付けてコメントアウトしておこう。

    設定ができたら、smartdを起動する。

    # /etc/init.d/smartmontools start
    Enabling S.M.A.R.T. for: /dev/sda.
    Starting S.M.A.R.T. daemon: smartd.

    これで、smartdが起動し、ハードディスクの異常を検知したらメールで知らせてくれるはずだ。

    smartmontoolsに含まれるもうひとつのプログラム「smartctl」は、コマンドラインから対話的にS.M.A.R.Tの情報を参照したい時に利用できる。以下のように「-a」オプションとデバイスを指定して実行してみよう。

    # smartctl -a /dev/sda
    smartctl version 5.32 Copyright (C) 2002-4 Bruce Allen
    Home page is http://smartmontools.sourceforge.net/

    Device: SEAGATE  ST336607LW       Version: DS09
    Serial number: 3JA7SQCH
    Device type: disk
    Transport protocol: Parallel SCSI (SPI-4)
    Local Time is: Tue Feb 27 23:11:11 2007 JST
    Device supports SMART and is Enabled
    Temperature Warning Enabled
    SMART Health Status: OK

    Current Drive Temperature:     38 C
    Drive Trip Temperature:        68 C
    Vendor (Seagate) cache information
      Blocks sent to initiator = 150704291
      Blocks received from initiator = 2084014867
      Blocks read from cache and sent to initiator = 25358757
      Number of read and write commands whose size <= segment size = 92431191
      Number of read and write commands whose size > segment size = 13
    Vendor (Seagate) factory information
      number of hours powered up = 22818.40
      number of minutes until next internal SMART test = 66

    Error counter log:
              Errors Corrected    Total      Total   Correction     Gigabytes    Total
                  delay:       [rereads/    errors   algorithm      processed    uncorrected
                minor | major  rewrites]  corrected  invocations   [10^9 bytes]  errors
    read:     458617        0         0    458617     458617        903.482           0
    write:         0        0         0         0          0       1146.478           0

    Non-medium error count:     3212

    [GLTSD (Global Logging Target Save Disable) set. Enable Save with '-S on']

    SMART Self-test log
    Num  Test              Status                 segment  LifeTime  LBA_first_err [SK ASC ASQ]
         Description                              number   (hours)
    # 1  Background long   Completed                   -     5                   - [-   -    -]

    Long (extended) Self Test duration: 768 seconds [12.8 minutes]

    温度やヘルスステータス、エラーカウンタの値等、ハードディスクドライブの状態を詳細にレポートしてくれる。

    新着記事

    特設サイトの情報

      人気記事

      一覧

        イチオシ記事

        新着記事

        特別企画

        マイナビニュースマガジン