S.M.A.R.T.

From ArchWiki
Revision as of 19:31, 1 February 2011 by Zorglups (Talk | contribs) (Automatically monitor your drives)

Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

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).

Installing

For the command line version:

pacman -S smartmontools

For the GUI version:

pacman -S gsmartcontrol

Disk support

Check if your disk(s) support SMART.

IDE-disks:

smartctl -i /dev/hda

SATA-disks:

smartctl -i -d ata /dev/sda

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:

IDE-disks:

smartctl -s on /dev/hda

SATA-discs:

smartctl -s on -d ata /dev/sda

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:

smartctl -c /dev/<your-hard-disk>

To run the test:

smartctl -t offline /dev/<your-hard-disk>

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:

smartctl -H /dev/sda

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:

smartctl -l error /dev/sda

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.

See the man page for other tests and more information.

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. 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 myuser@gmail.com

To start the daemon:

/etc/rc.d/smartd start

If everything is working as it should, you can add smartd to your DAEMONS array in Template:Filename.

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 myuser@gmail.com -M test

To restart the daemon:

/etc/rc.d/smartd restart

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[2306]: Monitoring 3 ATA and 0 SCSI devices
Feb  1 20:07:11 localhost smartd[2306]: Executing test of mail to myuser@gmail.com ...
Feb  1 20:07:14 localhost smartd[2306]: Test of mail to myuser@gmail.com: successful

Once the test succeeded, do not forget to remove the '-M test' option.

Other tips

Other tips that can help setup smartmontool programs

Get SMART details

You can get all SMART details of your drive with:

IDE-disks:

smartctl -a /dev/hda

SATA-discs:

smartctl -a -d ata /dev/sda

External links