Self-Monitoring, Analysis, and Reporting Technology, or S.M.A.R.T., is a monitoring system built on some computer hard disks that stores (and on some hard drives detects) various indicators (SMART Attributes) for the hard disks reliability. It does so in the attempt to detect/prevent anticipatory failures.
SMART disks may either need software to update SMART Attributes on the hard drive or will include some built-in self tests to detect and protect the hard drive (see manufacturer details).
This article describes how to install the package smartmontools and use its programs to monitor your hard disk(s).
For the command line version: Template:Cli
For the GUI version: Template:Cli
Check if your disk(s) support SMART.
If it is, you will see:
"SMART support is: Available - device has SMART capability." "SMART support is: Enabled"
If SMART is not enabled you can enable it by:
Test the hard drive
Your SMART hard disk may have built-in self-tests that do some checks to record the state of the hard disk and may optionally protect it from common problems (i.e. bad blocks). If you do not know for certain, have smartctl run tests to update the SMART Attributes on your hard disk.
To know first which tests the device supports: Template:Cli
To run the test: Template:Cli
smartctl will tell you how long the test will take. When it is finished you can check the health status to see if there are any problems.
Health status check
SMART hard disks keep a record of the hard disks health status that can be checked with: Template:Cli
If the hard drive status is healthy it will return the status as: 'PASSED'.
If the device reports a failing health status, it means that the device has either already failed, or is predicting its own failure within the next 24 hours. Append the "-a" option to get more information.
To see if the SMART sensor has detected any errors, look at the SMART Error Log: Template:Cli
If "No Errors Logged" is printed, your hard drive is likely healthy. If there are a few errors this may or may not indicate a problem and you should investigate the matter further. Generally when a drive starts to fail it is best practice to backup its data and replace the hard drive.
Automatically monitor your drives
smartmontools includes a daemon that will check and update your hard disks status and can optionally mail you of any potential problems. The smart daemon can be edited for more exact configuration in Template:Filename.
If the configuration is not edited, smartd will run tests periodically on all possible SMART Attributes on all devices it detects. The first non-commented entry in the configuration file (DEVICESCAN) will have smartd ignore the remaining lines in the configuration file, and will scan for devices. For devices with an ATA Attachment, if no options are configured, the daemon will use the '-a' option by default (monitor all SMART properties) on all hard drives.
In order to have the drives checked only when they are not in standby (hence avoid them to spin up unnecessarily), you may add the following options:
DEVICESCAN -n standby,q -a
To make a configuration for individual devices, you have to comment the line with DEVICESCAN and add a configuration line for every device. Here is an example:
#DEVICESCAN /dev/hda -a -m root@localhost
This will monitor all attributes and send an email to root@localhost if a failure or new error occurs. To be able to send internal mail, you need a mail sender (like SSMTP or Msmtp) installed, or a mail server (MTA Message Transfer Agent) like sendmail or Postfix Local Mail. More examples are given in the configuration file.
Once you can send mails out, you can change the root@localhost by your actual email address:
DEVICESCAN -n standby,q -a -m firstname.lastname@example.org
Last but not least, if you used the -m option to get mail notifications, you should test that the mail alert works fine. To do so, simply add the '-M test' option to the configuration line and restart smartd daemon:
DEVICESCAN -n standby,q -a -m email@example.com -M test
To restart the daemon:
The mail test result can be seen in your mailbox (be a bit patient) but also in Template:Filename :
Feb 1 20:07:11 localhost smartd: Monitoring 3 ATA and 0 SCSI devices Feb 1 20:07:11 localhost smartd: Executing test of mail to firstname.lastname@example.org ... Feb 1 20:07:14 localhost smartd: Test of mail to email@example.com: successful
Once the test succeeded, do not forget to remove the '-M test' option.
Other tips that can help setup smartmontool programs
Get SMART details
You can get all SMART details of your drive with:
smartctl -a /dev/hda
smartctl -a -d ata /dev/sda