smartctlコマンドを使ってみる †CentOS5にUSB接続したハードディスクの調子が悪そうでsmartctlコマンドを使ってハードディスクを調査、診断してみました。 smartctlコマンドを使用した経緯 †Logwatcherから以下のようなメールが届いていました。 --------------------- Smartd Begin ------------------------ Warnings: Warning via mail to root: successful - 1 Time(s) Sending warning via mail to root ... - 1 Time(s) ---------------------- Smartd End ------------------------- S.M.A.R.Tについて †S.M.A.R.Tに対応しているハードディスクは温度・不良セクタ数等などを検査することができます。
関連資料 †Windows向けの資料ですが、S.M.A.R.Tについて記述した資料です。 smartctlを使ってみる †いくつかのオプションを使用してsmartctlコマンドを使ってみました。 ハードディスクの情報の取得 -aオプション †デバイス(ハードディスク)の情報を取得します。 smartctl -a デバイス名 smartctl -hオプションを使用し-aオプションの動作を確認してみます。 [root@centos5 ~]# smartctl -h <省略> -a, --all Show all SMART information for device <省略> 実際にデバイス名/dev/sdaを指定して実行した時の出力です。 [root@centos5 ~]# smartctl -a /dev/sda smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.18-348.3.1.el5] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF INFORMATION SECTION === Model Family: Hitachi Deskstar 7K2000 Device Model: Hitachi HDS722020ALA330 Serial Number: 12345678901234 LU WWN Device Id: 5 000000 222222222 Firmware Version: 11111111 User Capacity: 2,000,398,934,016 bytes [2.00 TB] Sector Size: 512 bytes logical/physical Device is: In smartctl database [for details use: -P show] ATA Version is: 8 ATA Standard is: ATA-8-ACS revision 4 Local Time is: Mon Apr 15 12:12:12 2013 JST SMART support is: Available - device has SMART capability. SMART support is: Enabled === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED General SMART Values: Offline data collection status: (0x82) Offline data collection activity was completed without error. Auto Offline Data Collection: Enabled. <省略> SMART Attributes Data Structure revision number: 16 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x000b 100 100 016 Pre-fail Always - 0 2 Throughput_Performance 0x0005 133 133 054 Pre-fail Offline - 100 3 Spin_Up_Time 0x0007 113 113 024 Pre-fail Always - 636 (Average 639) 4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 91 5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0 7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0 8 Seek_Time_Performance 0x0005 121 121 020 Pre-fail Offline - 35 9 Power_On_Hours 0x0012 097 097 000 Old_age Always - 22171 10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 19 <省略> テストをおこなう -tオプション †オプション-tを使用することによりセルフテストを実行することができます。 smartctl -t テストタイプ デバイス名 オプション-hを使用して-tオプションについて確認しました。 [root@centos5 ~]# smartctl -h <省略> -t TEST, --test=TEST Run test. TEST: offline, short, long, conveyance, vendor,N, select,M-N, pending,N, afterselect,[on|off] <省略> 上記のshortとlongを実際につかってセルフテストを行ってみます。 shortを利用したセルフテスト †
longを利用したセルフテスト †上記と同様にshortをlongに変更してsmartctlコマンドを実行します。 [root@centos5 ~]# smartctl -t long /dev/sda smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.18-348.3.1.el5] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Execute SMART Extended self-test routine immediately in off-line mode". Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful. Testing has begun. Please wait 131 minutes for test to complete. Test will complete after Mon Apr 15 21:24:39 2013 Use smartctl -X to abort test. [root@centos5 ~]#
セルフテストを中止する †上記で-tオプションを使用してセルフテストを行いました。 Use smartctl -X to abort test. 実際に使用するには、以下のようになります。 smartctl -X デバイス名 実際にセルフテストを実行して中止したときの出力です。 [root@centos5 ~]# smartctl -t short /dev/sda smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.18-348.3.1.el5] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Execute SMART Short self-test routine immediately in off-line mode". Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful. Testing has begun. Please wait 1 minutes for test to complete. Test will complete after Mon Apr 15 22:04:02 2013 Use smartctl -X to abort test. [root@centos ~]# smartctl -X /dev/sda smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.18-348.3.1.el5] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Abort SMART off-line mode self-test routine". Self-testing aborted! 以上、smartctlコマンドの使用方法をいくつか紹介しました。 |