Open Source

Tech Tip: Monitor Linux hard drives with SMART technology

Learn how to monitor Linux hard drives with SMART technology.

Most hard drives currently come equipped with SMART (Self-Monitoring Analysis and Reporting Technology) systems, which enable the drive to monitor itself to help determine problems and provide early warnings to failures. However, you must first be able to take advantage of this technology in order to reap the benefits, which you can do using the smartmontools suite.

This suite of tools allows you to run internal SMART tests and view the results, which can provide invaluable early warning to failing drives.

Many Linux distributions come with smartmontools. However, it's easy to compile and install if your distribution didn't come with it. To determine the status of SMART self-testing, execute smartctl as shown below:

# smartctl -l selftest /dev/hda

This displays the results of the /dev/hda drive's SMART self-tests. If results display nothing, it means that the system has executed no tests.

There are two types of tests: The short test, which takes a few minutes to complete, and the long test, which can take up to an hour depending on the drive. To test your drive, execute the following:

# smartctl -t short /dev/hda

To perform a long test, replace short with long in the command. These tests don't impact the running system or corrupt data, so you can schedule regular tests via cron if you prefer.

Once the tests have completed, you can run the selftest command again to view the status of the drive. You can also obtain information about the drive by executing the following:

# smartctl -i /dev/hda

This tells you if the drive is SMART-capable and provides device information, including serial numbers, firmware revisions, model, and more. For a quick overview of the drive's health, use the following:

# smartctl -H /dev/hda

This prints the overall health assessment of the drive, which will hopefully say PASSED.

Editor's Picks

Free Newsletters, In your Inbox