Difference between revisions of "S.M.A.R.T."
(→Monitor devices) |
(→Test the device health) |
||
(16 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Storage]] | [[Category:Storage]] | ||
− | 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 | + | 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. |
== Smartmontools == | == Smartmontools == | ||
− | The smartmontools package contains two utility programs ({{ic|smartctl}} and {{ic|smartd}}) to analyze and monitor storage devices. Install {{Pkg|smartmontools}} from the official repositories. | + | The smartmontools package contains two utility programs ({{ic|smartctl}} and {{ic|smartd}}) to analyze and monitor storage devices. Install {{Pkg|smartmontools}} from the [[Official Repositories|official repositories]]. |
=== Detect if device has SMART support === | === Detect if device has SMART support === | ||
Line 12: | Line 12: | ||
# smartctl -i /dev/<device> | # smartctl -i /dev/<device> | ||
− | (where <device> is {{ic|sda, hda,...}}). This | + | (where <device> is {{ic|sda, hda,...}}). This will give general information about the device, the last two lines will show if it is supported: |
SMART support is: Available - device has SMART capability. | SMART support is: Available - device has SMART capability. | ||
Line 25: | Line 25: | ||
Three type of health tests that can be performed on the device (all are safe to user data): | Three type of health tests that can be performed on the device (all are safe to user data): | ||
− | # Short ( | + | # Short (runs tests that have a high probability of detecting device problems) |
# Extended (or Long; a short check with complete disk surface examination) | # Extended (or Long; a short check with complete disk surface examination) | ||
− | # Conveyance (identifies if damage incurred during | + | # Conveyance (identifies if damage incurred during transportation of the device) |
− | To view the device's available tests and the it | + | To view the device's available tests and the time it will take to perform each test do: |
# smartctl -c /dev/<device> | # smartctl -c /dev/<device> | ||
Line 35: | Line 35: | ||
To run the tests do: | To run the tests do: | ||
− | # smartctl -t short | + | # smartctl -t short /dev/<device> |
− | # smartctl -t long | + | # smartctl -t long /dev/<device> |
# smartctl -t conveyance /dev/<device> | # smartctl -t conveyance /dev/<device> | ||
==== Results ==== | ==== Results ==== | ||
− | To | + | To view the test's overall health status (compiled from all tests): |
# smartctl -H /dev/<device> | # smartctl -H /dev/<device> | ||
− | To view the test result errors: | + | To view the test's result errors: |
− | # smartctl -l | + | # smartctl -l selftest /dev/<device> |
− | To view detailed | + | To view the test's detailed results: |
# smartctl -a /dev/<device> | # 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 | + | 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 === | === 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 {{ic|/etc/smartd.conf}} (the configuration is well commented) otherwise all tests are run on all devices. Or, each device can be specified and all tests run by doing (uuid's and device ID can be used for more exact matching): | The smart daemon can be edited for more exact configuration in {{ic|/etc/smartd.conf}} (the configuration is well commented) otherwise all tests are run on all devices. Or, each device can be specified and all tests run by doing (uuid's and device ID can be used for more exact matching): | ||
Line 75: | Line 77: | ||
DEVICESCAN -m address@domain.com | DEVICESCAN -m address@domain.com | ||
− | To be able 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|MSMTP]] and [[SSMTP]] | + | 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|MSMTP]] and [[SSMTP]]. Common MTUs are sendmail and [[Postfix]]. |
Once the mail agent is setup the {{ic|-M test}} option can be used to test if an email will be sent (restart the daemon immediately to discover): | Once the mail agent is setup the {{ic|-M test}} option can be used to test if an email will be sent (restart the daemon immediately to discover): | ||
DEVICESCAN -m address@domain.com -M test | DEVICESCAN -m address@domain.com -M test | ||
+ | |||
+ | ==== 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 [http://sourceforge.net/apps/trac/smartmontools/wiki/Powermode smartmontools wiki]. | ||
=== GUI Applications === | === GUI Applications === | ||
− | * {{App| | + | * {{App|Gsmartcontrol|A GNOME frontend for the smartctl hard disk drive health inspection tool|http://gsmartcontrol.berlios.de/home/index.php/en/Home|{{Pkg|gsmartcontrol}}}} |
== Resources == | == Resources == |
Revision as of 04:13, 28 April 2013
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.
Contents
Smartmontools
The smartmontools package contains two utility programs (smartctl
and smartd
) to analyze and monitor storage devices. Install smartmontools from the official repositories.
Detect if device has SMART support
To check if the device has SMART capability (it may be necessary to add -d ata
to specify it is an ATA derived device):
# smartctl -i /dev/<device>
(where <device> is sda, hda,...
). This will give general information about the device, the last two lines will show if it is supported:
SMART support is: Available - device has SMART capability. SMART support is: Enabled
If SMART is not enabled, it can be enabled by doing:
# smartctl -s 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):
- Short (runs tests that have a high probability of detecting device problems)
- Extended (or Long; a short check with complete disk surface examination)
- 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>
Results
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
(the configuration is well commented) otherwise all tests are run on all devices. Or, each device can be specified and all tests run by doing (uuid's and device ID can be used for more exact matching):
#DEVICESCAN /dev/<device> -a
Other options include:
-
-n standby,q
to run diagnostics only when device is spun-up. - Details about smartd operations can be found in:
/var/log/daemon.log
.
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.
Once the mail agent is setup the -M test
option can be used to test if an email will be sent (restart the daemon immediately to discover):
DEVICESCAN -m address@domain.com -M test
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.
GUI Applications
- Gsmartcontrol — A GNOME frontend for the smartctl hard disk drive health inspection tool