目次
S.M.A.R.T. とは
HDD は、S.M.A.R.T.(Self-Monitoring, Analysis and Reporting Technology 以下SMART) という、障害の早期発見・故障の予測を行うための情報を保有しています。
Self-Monitoring, Analysis and Reporting Technology (セルフモニタリング・アナリシス・アンド・リポーティング・テクノロジー、略称: S.M.A.R.T.; スマート)
は、ハードディスクドライブの障害の早期発見・故障の予測を目的としてハードディスクドライブに搭載されている機能である。この機能は、各種の検査項目をリアルタイムに自己診断し、その状態を数値化する。ユーザーはその数値を各種のツール(後述)を用いることで知ることが出来る。全ての故障を予期することは出来ないが、安定した利用環境における経年劣化による故障を知るには非常に有効である。Self-Monitoring, Analysis and Reporting Technology
https://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology
この情報には、読み込みエラーの回数・不良セクタの数などが含まれており。HDD の障害を早期に発見する為に利用することができます。smartctl コマンドは、SMART情報を取得するツールです。
このコマンドを利用して、HDD の情報をチェックして障害の早期発見を行います。
smartctl コマンドのインストール
smartctl は、以下のコマンドでインストールします。
// Ubuntu の場合 $ sudo apt -y install smartmontools // CentOS の場合 $ sudo yum -y install smartmontools
ディスクのデバイス情報を表示
認識されているディスクの情報を表示します。 $ sudo smartctl --scan /dev/sda -d scsi # /dev/sda, SCSI device /dev/sdb -d scsi # /dev/sdb, SCSI device
使用しているディスクの情報を表示し、SMARTがサポートされているか確認します。
SMART の情報の他にディスクのモデル名、型番、シリア番号、セクタサイズ、ATAバージョンなども分かります
サーポートされている場合は、「SMART support is: Enabled」と表示されます。
$ sudo smartctl -i /dev/sda smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-83-generic] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: Hitachi Deskstar T7K250 Device Model: HDT722525DLAT80 Serial Number: VDL41BT4D9444U LU WWN Device Id: 5 000cca 20bd23a7b Firmware Version: V44OA70A User Capacity: 250,058,268,160 bytes [250 GB] Sector Size: 512 bytes logical/physical Device is: In smartctl database [for details use: -P show] ATA Version is: ATA/ATAPI-7 T13/1532D revision 1 Local Time is: Fri Jul 14 12:32:08 2017 JST SMART support is: Available - device has SMART capability. SMART support is: Enabled <- サポートされている。 // 仮想マシン上のディスクや USB メモリなどは対応していないため、「SMART support is: Unavailable」と表示されます。 $ sudo smartctl -i /dev/sda smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-514.16.1.el7.x86_64] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Device Model: VBOX HARDDISK Serial Number: VBf1f10678-f9251a80 Firmware Version: 1.0 User Capacity: 8,589,934,592 bytes [8.58 GB] Sector Size: 512 bytes logical/physical Device is: Not in smartctl database [for details use: -P showall] ATA Version is: ATA/ATAPI-6 published, ANSI INCITS 361-2002 Local Time is: Fri Jul 14 13:59:35 2017 JST SMART support is: Unavailable - device lacks SMART capability.
ディスクのSMART情報を表示
SMART情報を全て表示します。
$ sudo smartctl -A /dev/sda smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-83-generic] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === 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 099 099 016 Pre-fail Always - 65537 2 Throughput_Performance 0x0005 100 100 050 Pre-fail Offline - 0 3 Spin_Up_Time 0x0007 128 128 024 Pre-fail Always - 270 (Average 275) 4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 676 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 100 100 020 Pre-fail Offline - 0 9 Power_On_Hours 0x0012 089 089 000 Old_age Always - 81061 10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 675 192 Power-Off_Retract_Count 0x0032 097 097 050 Old_age Always - 3943 193 Load_Cycle_Count 0x0012 097 097 050 Old_age Always - 3943 194 Temperature_Celsius 0x0002 127 127 000 Old_age Always - 43 (Min/Max 15/55) 196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0 197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0
各項目の意味は、
https://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology
を参照すると良いでしょう。
smartctlコマンドによるディスクの自己診断
smartctlコマンドの自己診断実行モードは、short , long , conveyance の3種類があります。
short : 簡単なテスト。(1分くらい)
long : 長いテスト。(1〜数時間かかります)
conveyance : 輸送中に障害が起きやすいセクタをテストする。
実行は、バックグラウンドで実行され、終了予定時間が表示されます。
$ sudo smartctl -t long /dev/sda smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-83-generic] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === 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 80 minutes for test to complete. <font color="red">Test will complete after Fri Jul 14 15:42:07 2017 <- 終了予定時間</font> Use smartctl -X to abort test.
ディスクの自己診断結果表示
終了予定時間を過ぎたら -a (long の場合) オプションを使い診断結果を表示します。
$ sudo smartctl -a /dev/sda
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-83-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
:
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 4797) seconds.
Offline data collection
capabilities: (0x5b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 80) minutes.
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 099 099 016 Pre-fail Always - 65538
2 Throughput_Performance 0x0005 100 100 050 Pre-fail Offline - 0
3 Spin_Up_Time 0x0007 128 128 024 Pre-fail Always - 270 (Average 275)
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 676
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 100 100 020 Pre-fail Offline - 0
9 Power_On_Hours 0x0012 089 089 000 Old_age Always - 81063
10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 675
192 Power-Off_Retract_Count 0x0032 097 097 050 Old_age Always - 3943
193 Load_Cycle_Count 0x0012 097 097 050 Old_age Always - 3943
194 Temperature_Celsius 0x0002 130 130 000 Old_age Always - 42 (Min/Max 15/55)
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0
197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0
SMART Error Log Version: 1
No Errors Logged
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% 15527 -
# 2 Short offline Completed without error 00% 15525 -
# 3 Short offline Aborted by host 70% 15525 -
# 4 Short offline Completed without error 00% 15525 -
Warning! SMART Selective Self-Test Log Structure error: invalid SMART checksum.
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
ディスクの自己診断強制停止
診断を途中で終了したい場合は、-X オプションを使います。
$ sudo smartctl -X /dev/sda smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-83-generic] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Abort SMART off-line mode self-test routine". Self-testing aborted!





