smartctl disk health check in Linux

Let’s see how to obtain the status of a HDD using SMART technology (monitoring and analyzing HD http://es.wikipedia.org/wiki/S.M.A.R.T.).

First we need to install is the smartmontools package (in Red Hat or CentOS so, in other distributions command different):

Source   
yum install smartmontools

We can get information from a disk:

Source   
[root@simba ~]# smartctl -i /dev/sda
smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.32-279.el6.x86_64] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Caviar Green (Adv. Format)
Device Model:     WDC WD20EARS-00MVWB0
Serial Number:    WD-WCAZA2587877
LU WWN Device Id: 5 0014ee 2b003aa9d
Firmware Version: 51.0AB51
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:  Exact ATA specification draft version not indicated
Local Time is:    Mon Jan 14 12:25:40 2013 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

If the SMART support is Disabled, we can enabled with:

Source   
root@zentyal:~# smartctl -s on /dev/sda
smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

A diagnosis failed looks like this:

Source   
[root@simba ~]# smartctl -H /dev/sda
smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.32-279.el6.x86_64] (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: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.
Failed Attributes:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate     0x002f   001   001   051    Pre-fail  Always   FAILING_NOW 330223

As you can see is quite alarming diagnosis in less than 24 hours is predicted failure. The reality is we do not know how long it will last, but must be changed as soon as possible.

OK diagnosis:

Source   
[root@simba ~]# smartctl -H /dev/sda
smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.32-279.el6.x86_64] (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

It is highly recommended to add these consultations to the monitoring system we have, even a simple script.

Leave a Reply