A) Installation

To install smartmontools please type the following:

-Debian and Ubuntu-

apt-get install smartmontools

-CentOS-

yum install smartmontools

The above commands will install smartmontools on your system.

 

B) How to use smartmontools

First, you have to determine the label of your disks. To do so please type the following:

fdisk -l

It will look similar to this:

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 19269 154778211 83 Linux
/dev/sda2 19270 19457 1510110 5 Extended
/dev/sda5 19270 19457 1510078+ 82 Linux swap / Solaris
system1:~#

In this case, the disk has the label '/dev/hda'. Apart from "hdX", you will often encounter "sdX". It does not make sense to use smartmontools to test a RAID array (/dev/md0, for example).

With the information on the disk's label, we can start smartctl as follows:

smartctl -a /dev/hda

The output will look something like this:

system1:~# smartctl -a /dev/hda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model: ST3160022ACE
Serial Number: 5JS3XTZX
Firmware Version: 9.01
User Capacity: 160,041,885,696 bytes
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 6

ATA Standard is: ATA/ATAPI-6 T13 1410D revision 2
Local Time is: Tue Apr 8 18:58:44 2008 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Disabled

SMART Disabled. Use option -s with argument 'on' to enable it.
system1:~#

 

SMART is disabled in this example. To enable it, please type:

smartctl -s on -a /dev/hda

The output will be a detailed report of your disk's current status and health, that would look similar to this:

system1:~# smartctl -s on -a /dev/hda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model: ST3160022ACE
Serial Number: 5JS3XTZX
Firmware Version: 9.01
User Capacity: 160,041,885,696 bytes
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 6
ATA Standard is: ATA/ATAPI-6 T13 1410D revision 2
Local Time is: Tue Apr 8 18:59:14 2008 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Disabled

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART 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.
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: (15556) 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: ( 111) minutes.

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 059 056 006 Pre-fail Always - 163692057
3 Spin_Up_Time 0x0003 096 096 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 0
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 100 253 030 Pre-fail Always - 722959
9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 55
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 37
194 Temperature_Celsius 0x0022 039 046 000 Old_age Always - 39
195 Hardware_ECC_Recovered 0x001a 059 056 000 Old_age Always - 163692057
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 200 199 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0000 100 253 000 Old_age Offline - 0
202 TA_Increase_Count 0x0032 100 253 000 Old_age Always - 0

SMART Error Log Version: 1
ATA Error Count: 0
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.

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.

system1:~#

In this example, the disk is currently healthy and has no recorded errors. All important values have been highlighted in orange in this example for your convenience. To find out more about the capabilities of smartmontools, please refer to the smartctl manual page by typing:

man smartctl

Some S.M.A.R.T. values you should look out for:

Reallocated_Sector_Count

Anything else than '0' is bad. The severity of the disk damage depends on when the drive got the reallocated sectors and how long ago. If the last bad sector was reallocated one year ago the disk is in no immediate danger, as the problem has appeared, been fixed, and has not come back. If a bad sector shows up, you will likely get more over time and the general statistic is that a disk that starts to get bad sectors will be defective within six months.

Current_Pending_Sector

This means that sectors are awaiting an upcoming recheck to see if there is a problem. One encounters these when the operating system is broken and the disk already has a few bad sectors.

Offline_Uncorrectable

The disk is most likely in a bad health state, but this only becomes certain with more writes.

UDMA_CRC_Count

This can be a serious problem and is generally due to defective cables. Simply replacing the cable will be sufficient since the hard disk itself is not affected. If the data cable has been checked and the error persists, there are only a couple of other options. The motherboard or disk is causing 'soft faults'. We recommend having your server checked completely in this case.

Please keep in mind that using smartmontools or memtest on a VPS will always show wrong results, due to the fact that the hardware is per definition virtualized. Rest assured that we will always check the health of all disks on the VPS host systems. You will not need to check this for yourself.

Was this answer helpful? 0 Users Found This Useful (0 Votes)