逆引きUNIXコマンド/smartctlコマンドを使ってみる
の編集
Top
/
逆引きUNIXコマンド
/
smartctlコマンドを使ってみる
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
(no template pages)
#navi(../) * smartctlコマンドを使ってみる [#q4f79b04] CentOS5にUSB接続したハードディスクの調子が悪そうでsmartctlコマンドを使ってハードディスクを調査、診断してみました。~ 以下に備忘録としてsmartctlコマンドについて記述します。~ #contents #htmlinsertpcsp(linux_ads_top.html,linux-sp.html) * smartctlコマンドを使用した経緯 [#p3e4d4fa] Logwatcherから以下のようなメールが届いていました。~ SmartdからWarningsを知らせるメッセージです。 --------------------- 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>http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology]]について [#f63cb721] [[S.M.A.R.T>http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology]]に対応しているハードディスクは温度・不良セクタ数等などを検査することができます。~ これにより、故障の早期発見などに役立ちます。 - [[S.M.A.R.T>http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology]]~ http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology (Wikipedia) * 関連資料 [#j430f53f] Windows向けの資料ですが、[[S.M.A.R.T>http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology]]について記述した資料です。 -[[ハードディスクの異常がわかりやすい診断ソフト(HDD Smart Analyzer)>http://win.just4fun.biz/%E3%83%8F%E3%83%BC%E3%83%89%E3%82%A6%E3%82%A7%E3%82%A2%E9%96%A2%E9%80%A3/%E3%83%8F%E3%83%BC%E3%83%89%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E3%81%AE%E7%95%B0%E5%B8%B8%E3%81%8C%E3%82%8F%E3%81%8B%E3%82%8A%E3%82%84%E3%81%99%E3%81%84%E8%A8%BA%E6%96%AD%E3%82%BD%E3%83%95%E3%83%88%28HDD%20Smart%20Analyzer%29.html]] -[[ハードディスク・SSDの健康診断ソフト>http://win.just4fun.biz/%E3%83%8F%E3%83%BC%E3%83%89%E3%82%A6%E3%82%A7%E3%82%A2%E9%96%A2%E9%80%A3/%E3%83%8F%E3%83%BC%E3%83%89%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E3%83%BBSSD%E3%81%AE%E5%81%A5%E5%BA%B7%E8%A8%BA%E6%96%AD%E3%82%BD%E3%83%95%E3%83%88.html]] * smartctlを使ってみる [#o1f4dcec] いくつかのオプションを使用してsmartctlコマンドを使ってみました。~ 以下にsmartctlコマンドの使用例を記します。~ 尚、以下の操作はrootユーザにて作業しました。 ** ハードディスクの情報の取得 -aオプション [#hf7cde00] デバイス(ハードディスク)の情報を取得します。~ 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オプション [#z41038aa] オプション-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を利用したセルフテスト [#ne9f8759] + rootにて-t shortでsmartctlコマンドを実行したときの出力です。~ [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 18:36:23 2013 Use smartctl -X to abort test. + 一分待ってくださいと出力されたので、shortテストが終わるまで待ちます。~ (終了メッセージが表示されないので、指定された時間を待つことにします。) #br + オプション-Hを使用しステータスを表示する。~ PASSEDが表示されているのが確認できます。 [root@centos5 ~]# smartctl -h <省略> -H, --health Show device SMART health status <省略> #br [root@centos ~]# smartctl -H /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 READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED + オプション-lを指定して結果を確認する。 [root@centos5 ~]# smartctl -h <省略> -l TYPE, --log=TYPE Show device log. TYPE: error, selftest, selective, directory[,g|s], xerror[,N][,error], xselftest[,N][,selftest], background, sasphy[,reset], sataphy[,reset], scttemp[sts,hist], scttempint,N[,p], scterc[,N,M], devstat[,N], ssd, gplog,N[,RANGE], smartlog,N[,RANGE] <省略> #br [root@centos ~]# smartctl -l selftest /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 READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Short offline Completed without error 00% 22171 - # 2 Extended offline Aborted by host 90% 22171 - # 3 Extended offline Aborted by host 90% 22171 - # 4 Short offline Completed without error 00% 22171 - *** longを利用したセルフテスト [#m2ec7449] 上記と同様にshortをlongに変更してsmartctlコマンドを実行します。~ &color(red){結構時間がかかります。dfコマンドで確認したところ450Gのディスクで131分と出力されました。)}; [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 ~]# #br + 上記で指定された時間(時刻)まで待ちます。 + 以下のコマンドでセルフテストの詳細な結果を出力することができます。 smartctl -l selftest /dev/hda + 実際に上記コマンドを実行したときの出力です。 [root@centos5 ~]# smartctl -l selftest /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 READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Extended offline Completed without error 00% 18006 - # 2 Short offline Completed without error 00% 18004 - # 3 Short offline Completed without error 00% 18004 - # 4 Short offline Aborted by host 70% 18004 - # 5 Short offline Completed without error 00% 18003 - ** セルフテストを中止する [#q6f365dc] 上記で-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コマンドの使用方法をいくつか紹介しました。 #htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
タイムスタンプを変更しない
#navi(../) * smartctlコマンドを使ってみる [#q4f79b04] CentOS5にUSB接続したハードディスクの調子が悪そうでsmartctlコマンドを使ってハードディスクを調査、診断してみました。~ 以下に備忘録としてsmartctlコマンドについて記述します。~ #contents #htmlinsertpcsp(linux_ads_top.html,linux-sp.html) * smartctlコマンドを使用した経緯 [#p3e4d4fa] Logwatcherから以下のようなメールが届いていました。~ SmartdからWarningsを知らせるメッセージです。 --------------------- 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>http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology]]について [#f63cb721] [[S.M.A.R.T>http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology]]に対応しているハードディスクは温度・不良セクタ数等などを検査することができます。~ これにより、故障の早期発見などに役立ちます。 - [[S.M.A.R.T>http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology]]~ http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology (Wikipedia) * 関連資料 [#j430f53f] Windows向けの資料ですが、[[S.M.A.R.T>http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology]]について記述した資料です。 -[[ハードディスクの異常がわかりやすい診断ソフト(HDD Smart Analyzer)>http://win.just4fun.biz/%E3%83%8F%E3%83%BC%E3%83%89%E3%82%A6%E3%82%A7%E3%82%A2%E9%96%A2%E9%80%A3/%E3%83%8F%E3%83%BC%E3%83%89%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E3%81%AE%E7%95%B0%E5%B8%B8%E3%81%8C%E3%82%8F%E3%81%8B%E3%82%8A%E3%82%84%E3%81%99%E3%81%84%E8%A8%BA%E6%96%AD%E3%82%BD%E3%83%95%E3%83%88%28HDD%20Smart%20Analyzer%29.html]] -[[ハードディスク・SSDの健康診断ソフト>http://win.just4fun.biz/%E3%83%8F%E3%83%BC%E3%83%89%E3%82%A6%E3%82%A7%E3%82%A2%E9%96%A2%E9%80%A3/%E3%83%8F%E3%83%BC%E3%83%89%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E3%83%BBSSD%E3%81%AE%E5%81%A5%E5%BA%B7%E8%A8%BA%E6%96%AD%E3%82%BD%E3%83%95%E3%83%88.html]] * smartctlを使ってみる [#o1f4dcec] いくつかのオプションを使用してsmartctlコマンドを使ってみました。~ 以下にsmartctlコマンドの使用例を記します。~ 尚、以下の操作はrootユーザにて作業しました。 ** ハードディスクの情報の取得 -aオプション [#hf7cde00] デバイス(ハードディスク)の情報を取得します。~ 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オプション [#z41038aa] オプション-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を利用したセルフテスト [#ne9f8759] + rootにて-t shortでsmartctlコマンドを実行したときの出力です。~ [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 18:36:23 2013 Use smartctl -X to abort test. + 一分待ってくださいと出力されたので、shortテストが終わるまで待ちます。~ (終了メッセージが表示されないので、指定された時間を待つことにします。) #br + オプション-Hを使用しステータスを表示する。~ PASSEDが表示されているのが確認できます。 [root@centos5 ~]# smartctl -h <省略> -H, --health Show device SMART health status <省略> #br [root@centos ~]# smartctl -H /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 READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED + オプション-lを指定して結果を確認する。 [root@centos5 ~]# smartctl -h <省略> -l TYPE, --log=TYPE Show device log. TYPE: error, selftest, selective, directory[,g|s], xerror[,N][,error], xselftest[,N][,selftest], background, sasphy[,reset], sataphy[,reset], scttemp[sts,hist], scttempint,N[,p], scterc[,N,M], devstat[,N], ssd, gplog,N[,RANGE], smartlog,N[,RANGE] <省略> #br [root@centos ~]# smartctl -l selftest /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 READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Short offline Completed without error 00% 22171 - # 2 Extended offline Aborted by host 90% 22171 - # 3 Extended offline Aborted by host 90% 22171 - # 4 Short offline Completed without error 00% 22171 - *** longを利用したセルフテスト [#m2ec7449] 上記と同様にshortをlongに変更してsmartctlコマンドを実行します。~ &color(red){結構時間がかかります。dfコマンドで確認したところ450Gのディスクで131分と出力されました。)}; [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 ~]# #br + 上記で指定された時間(時刻)まで待ちます。 + 以下のコマンドでセルフテストの詳細な結果を出力することができます。 smartctl -l selftest /dev/hda + 実際に上記コマンドを実行したときの出力です。 [root@centos5 ~]# smartctl -l selftest /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 READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Extended offline Completed without error 00% 18006 - # 2 Short offline Completed without error 00% 18004 - # 3 Short offline Completed without error 00% 18004 - # 4 Short offline Aborted by host 70% 18004 - # 5 Short offline Completed without error 00% 18003 - ** セルフテストを中止する [#q6f365dc] 上記で-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コマンドの使用方法をいくつか紹介しました。 #htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
テキスト整形のルールを表示する