How to check hard-drive's health status in Linux

SMART or Self-Monitoring, Analysis, and Reporting Technology is used to monitor the hard drives for reliability. Hard drive's failure can be anticipated and appropriate action can be taken before the hard drive fail completely.

To check your hard drive's health status in Linux, the tool smartctl can be used. It is available in the smartmontools package, and in Ubuntu running the command at the terminal will install the package

sudo apt-get install smartmontools

Assuming your hard drive is /dev/sda, running the following command will return the SMART's health status of your hard drive

sudo smartctl -H /dev/sda

A healthy hard drive will return the following output

smartctl 5.40 2010-03-16 r3077 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

The following is an example output of a problematic hard drive

smartctl 5.40 2010-03-16 r3077 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

Log Sense failed, IE page [scsi response fails sanity test]