Monitor the health of your Hard Drive – Part 1

If you’ve ever lost personal information due to a hard-disk drive failure?  Either way, I advice you to get SMART.

Self-Monitoring, Analysis, and Reporting Technology – Part 1

SMART is a monitoring and reporting system for computer hard disks to detect and report on various indicators of reliability, in the hope of anticipating failures.  In simple terms SMART allows a hard disk to monitor its own health.  To make a comparison,  take the average car, how often have you spotted a red light on your dashboard.  The red light indicates that something is not right e.g. your oil is low!  SMART is your hard drive’s equivalent of a red light on your dashboard.

How does SMART work?

SMART maintains values against a pre-defined set of attributes.  Attributes are available for things such as; “Powered on Hours”, “Uncorrectable Sectors” and “Temperature”; plus lots more.  These attributes can differ from vendor to vendor.  Against each attribute the  values for “Current”, “Worst” and “Threshold” are retained.  These values are used to predict and detect failures.

How does one get SMART?

Most modern hard drives should be SMART enabled.  And there are several software packages that offer SMART monitor tools – Windows user sorry this is Linux only.  In most of the major Linux distribution  this should be as simple as searching your package manager.  I prefer the command line; and thus, use the yum package manager.  On CentOS you would run the command:

yum install smartmontools -y

Right, how can I used SMART?

Before diving in let’s see what  has been installed with the command “rpm -ql smartmontools” e.g.

Content of smartmontools
Contents of smartmontools RPM.

As you can see , the bulk is documentation, man files and examples.  The main command line utility of interest is “/usr/sbin/smartctl”.  This utility allows you to control and monitor SMART attributes.

Let’s get stuck in!  First we’ll ask smartctl to scan for devices and print each device name.  Type “smartctl –scan” e.g.

smartctl scan results
smartctl --scan

The details of each drive can be listed by running the following command:

smartctl -i /dev/sda

The “-i” option informs smartctl to list the information of the device /dev/sda.  If the drive is detected and you have the required privileges to access  the drive the utility should print the drive model, serial, capacity, and smart capability and status e.g. sample output follows.

samrtctl HDD information

The information listed is quite useful, attributes of relevance are the last two.  These settings allow us to determine whether the device is SMART capable.  And, if capable, it also states whether support is currently enabled or disabled.  In this case, the sample output shows the interrogated drive is both SMART capable and SMART enabled.

Part two here.

Advertisements

2 thoughts on “Monitor the health of your Hard Drive – Part 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s