To monitor the S.M.A.R.T status of your disk, we suggest to use the smartctl tool, which is part of the smartmontool package (at least on Debian / Ubuntu).
sudo apt install smartmontools
smartctl is a command line tool, but it especially helps in cases where you need to automate the collection of data, for example, from your servers.
The first step in using of smartctl is to check if S.M.A.R.T is on your drive and if it is supported by the tool:
sh$ sudo smartctl -i /dev/sdb smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: Seagate Momentus 7200.4 Device Model: ST9500420AS Serial Number: 5VJAS7FL LU WWN Device Id: 5 000c50 02fa0b800 Firmware Version: D005SDM1 User Capacity: 500,107,862,016 bytes [500 GB] Sector Size: 512 bytes logical/physical Rotation Rate: 7200 rpm Device is: In smartctl database [for details use: -P show] ATA Version is: ATA8-ACS T13/1699-D revision 4 SATA Version is: SATA 2.6, 3.0 Gb/s Local Time is: Mon Mar 12 15:54:43 2018 CET SMART support is: Available - device has SMART capability. SMART support is: Enabled
As you can see, our laptop’s internal hard drive really supports S.M.A.R.T. and it is launched. So, how to get the S.M.A.R.T status now? Are there any fixed errors?
Getting a report about “the entire S.M.A.R.T. disk information “is the option a:
sh$ sudo smartctl -i -a /dev/sdb smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: Seagate Momentus 7200.4 Device Model: ST9500420AS Serial Number: 5VJAS7FL LU WWN Device Id: 5 000c50 02fa0b800 Firmware Version: D005SDM1 User Capacity: 500,107,862,016 bytes [500 GB] Sector Size: 512 bytes logical/physical Rotation Rate: 7200 rpm Device is: In smartctl database [for details use: -P show] ATA Version is: ATA8-ACS T13/1699-D revision 4 SATA Version is: SATA 2.6, 3.0 Gb/s Local Time is: Mon Mar 12 15:56:58 2018 CET 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 See vendor-specific Attribute list for marginal Attributes. General SMART Values: Offline data collection status: (0x82) Offline data collection activity was completed without error. Auto Offline Data Collection: Enabled. 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: ( 0) seconds. Offline data collection capabilities: (0x7b) SMART execute Offline immediate. Auto Offline data collection on/off support. Suspend Offline collection upon new command. Offline surface scan supported. Self-test supported. 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: ( 2) minutes. Extended self-test routine recommended polling time: ( 110) minutes. Conveyance self-test routine recommended polling time: ( 3) minutes. SCT capabilities: (0x103f) SCT Status supported. SCT Error Recovery Control supported. SCT Feature Control supported. SCT Data Table supported. SMART Attributes Data Structure revision number: 10 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x000f 111 099 006 Pre-fail Always - 29694249 3 Spin_Up_Time 0x0003 100 098 085 Pre-fail Always - 0 4 Start_Stop_Count 0x0032 095 095 020 Old_age Always - 5413 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 3 7 Seek_Error_Rate 0x000f 071 060 030 Pre-fail Always - 51710773327 9 Power_On_Hours 0x0032 070 070 000 Old_age Always - 26423 10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 096 037 020 Old_age Always - 4836 184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0 187 Reported_Uncorrect 0x0032 072 072 000 Old_age Always - 28 188 Command_Timeout 0x0032 100 096 000 Old_age Always - 4295033738 189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0 190 Airflow_Temperature_Cel 0x0022 056 042 045 Old_age Always In_the_past 44 (Min/Max 21/44 #22) 191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 184 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 104 193 Load_Cycle_Count 0x0032 001 001 000 Old_age Always - 395415 194 Temperature_Celsius 0x0022 044 058 000 Old_age Always - 44 (0 13 0 0 0) 195 Hardware_ECC_Recovered 0x001a 050 045 000 Old_age Always - 29694249 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 1 198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 1 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0 240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 25131 (246 202 0) 241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 3028413736 242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 1613088055 254 Free_Fall_Sensor 0x0032 100 100 000 Old_age Always - 0 SMART Error Log Version: 1 ATA Error Count: 3 CR = Command Register [HEX] FR = Features Register [HEX] SC = Sector Count Register [HEX] SN = Sector Number Register [HEX] CL = Cylinder Low Register [HEX] CH = Cylinder High Register [HEX] DH = Device/Head Register [HEX] DC = Device Command Register [HEX] ER = Error register [HEX] ST = Status register [HEX] Powered_Up_Time is measured from power on, and printed as DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes, SS=sec, and sss=millisec. It "wraps" after 49.710 days. Error 3 occurred at disk power-on lifetime: 21171 hours (882 days + 3 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 40 51 00 ff ff ff 0f Error: UNC at LBA = 0x0fffffff = 268435455 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- 60 00 08 ff ff ff 4f 00 00:45:12.580 READ FPDMA QUEUED 60 00 08 ff ff ff 4f 00 00:45:12.580 READ FPDMA QUEUED 60 00 08 ff ff ff 4f 00 00:45:12.579 READ FPDMA QUEUED 60 00 08 ff ff ff 4f 00 00:45:12.571 READ FPDMA QUEUED 60 00 20 ff ff ff 4f 00 00:45:12.543 READ FPDMA QUEUED Error 2 occurred at disk power-on lifetime: 21171 hours (882 days + 3 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 40 51 00 ff ff ff 0f Error: UNC at LBA = 0x0fffffff = 268435455 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- 60 00 00 ff ff ff 4f 00 00:45:09.456 READ FPDMA QUEUED 60 00 00 ff ff ff 4f 00 00:45:09.451 READ FPDMA QUEUED 61 00 08 ff ff ff 4f 00 00:45:09.450 WRITE FPDMA QUEUED 60 00 00 ff ff ff 4f 00 00:45:08.878 READ FPDMA QUEUED 60 00 00 ff ff ff 4f 00 00:45:08.856 READ FPDMA QUEUED Error 1 occurred at disk power-on lifetime: 21131 hours (880 days + 11 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 40 51 00 ff ff ff 0f Error: UNC at LBA = 0x0fffffff = 268435455 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- 60 00 00 ff ff ff 4f 00 05:52:18.809 READ FPDMA QUEUED 61 00 00 7e fb 31 45 00 05:52:18.806 WRITE FPDMA QUEUED 60 00 00 ff ff ff 4f 00 05:52:18.571 READ FPDMA QUEUED ea 00 00 00 00 00 a0 00 05:52:18.529 FLUSH CACHE EXT 61 00 08 ff ff ff 4f 00 05:52:18.527 WRITE FPDMA QUEUED 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% 10904 - # 2 Short offline Completed without error 00% 12 - # 3 Short offline Completed without error 00% 0 - 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.
Understanding of the smartctl command output
On the output you usually receive a lot of information that is not always easy to understand. The most interesting part is probably the part labeled “Vendor Specific SMART Attributes with Thresholds”. She reports various statistics collected by S.M.A.R.T. device, and allows you to compare these values (current or worst for all time) with a certain threshold defined by the supplier.
For example, here are our reports about reassigned sectors on disk:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 3
You may notice the “Pre-fail” attribute. It means the value is abnormal. Thus, if the value exceeds the threshold, the probability of failure is high. Another category of “Old_age” is used for attributes that correspond to the values of “normal wear”.
The last field (here with a value of “3”) corresponds to the original attribute value that the drive reports. Usually this number has a physical meaning. Here is the actual number of reassigned sectors. For other attributes, this may be temperature in Celsius degrees, time in hours or minutes, or number of times that a certain condition has been met for a disk.
In addition to the original value, the S.M.A.R.T. should report “normalized values” (field values, the worst and threshold). These values are normalized in the range of 1-254 (0-255 for threshold values). The firmware of the disk performs this normalization using some internal algorithm. In addition, different manufacturers can normalize the same attribute in different ways. Most values are presented as a percentage, and as higher as better, but this is not always like this. When the parameter is lower than or equal to the threshold value specified by the manufacturer, the disk is considered faulty in terms of this attribute. Keeping in mind all the instructions from the first part of the article: if the attribute showing the “pre-fail” value still failed, it is most likely that the disk will soon fail.
As a second example, let’s take the “seek error rate”:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 7 Seek_Error_Rate 0x000f 071 060 030 Pre-fail Always - 51710773327
In fact, (and this is the main reporting problem of S.M.A.R.T.), only the provider understands the exact value of the fields of each attribute. In our case, Seagate uses a logarithmic scale to normalize the value. Thus, “71” means approximately one error per 10 million requests. It’s funny that the worst indicator of all time was one error per 1 million requests.
If we understand correctly, this means that the heads of our disk are now located more accurately than before. We did not closely monitor this disc, so analyze the data obtained very subjectively. Perhaps the drive just had to be a little readier since it was put into operation? Or maybe this is a consequence of the mechanical wear of the parts and, therefore, there is now less friction? In any case, whatever the reason, this value is more a measure of performance than an early warning of an error. So it doesn’t bother us much.
In addition to the above and three extremely suspicious errors recorded about six months ago, this disk is in surprisingly good condition (according to S.M.A.R.T.) for a laptop’s stock disk that has worked for more than 1100 days (26423 hours).
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 9 Power_On_Hours 0x0032 070 070 000 Old_age Always - 26423
For interest, we conducted the same test on a much newer laptop equipped with SSD:
sh$ sudo smartctl -i /dev/sdb smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.10.0-32-generic] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Device Model: TOSHIBA THNSNK256GVN8 Serial Number: 17FS131LTNLV LU WWN Device Id: 5 00080d 9109b2ceb Firmware Version: K8XA4103 User Capacity: 256 060 514 304 bytes [256 GB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: Solid State Device Form Factor: M.2 Device is: Not in smartctl database [for details use: -P showall] ATA Version is: ACS-3 (minor revision not indicated) SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Tue Mar 13 01:03:23 2018 CET SMART support is: Available - device has SMART capability. SMART support is: Enabled
The first thing that catches your eye is that despite the presence of S.M.A.R.T., the device is not in the smartctl database. But this doesn’t prevent the tool from collecting data from the SSD, however, it will not be able to report the exact values of the various attributes specific to the provider:
sh$ sudo smartctl -a /dev/sdb smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.10.0-32-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: ( 120) 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: ( 2) minutes. Extended self-test routine recommended polling time: ( 11) minutes. SCT capabilities: (0x003d) SCT Status supported. SCT Error Recovery Control supported. SCT Feature Control supported. SCT Data Table supported. 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 0x000a 100 100 000 Old_age Always - 0 2 Throughput_Performance 0x0005 100 100 050 Pre-fail Offline - 0 3 Spin_Up_Time 0x0007 100 100 050 Pre-fail Always - 0 5 Reallocated_Sector_Ct 0x0013 100 100 050 Pre-fail Always - 0 7 Unknown_SSD_Attribute 0x000b 100 100 050 Pre-fail Always - 0 8 Unknown_SSD_Attribute 0x0005 100 100 050 Pre-fail Offline - 0 9 Power_On_Hours 0x0012 100 100 000 Old_age Always - 171 10 Unknown_SSD_Attribute 0x0013 100 100 050 Pre-fail Always - 0 12 Power_Cycle_Count 0x0012 100 100 000 Old_age Always - 105 166 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 0 167 Unknown_Attribute 0x0022 100 100 000 Old_age Always - 0 168 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 0 169 Unknown_Attribute 0x0013 100 100 010 Pre-fail Always - 100 170 Unknown_Attribute 0x0013 100 100 010 Pre-fail Always - 0 173 Unknown_Attribute 0x0012 200 200 000 Old_age Always - 0 175 Program_Fail_Count_Chip 0x0013 100 100 010 Pre-fail Always - 0 192 Power-Off_Retract_Count 0x0012 100 100 000 Old_age Always - 18 194 Temperature_Celsius 0x0023 063 032 020 Pre-fail Always - 37 (Min/Max 11/68) 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0 240 Unknown_SSD_Attribute 0x0013 100 100 050 Pre-fail Always - 0 SMART Error Log Version: 1 No Errors Logged SMART Self-test log structure revision number 1 No self-tests have been logged. [To run self-tests, use: smartctl -t] 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.
Above you see the output of a brand new SSD. The data is understandable even if there is no normalization or meta-information for the data of a particular provider, as in our case with “Unknown_SSD_Attribute.”We can only hope that in future versions of smartctl the data on this disk model will appear in the database, and we will be able to better identify potential problems .
Test your SSD on Linux with smartctl
So far, we have reviewed the data collected during normal drive operation. However, the S.M.A.R.T. protocol also supports several commands for offline testing to run on-demand diagnostics.
Offline testing may be performed during normal disk operations, unless otherwise specified. Because the test and host I / O requests will compete, disk performance will drop during the test. Specification of S.M.A.R.T. defines several types of offline testing:
Short autonomous testing (-t short)
Such a test will check the electrical and mechanical performance, as well as disk read performance. Short autonomous testing usually takes only a few minutes (usually from 2 to 10).
Extended autonomous testing (-t long)
This test takes almost twice as much time. This is usually just a more detailed version of a short -t test. In addition, this test will scan the entire surface of the disk for data errors without a time limit. The duration of the test will be proportional to the size of the disk.
Autonomous Shipping Testing (-t conveyance)
This test kit is proposed as a relatively quick way to check for possible damage that occurred during transportation of the device.
Here are examples taken from the same drives that were above. We suggest you guess where is which one:
sh$ sudo smartctl -a /dev/sdb smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.10.0-32-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: ( 120) 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: ( 2) minutes. Extended self-test routine recommended polling time: ( 11) minutes. SCT capabilities: (0x003d) SCT Status supported. SCT Error Recovery Control supported. SCT Feature Control supported. SCT Data Table supported. 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 0x000a 100 100 000 Old_age Always - 0 2 Throughput_Performance 0x0005 100 100 050 Pre-fail Offline - 0 3 Spin_Up_Time 0x0007 100 100 050 Pre-fail Always - 0 5 Reallocated_Sector_Ct 0x0013 100 100 050 Pre-fail Always - 0 7 Unknown_SSD_Attribute 0x000b 100 100 050 Pre-fail Always - 0 8 Unknown_SSD_Attribute 0x0005 100 100 050 Pre-fail Offline - 0 9 Power_On_Hours 0x0012 100 100 000 Old_age Always - 171 10 Unknown_SSD_Attribute 0x0013 100 100 050 Pre-fail Always - 0 12 Power_Cycle_Count 0x0012 100 100 000 Old_age Always - 105 166 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 0 167 Unknown_Attribute 0x0022 100 100 000 Old_age Always - 0 168 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 0 169 Unknown_Attribute 0x0013 100 100 010 Pre-fail Always - 100 170 Unknown_Attribute 0x0013 100 100 010 Pre-fail Always - 0 173 Unknown_Attribute 0x0012 200 200 000 Old_age Always - 0 175 Program_Fail_Count_Chip 0x0013 100 100 010 Pre-fail Always - 0 192 Power-Off_Retract_Count 0x0012 100 100 000 Old_age Always - 18 194 Temperature_Celsius 0x0023 063 032 020 Pre-fail Always - 37 (Min/Max 11/68) 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0 240 Unknown_SSD_Attribute 0x0013 100 100 050 Pre-fail Always - 0 SMART Error Log Version: 1 No Errors Logged SMART Self-test log structure revision number 1 No self-tests have been logged. [To run self-tests, use: smartctl -t] 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.
A check is in progress. Let’s wait for completion to see the result:
sh$ sudo sh -c 'sleep 120 && smartctl -l selftest /dev/sdb' smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.10.0-32-generic] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === 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% 171 -
Let’s run the same test on another drive:
sh$ sudo smartctl -t short /dev/sdb smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (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 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 2 minutes for test to complete. Test will complete after Mon Mar 12 21:59:39 2018 Use smartctl -X to abort test.
And again, we’ll send it to sleep for two minutes and see the result:
sh$ sudo sh -c 'sleep 120 && smartctl -l selftest /dev/sdb' smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === 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% 26429 - # 2 Short offline Completed without error 00% 10904 - # 3 Short offline Completed without error 00% 12 - # 4 Short offline Completed without error 00% 0 -
Interestingly, that in this case we see that the manufacturers of the disk and the computer seem to have already tested the disk (at a life time of 0 hours and 12 hours). We our self were definitely much less concerned about the condition of the drive than they are. So, since we already showed quick tests, we’ll run the advanced one too to see how this happens.
sh$ sudo smartctl -t long /dev/sdb smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (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 110 minutes for test to complete. Test will complete after Tue Mar 13 00:09:08 2018 Use smartctl -X to abort test.
Well, this time it will take much longer to wait than during a short test. So let’s see:
sh$ sudo bash -c 'sleep $((110*60)) && smartctl -l selftest /dev/sdb' [sudo] password for sylvain: smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === 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: read failure 20% 26430 810665229 # 2 Short offline Completed without error 00% 26429 - # 3 Short offline Completed without error 00% 10904 - # 4 Short offline Completed without error 00% 12 - # 5 Short offline Completed without error 00% 0 -
In the last test, note the difference in the results obtained with the short and extended tests, even if they were performed one after the other. Well, maybe this drive is not in such a good condition! We note that the test stopped after the first reading error. Therefore, if you want to get comprehensive information about all reading errors, you will have to continue the test after each error. We urge you to take a look at one very well written smartctl (8) manual page for more information on the -t select, N-max, and -t select options to be able to do this:
sh$ sudo smartctl -t select,810665230-max /dev/sdb smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (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 Selective self-test routine immediately in off-line mode". SPAN STARTING_LBA ENDING_LBA 0 810665230 976773167 Drive command "Execute SMART Selective self-test routine immediately in off-line mode" successful. Testing has begun.
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org === 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 Selective offline Completed without error 00% 26432 - # 2 Extended offline Completed: read failure 20% 26430 810665229 # 3 Short offline Completed without error 00% 26429 - # 4 Short offline Completed without error 00% 10904 - # 5 Short offline Completed without error 00% 12 - # 6 Short offline Completed without error 00% 0 -
Summary
Definitely S.M.A.R.T. – is exactly the technology that should be added to your toolkit for monitoring the health of your server drives. You should also take a look at S.M.A.R.T. Disk Monitoring Daemon smartd (8), which can help you automate monitoring by using syslog reports.
Due to the statistical nature of failure forecasting, we are not sure if the aggressive S.M.A.R.T. monitoring will be very useful on personal computers. Remember that no matter what kind of the drive is it, one day it will fail anyway – and, as we saw earlier, in one third of cases it will do so without any warning. Therefore, nothing will ensure the integrity of your data better than RAID technology and backups!