OVH Community, your new community space.

Monitoring disk with smartmontools


alvaroag
26-06-2016, 21:54
Running "smartctl -a /dev/sda" (or changing the device to match any other HDD you have) will give you something like this:

smartctl 6.4 2014-10-07 r4002 [x86_64-linux-4.4.8-1-pve] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model: HGST HUS724040ALA640
Serial Number: NNNNN
LU WWN Device Id: 5 000cca 250cbffce
Firmware Version: MFAOAA70
User Capacity: 4,000,787,030,016 bytes [4.00 TB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 7200 rpm
Form Factor: 3.5 inches
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ATA8-ACS T13/1699-D revision 4
SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Sun Jun 26 13:57:58 2016 PET
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: (0x84) Offline data collection activity
was suspended by an interrupting command from host.
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: ( 24) 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: ( 544) 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 0x000b 100 100 016 Pre-fail Always - 0
2 Throughput_Performance 0x0005 138 138 054 Pre-fail Offline - 76
3 Spin_Up_Time 0x0007 228 228 024 Pre-fail Always - 307 (Average 372)
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 18
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 142 142 020 Pre-fail Offline - 25
9 Power_On_Hours 0x0012 100 100 000 Old_age Always - 6654
10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 18
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 163
193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 163
194 Temperature_Celsius 0x0002 136 136 000 Old_age Always - 44 (Min/Max 20/47)
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 Short offline Completed without error 00% 979 -
# 2 Short offline Completed without error 00% 978 -
# 3 Short offline Completed without error 00% 977 -
# 4 Short offline Completed without error 00% 20 -
# 5 Short offline Completed without error 00% 20 -
# 6 Short offline Completed without error 00% 4 -
# 7 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.
There, you can check the following values:

- Reallocated_Sector_Ct: Should always be zero. When it increments, it's because there are bad sectors which had to be remapped. The higher, the worst. Should be zero in a new HDD.
- Spin_Retry_Count: The accumulated number of spin-up attempts after a first failed attempt. When the spin-up fails, it's due to a failure on the mechanical system of the HDD. The higher, the worst. Should be zero in a new HDD.
- Reallocated_Event_Count: Similar to Reallocated_Sector_Ct, it just counts events instead of sectors. The higher, the worst. Should be zero in a new HDD.
- Current_Pending_Sector: The number of sectors pending to be remapped. Those are in such state due to unrecoverable read errors. The higher, the worst. Should be zero in a new HDD.
- Offline_Uncorrectable: The number of failing sectors that have been marked as offline, that is, the are defective and won't be remapped. The higher, the worst. Should be zero in a new HDD.

Another interesting value is "Power_On_Hours". It should the accumulated number of hours the HDD has been turned on. Based in my experience, HDDs won't last more than 6 years, but may last longer if working under good environment conditions.

Also, another HDDs may report some other values, some of which can also be considered critical. YOu can check a full list of attributes here:

https://en.wikipedia.org/wiki/S.M.A.....T._attributes

Pay special attention to the ones highlighted in red/pink. Those are the critical attributes you want.

ozgurerdogan
26-06-2016, 18:09
I simple want to be informed in case of bad blocks. What do you suggest?

alvaroag
26-06-2016, 18:06
If you use(or will use) an external monitoring solution like Zabbix, check this out: https://share.zabbix.com/storage-dev...rtmontools-lld

If you intend for self-monitoring, check the output of "smartctl -a /dev/sda". You can parse it with shellscript or PHP, and send an email when some parameters are out of bounds.

ozgurerdogan
26-06-2016, 17:48
I want to monitor disk with smartmontools so I can recieve amil before failing. Is there a guide for that?