Monitoring Hard Drive Health

linux-penguinModern hard drives often support SMART attributes, which reveal information about the disk current status.  This article describes the process for access this information using a Linux host.


Installation

Start by logging on to your Linux host as an admin user (or use sudo) and run the following command:

# apt-get install smartmontools

 

Information

Now we can start to find out whether SMART is supported on our hard drive by running the following command:

# smartctl -i /dev/sdb

 Here is some example output, note the last two lines:

smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.5.0-39-generic] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Model Family: Western Digital RE4 Serial ATA
Device Model: WDC WD5003ABYX-01WERA1
Serial Number: WD-WMAYP5453158
LU WWN Device Id: 5 0014ee 00385d526
Firmware Version: 01.01S02
User Capacity: 500,107,862,016 bytes [500 GB]
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 Sep 2 14:06:57 2013 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

 

Testing your hard drive

Before running any SMART tests, we will check to see how long they will take.

# smartctl -c /dev/sda

Example output shows the different lengths of time.

Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 83) minutes.
Conveyance self-test routine
recommended polling time: ( 5) minutes.

Here are the commands for running a short or long test:

# smartctl -t <short|long|conveyance|select> /dev/sdb

Note that conveyance is a test that you can run when you first purchase the drive, to see if it has been satisfactorily conveyed to you.

 

Viewing Test Results

To view test results run one of the following commands.  The second command just shows the results.

# smartctl -a /dev/sda
# smartclt -l selftest /dev/sda

Thanks for visiting.