SMART
Package: smartmontools
smartctl vs smartd
- smartctl is meant for interactive use
- smartd continuously monitors
smartctl
Info on a block device
sudo smartctl -i /dev/sda
- Includes whether SMART support is enabled.
- Does not show all attributes.
- Use
-xto show all information. Very long. grep.
If smartctl -i fails, let smartctl know the type
sudo smartctl -d [ata/scsi/sat] -i /dev/sda
- If -d is necessary for examining, it is also necessary for all other commands.
Turning on SMART
sudo smartctl -s on -o on -S on /dev/sda
-s on: turn SMART on.-o on: turn on offline data collection.-S on: This enables “autosave of device vendor-specific Attributes”.
Offline data collection could have some performance impact. In practice, this has little effect.
Health check
sudo smartctl -H /dev/sda
Time estimates for self-tests
sudo smartctl -c /dev/sda
Short self-test
Start:
sudo smartctl -t short /dev/sda
Results:
sudo smartctl -l selftest /dev/sda
Long self-test
Start:
sudo smartctl -t long /dev/sda
Results:
sudo smartctl -l selftest /dev/sda
Current disk temperature
smartctl -A /dev/sda | grep Temperature_Celsius
smartd
- Start/enable the daemon.
- Config file:
/etc/smartd.confor/etc/smartmontools/smartd.conf man smartdandman smartd.conf
DEVICESCAN
- This line determines what is monitored and what actions to take after SMART scans.
DEVICESCAN options
-
-a: equivalent to-Hft -l error -l selftest -l selftests-sts -C 197 -U 198. Default when no other options are set. Gives a lot of info. Perhaps too much info. -
-H: [ATA] Check the health status of the disk with the SMART RETURN STATUS command. -
-m [EMAIL]Send a warning email to the email address if the ‘-H’, ‘-l’, ‘-f’, ‘-C’, or ‘-O’ directives detect a failure or a new error, or if a SMART command to the disk fails. -
-M: Modifiers for-m. Requires-m. Lots of options. Notably the ability to run an alternative, rather than default, mail program. -
-M exec /usr/libexec/smartmontools/smartdnotify -
-n standby,10,q:-
Prevent a disk from being checked if it is in a certain state. Alternatives to standby are: never, sleep or idle.
-
(Optional) The integer argument determines the maximum number of checks that can be skipped.
-
(Optional) The
qprevents smartd writing a log message when checks are skipped. A disk will spin-up if the log message is written.
-
-
-s (S/../.././02|L/../../6/03): schedule a short and/or long self-test. month of the year/day of the month/day of the week/hour of day.S/../.././02: Short-test between 2 - 3 am every morning.L/../../6/03: Long-test between 3 - 4 am on Satuday.
-
-W 4,35,40: alerts for temperature changes.- Argument 1: report if the temperature has changed by more than X since the last report.
- Argument 2: Report if the temperature has reached this bound.
- Argument 3: Send a temperature critical message at this bound.
-
man smartd.conffor all options. -
DEVICESCAN -H -m root -M exec /usr/libexec/smartmontools/smartdnotify -
DEVICESCAN -a -o on -S on -m root -M exec /usr/libexec/smartmontools/smartdnotify -s (S/../.././10|L/../../5/11)