Difference between revisions of "S.M.A.R.T."

From ArchWiki
Jump to: navigation, search
(Smartmontools: Tweak wording.)
(Smartmontools: Further tweak wording.)
Line 5: Line 5:
== Smartmontools ==
== Smartmontools ==
The smartmontools package contains two utility programs {{ic|smartctl}} and {{ic|smartd}} — for analyzing and monitoring storage devices. Install {{Pkg|smartmontools}} from the [[official repositories]].
The smartmontools package contains two utility programs for analyzing and monitoring storage devices: {{ic|smartctl}} and {{ic|smartd}}. Install {{Pkg|smartmontools}} from the [[official repositories]] to use these tools.
=== Detect and enable SMART support ===
=== Detect and enable SMART support ===

Revision as of 03:04, 8 October 2014

S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology) is a supplementary component build into many modern storage devices through which devices monitor, store, and analyze the health of their operation. Statistics are collected (temperature, number of reallocated sectors, seek errors...) which software can use to measure the health of a device, predict possible device failure, and provide notifications on unsafe values.


The smartmontools package contains two utility programs for analyzing and monitoring storage devices: smartctl and smartd. Install smartmontools from the official repositories to use these tools.

Detect and enable SMART support

The --info (or -i) option prints a variety of information about a device, including whether the device supports SMART and whether SMART is enabled. For example:

# smartctl --info /dev/sda | grep 'SMART support is:'
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

You may need to specify a device type. For example, specifying --device=ata tells smartctl that the device type is ATA, and this prevents smartctl from issuing SCSI commands to that device.

If SMART is available but not enabled, you can enable it:

# smartctl --smart=on /dev/<device>

Test the device health

Three type of health tests that can be performed on the device (all are safe to user data):

  1. Short (runs tests that have a high probability of detecting device problems)
  2. Extended (or Long; a short check with complete disk surface examination)
  3. Conveyance (identifies if damage incurred during transportation of the device)

To view the device's available tests and the time it will take to perform each test do:

# smartctl -c /dev/<device>

To run the tests do:

# smartctl -t short /dev/<device>
# smartctl -t long /dev/<device>
# smartctl -t conveyance /dev/<device>
Note: Some disks (e.g. SSDs) may not support all types of test. You can see what your device supports with smartctl --capabilities /dev/<device>


To view the test's overall health status (compiled from all tests):

# smartctl -H /dev/<device>

To view the test's result errors:

# smartctl -l selftest /dev/<device>

To view the test's detailed results:

# smartctl -a /dev/<device>

If no errors are reported the device is likely healthy. If there are a few errors this may or may not indicate a problem and should be investigated further. When a device starts to fail it is recommended to backup the data and replace it.

Monitor devices

Devices can be monitored in the background with use of the smartmontools daemon that will check devices periodically and optionally email any potential problems. To have devices monitored on boot, enable smartd service:

 systemctl enable smartd.service

The smart daemon can be edited for more exact configuration in /etc/smartd.conf.

Tip: /etc/smartd.conf is configured with somewhat esoteric command-line style options. See the comments and examples in the file, and refer to the manpage for a full explanation. What follows are some examples of the monitoring options.

Define the devices to monitor

To monitor most attributes of all disks:


To monitor most attributes of /dev/sda and /dev/sdb, and ignore all other devices:

/dev/sda -a
/dev/sdb -a

Email potential problems

To have an email sent when a failure or new error occurs, use the -m option:

DEVICESCAN -m address@domain.com

To be able to send the email externally (i.e. not to the root mail account) a MTA (Mail Transport Agent) or a MUA (Mail User Agent) will need to be installed and configured. Common MTAs are MSMTP and SSMTP. Common MTUs are sendmail and Postfix. It's enough to simply configure S-nail if you don't want anything else.

The -M test option causes a test email to be sent each time the smartd daemon starts:

DEVICESCAN -m address@domain.com -M test

E-Mail can take quite a long time to be delivered, but when your hard drive fails you want to be informed immediately to take the appropriate actions. Hence you should rather define a script to be executed instead of only emailing the problem:

DEVICESCAN -m address@domain.com -M exec /usr/local/bin/smartdnotify

To send an e-mail and a system notification, put something like this into /usr/local/bin/smartdnotify:

#! /bin/sh

# Send mail

# Notify user

Power management

If you use a computer under control of power management, you should instruct smartd how to handle disks in low power mode. Usually, in response to SMART commands issued by smartd, the disk platters are spun up. So if this option is not used, then a disk which is in a low-power mode may be spun up and put into a higher-power mode when it is periodically polled by smartd.

DEVICESCAN -n standby,15,q

More info on smartmontools wiki.

Schedule self-tests

smartd can tell disks to perform self-tests on a schedule. The following /etc/smartd.conf configuration will start a short self-test every day between 2-3am, and an extended self test weekly on Saturdays between 3-4am:

 DEVICESCAN -s (S/../.././02|L/../../6/03)

Alert on temperature changes

smartd can track disk temperatures and alert if they rise too quickly or hit a high limit. The following will log changes of 4 degrees or more, log when temp reaches 35 degrees, and log/email a warning when temp reaches 40:

 DEVICESCAN -W 4,35,40
Tip: You can determine the current disk temperature with the command smartctl -A /dev/<device> | grep Temperature_Celsius
Tip: If you have some disks that run a lot hotter/cooler than others, remove DEVICESCAN and define a separate configuration for each device with appropriate temperature settings.

Complete smartd.conf example

Putting together all of the above gives the following example configuration:

  • DEVICESCAN (smartd scans for disks and monitors all it finds)
  • -a (monitor all attributes)
  • -o on (enable automatic online data collection)
  • -S on (enable automatic attribute autosave)
  • -n standby,q (don't check if disk is in standby, and supress log message to that effect so as not to cause a write to disk)
  • -s ... (schedule short and long self-tests)
  • -W ... (monitor temperature)
  • -m ... (mail alerts)
 DEVICESCAN -a -o on -S on -n standby,q -s (S/../.././02|L/../../6/03) -W 4,35,40 -m <username or email>

Start/reload the smartd service and check status

 # systemctl start smartd


 # systemctl reload smartd

Check status:

 # systemctl status smartd

Full smartd log:

 # journalctl -u smartd

GUI Applications

  • Gsmartcontrol — A GNOME frontend for the smartctl hard disk drive health inspection tool
http://gsmartcontrol.sourceforge.net || gsmartcontrol or gsmartcontrol-svnAUR