SMARTD.CONF(5)
π SMARTD.CONF(5) π
the smartd.conf manual, but make it make sense β this is the man page for smartd.conf from the SMART Monitoring Tools, bestie. Linux edition, and no we're not covering the other platforms here, okay?
β¨ NAME β¨
smartd.conf β the configuration file for the SMART Disk Monitoring Daemon π©ΊπΎ
πΈ DESCRIPTION πΈ
[This man page is generated for the Linux version of smartmontools. It does not contain info specific to other platforms.]
Okay so. /etc/smartmontools/smartd.conf is the config file for the smartd daemon. That's it. That's the whole vibe. π
If the config file /etc/smartmontools/smartd.conf is there, smartd reads it at startup. And if smartd later catches a HUP signal, bestie it will re-read that config file like it's refreshing the timeline. π And if smartd is running in debug mode</c>, then an INT signal will also make it re-read the config file. You can trigger that one by typing <CONTROL-C> in the terminal window where smartd is running. (Yes, the dramatic way.)
Now β if there's no config file at all? smartd will try to open all the available devices (peep the smartd(8) man page for that). And a config file with a single line, 'DEVICESCAN -a', would do the exact same thing. Same energy, different outfit. π
Here's where it gets annoying though: if you have an ATA or SCSI device that hangs or misbehaves when it receives SMART commands, that's a whole problem. And even if nothing breaks, you may be lowkey irritated by the string of error log messages about devices that can't be opened. π
So you can dodge that problem entirely β and get way more control over what kinds of events smartd monitors β by using the config file /etc/smartmontools/smartd.conf. This file is just a list of devices to monitor, one device per line. An example file ships with the smartmontools distribution, and you'll find that sample config in /usr/share/doc/smartmontools/. π
For security, the configuration file should not be writable by anyone but root. Not up for debate, bestie. π
The syntax of the file goes like this:
- There should be one device listed per line, although you may have lines that are entirely comments or white space.
- Any text following a hash sign
'#'and up to the end of the line is taken to be a comment, and ignored. π¬ - Lines may be continued by using a backslash
'\'as the last non-whitespace or non-comment item on a line. - Note: a line whose first character is a hash sign
'#'is treated as a white-space blank line, not as a non-existent line, and will end a continuation line. (Sneaky. Respect it. π)
Here's an example configuration file. It's for illustrative purposes only β please don't just copy it onto your system without reading all the way to the end of the DIRECTIVES Section below! π
################################################
# This is an example smartd startup config file
# /etc/smartmontools/smartd.conf
#
# On the second disk, start a long self-test every
# Sunday between 3 and 4 am.
#
/dev/sda -a -m admin@example.com,root@localhost
/dev/sdb -a -I 194 -I 5 -i 12 -s L/../../7/03
#
# Send a TEST warning email to admin on startup.
#
/dev/sdc -m admin@example.com -M test
#
# An ATA disk may appear as a SCSI device to the
# OS. If a SCSI to ATA Translation (SAT) layer
# is between the OS and the device then this can be
# flagged with the '-d sat' option.
/dev/sda -a -d sat
#
# Disks connected to a MegaRAID controller
# Start short self-tests daily between 1-2, 2-3, and
# 3-4 am.
# Linux:
/dev/sda -d megaraid,0 -a -s S/../.././01
/dev/sda -d megaraid,1 -a -s S/../.././02
/dev/sda -d megaraid,2 -a -s S/../.././03
/dev/bus/0 -d megaraid,2 -a -s S/../.././03
#
# Three disks connected to an AacRaid controller
# Start short self-tests daily between 1-2, 2-3, and
# 3-4 am.
/dev/sda -d aacraid,0,0,66 -a -s S/../.././01
/dev/sda -d aacraid,0,0,67 -a -s S/../.././02
/dev/sda -d aacraid,0,0,68 -a -s S/../.././03
#
# Two SATA (not SAS) disks on a 3ware 9750 controller.
# Start long self-tests Sundays between midnight and
# 1 am and 2-3 am
# under Linux
/dev/twl0 -d 3ware,0 -a -s L/../../7/00
/dev/twl0 -d 3ware,1 -a -s L/../../7/02
#
# Two disks connected to the first HP SmartArray controller
# which uses the Linux cciss driver. Start long self-tests
# on Sunday nights and short self-tests every night and send
# errors to root.
/dev/sda -d cciss,0 -a -s (L/../../7/02|S/../.././02) -m root
/dev/sda -d cciss,1 -a -s (L/../../7/03|S/../.././03) -m root
#
# Three SATA disks on a HighPoint RocketRAID controller.
# Start short self-tests daily between 1-2, 2-3, and
# 3-4 am.
# under Linux
/dev/sde -d hpt,1/1 -a -s S/../.././01
/dev/sde -d hpt,1/2 -a -s S/../.././02
/dev/sde -d hpt,1/3 -a -s S/../.././03
#
# Two SATA disks connected to a HighPoint RocketRAID
# via a pmport device. Start long self-tests Sundays
# between midnight and 1 am and 2-3 am.
# under Linux
/dev/sde -d hpt,1/4/1 -a -s L/../../7/00
/dev/sde -d hpt,1/4/2 -a -s L/../../7/02
#
# Three SATA disks connected to an Areca
# RAID controller. Start long self-tests Sundays
# between midnight and 3 am.
# under Linux
/dev/sg2 -d areca,1 -a -s L/../../7/00
/dev/sg2 -d areca,2 -a -s L/../../7/01
/dev/sg2 -d areca,3 -a -s L/../../7/02
#
# The following line enables monitoring of the
# ATA Error Log and the Self-Test Error Log.
# It also tracks changes in both Prefailure
# and Usage Attributes, apart from Attributes
# 9, 194, and 231, and shows continued lines:
#
/dev/sdd -l error \
-l selftest \
-t \ # Attributes not tracked:
-I 194 \ # temperature
-I 231 \ # also temperature
-I 9 # power-on hours
#
################################################
π¦ DEVICESCAN π¦
If a non-comment entry in the config file is the text string DEVICESCAN β in capital letters, all caps, no lowercase nonsense β then smartd will ignore any remaining lines in the configuration file and will scan for devices. π And if DEVICESCAN isn't followed by any Directives, then '-a' will apply to all devices.
DEVICESCAN may optionally be followed by Directives that will apply to all devices found in the scan. Like, for example:
DEVICESCAN -m root@example.com
...will scan for all devices and then monitor them. It will send one email warning per device for any problems that are found. π§
DEVICESCAN -H -m root@example.com
...will do the same, but only monitors the SMART health status of the devices, rather than the default '-a'.
Multiple '-d TYPE' options may be specified with DEVICESCAN to combine the scan results of more than one TYPE. β¨
Configuration entries for specific devices may precede the DEVICESCAN entry. For example:
DEFAULT -m root@example.com
/dev/sda -s S/../.././02
/dev/sdc -d ignore
DEVICESCAN -s L/../.././02
...will scan for all devices except /dev/sda and /dev/sdc, monitor them, and run a long test between 2β3 am every morning. Device /dev/sda will also be monitored, but only a short test will be run. Device /dev/sdc will be ignored. Warning emails will be sent for all monitored devices. π«Ά
A device is ignored by DEVICESCAN if a configuration line with the same device name exists. Symbolic links are resolved before this check is done. A device name is also ignored if another device with same identify information (vendor, model, firmware version, serial number, WWN) already exists.
[NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] If a device only supports a single namespace and a configuration line which addresses its namespace id already exists, a DEVICESCAN result which does not address a namespace is also ignored (and vice versa). Okay werk. π
π DEFAULT SETTINGS π
If an entry in the configuration file starts with DEFAULT instead of a device name, then all directives in this entry are set as defaults for the next device entries. Very "setting the vibe for the group chat" of it.
So this config:
DEFAULT -a -R5! -W 2,40,45 -I 194 -s L/../../7/00 -m admin@example.com
/dev/sda
/dev/sdb
/dev/sdc
DEFAULT -H -m admin@example.com
/dev/sdd
/dev/sde -d removable
...has the exact same effect as:
/dev/sda -a -R5! -W 2,40,45 -I 194 -s L/../../7/00 -m admin@example.com
/dev/sdb -a -R5! -W 2,40,45 -I 194 -s L/../../7/00 -m admin@example.com
/dev/sdc -a -R5! -W 2,40,45 -I 194 -s L/../../7/00 -m admin@example.com
/dev/sdd -H -m admin@example.com
/dev/sde -d removable -H -m admin@example.com
See? Same thing, less typing. Slay. π
π CONFIGURATION FILE DIRECTIVES π
These are the Directives that may appear following the device name or DEVICESCAN or DEFAULT on any line of the /etc/smartmontools/smartd.conf configuration file. π
Note that these are NOT command-line options for smartd. Different thing entirely, don't get it twisted.
The Directives below may appear in any order, following the device name.
And if no Directives appear at all? Then the device will be monitored as if the '-a' Directive had been given. Default behaviour, no notes. β¨
π Directives
-d TYPEβ Specifies the type of the device. The valid arguments to this directive are:autoβ attempt to guess the device type from the device name, or from controller type info provided by the operating system, or from a matching USB ID entry in the drive database. This is the default. π―ataβ the device type is ATA. This preventssmartdfrom issuing SCSI commands to an ATA device. Boundaries, bestie. βscsiβ the device type is SCSI. This preventssmartdfrom issuing ATA commands to a SCSI device.nvme[,NSID]β the device type is NVM Express (NVMe). The optional parameter NSID specifies the namespace id (in hex) passed to the driver. Use0xfffffffffor the broadcast namespace id. The default for NSID is the namespace id addressed by the device name. π«sat[,auto][,N]β the device type is SCSI to ATA Translation (SAT). This is for ATA disks that have a SCSI to ATA Translation Layer (SATL) between the disk and the operating system. SAT defines two ATA PASS THROUGH SCSI commands, one 12 bytes long and the other 16 bytes long. The default is the 16 byte variant, which can be overridden with either'-d sat,12'or'-d sat,16'.
If '-d sat,auto' is specified, device type SAT (for ATA/SATA disks) is only used if the SCSI INQUIRY data reports a SATL (VENDOR: "ATA "). Otherwise device type SCSI (for SCSI/SAS disks) is used. β¨
usbasm1352r,PORTβ [NEW EXPERIMENTAL SMARTD 7.4 FEATURE] this device type is for one or two SATA disks that are behind an ASMedia ASM1352R USB to SATA (RAID) bridge. The parameter PORT (0or1) selects the disk to monitor.
Note: This USB bridge also supports '-d sat'. This monitors either the first disk or the second disk if no disk is connected to the first port. π
usbcypressβ for ATA disks that are behind a Cypress USB to PATA bridge. This uses the ATACB proprietary scsi pass through command. The default SCSI operation code is0x24, but although it can be overridden with-d usbcypress,0xN, where N is the scsi operation code, you're running the risk of damage to the device or filesystems on it. So likeβ¦ maybe don't πusbjmicron[,p][,x][,PORT]β for SATA disks that are behind a JMicron USB to PATA/SATA bridge. The 48-bit ATA commands (required e.g. for-l xerror, see below) do not work with all of these bridges and are therefore disabled by default. These commands can be enabled by-d usbjmicron,x. If two disks are connected to a bridge with two ports, an error message is printed if no PORT (0or1) is specified. The PORT parameter is not necessary if the device uses a port multiplier to connect multiple disks to one port β the disks appear under separate/dev/icenames then.
CAUTION: Specifying ,x for a device which does not support it results in I/O errors and may disconnect the drive. Same energy if the specified PORT does not exist or is not connected to a disk.
The Prolific PL2507/3507 USB bridges with older firmware support a pass-through command similar to JMicron and work with -d usbjmicron,0. Newer Prolific firmware requires a modified command which can be selected by -d usbjmicron,p. Note that this does not yet support the SMART status command.
usbprolificβ for SATA disks that are behind a Prolific PL2571/2771/2773/2775 USB to SATA bridge. cute little bridge bestie β¨usbsunplusβ for SATA disks that are behind a SunplusIT USB to SATA bridge. slay πΈsntasmedia[/sat]β for NVMe disks that are behind an ASMedia USB to NVMe bridge.
[NEW EXPERIMENTAL SMARTD 7.5 FEATURE] If the /sat suffix is specified and the NVMe Identify Controller command fails, the device type is changed to -d sat. This is useful for USB M.2 adapters which support NVMe and SATA devices. adaptive queen behavior honestly π
sntjmicron[,NSID][/sat]β for NVMe disks that are behind a JMicron USB to NVMe bridge. The optional parameter NSID specifies the namespace id (in hex) passed to the driver. The default namespace id is the broadcast namespace id (0xffffffff). See also-d sntasmediafor the/satsuffix.sntrealtek[/sat]β for NVMe disks that are behind a Realtek USB to NVMe bridge. See also-d sntasmediafor the/satsuffix.marvellβ [Linux only] (deprecated and subject to remove). it's giving legacy, lowkey on its way out πmegaraid,Nβ [FreeBSD and Linux only] the device consists of one or more SCSI/SAS disks connected to a MegaRAID controller. The non-negative integer N (in the range of0to127inclusive) denotes which disk on the controller is monitored. This interface will also work for Dell PERC controllers. In log files and email messages this disk will be identified asmegaraid_disk_XXXwith XXX in the range from000to127inclusive. Please see thesmartctl(8)man page for further details.aacraid,H,L,IDβ [Linux, Windows and Cygwin only] the device consists of one or more SCSI/SAS or SATA disks connected to an AacRaid controller. The non-negative integers H,L,ID (Host number, Lun, ID) denote which disk on the controller is monitored. In log files and email messages this disk will be identified asaacraid_disk_HH_LL_ID. Please see thesmartctl(8)man page for further details.3ware,Nβ [FreeBSD and Linux only] the device consists of one or more ATA disks connected to a 3ware RAID controller. The non-negative integer N (in the range from0to127inclusive) denotes which disk on the controller is monitored. In log files and email messages this disk will be identified as3ware_disk_XXXwith XXX in the range from000to127inclusive.
Note that while you may use any of the 3ware SCSI logical devices /dev/tw* to address any of the physical disks (3ware ports), error and log messages will make the most sense if you always list the 3ware SCSI logical device corresponding to the particular physical disks. Please see the smartctl(8) man page for further details.
areca,Nβ [FreeBSD, Linux, Windows and Cygwin only] the device consists of one or more SATA disks connected to an Areca SATA RAID controller. The positive integer N (in the range from1to24inclusive) denotes which disk on the controller is monitored. In log files and email messages this disk will be identified asareca_disk_XXwith XX in the range from01to24inclusive. Please see thesmartctl(8)man page for further details.areca,N/Eβ [FreeBSD, Linux, Windows and Cygwin only] the device consists of one or more SATA or SAS disks connected to an Areca SAS RAID controller. The integer N (range1to128) denotes the channel (slot) and E (range1to8) denotes the enclosure. Important: This requires Areca SAS controller firmware version1.51or later. firmware check bestie, don't skip it β¨cciss,Nβ [FreeBSD and Linux only] the device consists of one or more SCSI/SAS or SATA disks connected to a cciss RAID controller. The non-negative integer N (in the range from0to127inclusive) denotes which disk on the controller is monitored. In log files and email messages this disk will be identified ascciss_disk_XXwith XX in the range from00to127inclusive. Please see thesmartctl(8)man page for further details.hpt,L/M/Nβ [FreeBSD and Linux only] the device consists of one or more ATA disks connected to a HighPoint RocketRAID controller. The integer L is the controller id, the integer M is the channel number, and the integer N is the PMPort number if it is available. The allowed values of L are from1to4inclusive, M are from1to128inclusive and N from1to4if PMPort available. And also these values are limited by the model of the HighPoint RocketRAID controller. In log files and email messages this disk will be identified ashpt_X/X/Xand X/X/X is the same as L/M/N, note if no N indicated, N set to the default value1. Please see thesmartctl(8)man page for further details.sssraid,E,Sβ [Linux only: NEW EXPERIMENTAL SMARTD 7.4 FEATURE] the device consists of one or more SCSI/SAS or SATA disks connected to a SSSRAID controller. The non-negative integer E (in the range of0to8) denotes the enclosure and S (range0to128) denotes the slot. Please see thesmartctl(8)man page for further details.intelliprop,N[+TYPE]β (deprecated and subject to remove). sad but true π«Άjmb39x[-q[2]],N[,sLBA][,force][+TYPE]β the device consists of multiple SATA disks connected to a JMicron JMB39x RAID port multiplier. The suffix-qselects a slightly different command variant used by QNAP TR-004 NAS devices. The integer N is the port number from0to4.
[NEW EXPERIMENTAL SMARTD 7.5 FEATURE] The suffix -q2 selects another command variant used by QNAP TR-002 NAS devices. Please see the smartctl(8) man page for further details.
jms56x,N[,sLBA][,force][+TYPE]β the device consists of multiple SATA disks connected to a JMicron JMS56x USB to SATA RAID bridge. Seejmb39x...above for valid arguments. same rules, different bridge, iykyk πignoreβ the device specified by this configuration entry should be ignored. This allows one to ignore specific devices which are detected by a following DEVICESCAN configuration line. It may also be used to temporary disable longer multi-line configuration entries. This Directive may be used in conjunction with the other-dDirectives. the "not you, bestie" button πremovableβ the device or its media is removable. This indicates to smartd that it should continue (instead of exiting, which is the default behavior) if the device does not appear to be present when smartd is started. This directive also suppresses warning emails and repeated log messages if the device is removed after startup. This Directive may be used in conjunction with the other-dDirectives.
WARNING: Removing a device and connecting a different one to same interface is not supported and may result in bogus warnings until smartd is restarted. likeβ¦ don't do hot-swap shenanigans and then act surprised π
-n POWERMODE[,N][,q]β [ATA only] This 'nocheck' Directive is used to prevent a disk from being spun-up when it is periodically polled by smartd.
ATA disks have five different power states. In order of increasing power consumption they are: OFF, SLEEP, STANDBY, IDLE, and ACTIVE. Typically in the OFF, SLEEP, and STANDBY modes the disk's platters are not spinning. But 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. the way that it just wakes the poor thing up every single poll π
Note that if the disk is in SLEEP mode when smartd is started, then it won't respond to smartd commands, and so the disk won't be registered as a device for smartd to monitor. If a disk is in any other low-power mode, then the commands issued by smartd to register the disk will probably cause it to spin-up.
The -n (nocheck) Directive specifies if smartd's periodic checks should still be carried out when the device is in a low-power mode. It may be used to prevent a disk from being spun-up by periodic smartd polling. The allowed values of POWERMODE are:
neverβ smartd will poll (check) the device regardless of its power mode. This may cause a disk which is spun-down to be spun-up when smartd checks it. This is the default behavior if the-nDirective is not given.sleepβ check the device unless it is in SLEEP mode.standbyβ check the device unless it is in SLEEP or STANDBY mode. In these modes most disks are not spinning, so if you want to prevent a laptop disk from spinning up each time that smartd polls, this is probably what you want. laptop besties, this one's for you π«Ά
idleβ check the device unless it's out here chillin' in SLEEP, STANDBY or IDLE mode. heads up bestie: in the IDLE state, most disks are still spinning, so this is probably not the move you want. π
Wanna cap how many checks get skipped in a row? Just slap a positive number ,N onto POWERMODE (like '-n standby,15'). Once N checks have been skipped back-to-back, powermode gets ignored and the check happens anyway. periodt π
When a periodic test gets skipped, smartd normally writes an informal log message. You can mute that by appending the option ,q to POWERMODE (like '-n standby,q'). This keeps a laptop disk from spinning up just because of the message. energy-saving queen behavior, fr πβ¨
Both ,N and ,q can be specified together. combo meal π
-T TYPEβ sets how tolerant smartd should be when SMART commands fail. vibe check for your disk's drama levels. The valid arguments to this Directive are:normalβ do not try to monitor the disk if a mandatory SMART command fails, but keep going if an optional SMART command fails. This is the default. βpermissiveβ try to monitor the disk even if it looks like it lacks SMART capabilities. This may be required for some old disks (prior to ATA-3 revision 4) that implemented SMART before the SMART standards got baked into the ATA/ATAPI Specifications. [Please see thesmartctl -Tcommand-line option.]
-o VALUEβ [ATA only] enables or disables SMART Automatic Offline Testing when smartd starts up, and then it has no further effect. The valid arguments to this Directive areonandoff.
The delay between tests is vendor-specific, but it's typically four hours. β°
no cap: SMART Automatic Offline Testing is not part of the ATA Specification. Please see the smartctl -o command-line option documentation for more tea about this feature.
-S VALUEβ enables or disables Attribute Autosave when smartd starts up and has no further effect. The valid arguments to this Directive areonandoff. Also affects SCSI devices. [Please see thesmartctl -Scommand-line option.]
-H [MASK]β check the health status of the disk. If the disk reports a failing health status, a message at loglevelLOG_CRITgets logged to syslog. [Please see thesmartctl -Hcommand-line option.]- [ATA] checks the (boolean) result returned by the SMART RETURN STATUS command. The optional parameter MASK is ignored.
- [SCSI] checks the Additional Sense Code (ASC) and Additional Sense Code Qualifier (ASCQ) from Informal Exceptions (IE) log page (if supported) and/or from SCSI sense data. The optional parameter MASK is ignored. Note: for historical reasons, this check is always done for SCSI devices, regardless of the
'-H'directive. π - [NVMe] checks the "Critical Warning" byte from the SMART/Health Information log. If any warning bit is set, a message at loglevel
LOG_CRITgets logged to syslog. - [NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] if the optional parameter MASK (hexadecimal) is specified, the check is limited to the warning bits set in MASK. For example, if
'-H 0xf9'is specified, warning bit 1 ("temperature out of range") and bit 2 ("reliability degraded") will be ignored.'-H 0xff'is the same as'-H'without a parameter. π
-l TYPEβ reports increases in the number of errors in one of three SMART logs. The valid arguments to this Directive are:errorβ [ATA] report if the number of ATA errors reported in the Summary SMART error log has increased since the last check.errorβ [NVMe] report if the "Number of Error Information Log Entries" from the SMART/Health Information log has increased since the last check.- [NEW EXPERIMENTAL SMARTD 7.4 FEATURE] this will only be logged as
LOG_CRITif at least one of the new errors is still present in the Error Information log and its status indicates a device related error. Up to eight of the most recent of these errors are logged asLOG_INFOthen. This is useful because the NVMe Error Information log is not persistent across power cycles or device resets. - If all new errors are either no longer present in the log or are not device related (e.g. invalid command, invalid field in command, ...), a
LOG_INFOmessage is generated instead. This avoids misleading warnings if the operating system issues unsupported commands and the device firmware also logs these kind of errors.
- [NEW EXPERIMENTAL SMARTD 7.4 FEATURE] this will only be logged as
xerrorβ [ATA] report if the number of ATA errors reported in the Extended Comprehensive SMART error log has increased since the last check.- If both
'-l error'and'-l xerror'are specified, smartd checks the maximum of both values. - [Please see the
smartctl -l xerrorcommand-line option.] xerrorβ [NVMe] same as'-l error'.selftestβ [ATA] [SCSI] [NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] report if the number of failed tests reported in the SMART Self-Test Log has increased since the last check, or if the timestamp associated with the most recent failed test has increased. Note: such errors will only be logged if you actually run self-tests on the disk (and it fails a test!). Self-Tests can be run automatically by smartd: please see the'-s'Directive below. Self-Tests can also be run manually by using the'-t short'and'-t long'options of smartctl, and the results of the testing can be observed using the smartctl'-l selftest'command-line option. [Please see thesmartctl -land-tcommand-line options.]- [ATA] [NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] failed self-tests outdated by a newer successful extended self-test are ignored. The warning email counter is reset if the number of failed self tests dropped to
0. This typically happens when an extended self-test is run after all bad blocks have been reallocated. π©Ή - [NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] if the device name addresses an individual namespace, log entries with different namespace ids are ignored. Entries with unspecified or broadcast namespace id are always checked.
offlinests[,ns]β [ATA only] report if the Offline Data Collection status has changed since the last check. The report will be logged asLOG_CRITif the new status indicates an error. With some drives the status often changes, therefore'-l offlinests'is not enabled by the'-a'Directive. Appending,ns(no standby) to this directive is not implemented on Linux. π§selfteststs[,ns]β [ATA] [NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] report if the Self-Test execution status has changed since the last check. The report will be logged asLOG_CRITif the new status indicates an error. Appending,ns(no standby) to this directive is not implemented on Linux. π§scterc,READTIME,WRITETIMEβ [ATA only] sets the SCT Error Recovery Control settings to the specified values (deciseconds) when smartd starts up and has no further effect. Values of0disable the feature, and other values less than65are probably not supported. For RAID configurations, this is typically set to70,70deciseconds. [Please see thesmartctl -l scterccommand-line option.]
-e NAME[,VALUE]β sets non-SMART device settings when smartd starts up and has no further effect. [Please see thesmartctl --setcommand-line option.] Valid arguments are:aam,[N|off]β [ATA only] sets the Automatic Acoustic Management (AAM) feature. π€«apm,[N|off]β [ATA only] sets the Advanced Power Management (APM) feature.lookahead,[on|off]β [ATA only] sets the read look-ahead feature.security-freezeβ [ATA only] sets ATA Security feature to frozen mode. π§βοΈstandby,[N|off]β [ATA only] sets the standby (spindown) timer and places the drive in the IDLE mode.wcache,[on|off]β [ATA only] sets the volatile write cache feature.dsn,[on|off]β [ATA only] sets the DSN feature.
-s REGEXPβ run Self-Tests or Offline Immediate Tests, at scheduled times. A Self- or Offline Immediate Test will be run at the end of periodic device polling, if all 12 characters of the stringT/MM/DD/d/HHmatch the extended regular expression REGEXP. clock it β° Here:Tβ is the type of the test. The values that smartd will try to match (in turn) are:'L'for a Long Self-Test,'S'for a Short Self-Test,'C'for a Conveyance Self-Test (ATA only), and'O'for an Offline Immediate Test (ATA only). As soon as a match is found, the test will be started and no additional matches will be sought for that device and that polling cycle.- [NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] for NVMe devices with Self-Test support, use
'L'to start an "Extended" NVMe Self-Test and'S'for a Short NVMe Self-Test. If the device name addresses an individual namespace, the test will be started using this namespace id, otherwise using the broadcast namespace id. - [ATA only] to run scheduled Selective Self-Tests, use
'n'for next span,'r'to redo last span, or'c'to continue with next span or redo last span based on status of last test. The LBA range is based on the first span from the last test. See thesmartctl -t select,[next|redo|cont]options for further info. - Some disks (e.g. WD) do not preserve the selective self test log across power cycles. If state persistence (
'-s'option) is enabled, the last test span is preserved by smartd and used if (and only if) the selective self test log is empty. πΎ
- [NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] for NVMe devices with Self-Test support, use
MMβ is the month of the year, expressed with two decimal digits. The range is from01(January) to12(December) inclusive. Do not use a single decimal digit or the match will always fail! πDDβ is the day of the month, expressed with two decimal digits. The range is from01to31inclusive. Do not use a single decimal digit or the match will always fail! π
continuing where we left off with the -s REGEXP magic, bestie β here are the pieces you still need to know about:
dβ the day of the week, written as one decimal digit. Range is from1(Monday) to7(Sunday), both inclusive. ποΈHHβ the hour of the day, written as two decimal digits, counted in hours after midnight. Range is00(midnight, right up until just before 1 am) to23(11pm right up until just before midnight), inclusive.
π¨ Do NOT use a single decimal digit for HH or the match will always fail! fr fr, don't do it. π
So if the regular expression contains substrings of the form :NNN or :NNN-LLL, where NNN and LLL are three decimal digits, staggered tests are enabled. β¨ Then a test will also be run if all 16 (or 20) characters of the string T/MM/DD/d/HH:NNN (or T/MM/DD/d/HH:NNN-LLL) match the regular expression. This check is done for up to seven :NNN or :NNN-LLL found in the regular expression. The time used for the check is adjusted to the past such that tests of the first drive are not delayed, tests of the second drive are delayed by NNN hours, tests of the third drive are delayed by 2*NNN hours, and so on.
If LLL is also specified, delays are limited to LLL hours by calculating each individual delay as:
((DRIVE_INDEX * NNN) mod (LLL + 1))
π the examples, because we love a good example
Some examples follow. In reading these, keep in mind that in extended regular expressions a dot . matches any single character, and a parenthetical expression such as (A|B|C) denotes any one of the three possibilities A, B, or C. π
- To schedule a short Self-Test between 2β3 am every morning, use:
-s S/../.././02
- To schedule a long Self-Test between 4β5 am every Sunday morning, use:
-s L/../../7/04
- To enable staggered tests with delays in three hour steps, use:
-s L/../../7/04:003
- To enable staggered tests with delays 0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 0, ... hours, use:
-s L/../../7/04:003-010
- To enable staggered tests with delays 0, 1, 2, ..., 9, 10, 0, ... hours, use:
-s L/../../7/04:001-010
- To schedule a long Self-Test between 10β11 pm on the first and fifteenth day of each month, use:
-s L/../(01|15)/./22
- To schedule an Offline Immediate test after every midnight, 6 am, noon, and 6 pm, plus a Short Self-Test daily at 1β2 am and a Long Self-Test every Saturday at 3β4 am, use:
-s (O/../.././(00|06|12|18)|S/../.././01|L/../../6/03)
- To enable staggered Long Self-Tests with delays in three hour steps, use:
-s (O/../.././(00|06|12|18)|S/../.././01|L/../../6/03:003)
- If Long Self-Tests of a large disks take longer than the system uptime, a full disk test can be performed by several Selective Self-Tests. To setup a full test of a 1 TB disk within 20 days (one 50 GB span each day), run this command once:
smartctl -t select,0-99999999 /dev/sda
- To run the next test spans on MondayβFriday between 12β13 am, run smartd with this directive:
-s n/../../[1-5]/12
π when do these tests actually run though
Scheduled tests are run immediately following the regularly-scheduled device polling, if the current local date, time, and test type match REGEXP. By default the regularly-scheduled device polling occurs every thirty minutes after starting smartd.
β οΈ Take caution if you use the -i option to make this polling interval more than sixty minutes: the poll times may fail to coincide with any of the testing times that you have specified with REGEXP. In this case the test will be run following the next device polling. π
Before running an offline or self-test, smartd checks to be sure that a self-test is not already running. If a self-test is already running, then this running self test will not be interrupted to begin another test. periodt. π
smartd will not attempt to run any type of test if another test was already started or run in the same hour.
To avoid performance problems during system boot, smartd will not attempt to run any scheduled tests following the very first device polling (unless -q onecheck is specified). π«Ά
Each time a test is run, smartd will log an entry to SYSLOG. You can use these or the -q showtests command-line option to verify that you constructed REGEXP correctly. The matching order (L before S before C before O) ensures that if multiple test types are all scheduled for the same hour, the longer test type has precedence. This is usually the desired behavior. β¨
If the scheduled tests are used in conjunction with state persistence (-s option), smartd will also try to match the hours since last shutdown (or 90 days at most). If any test would have been started during downtime, the longest (see above) of these tests is run after second device polling. π
If the -n directive is used and any test would have been started during disk standby time, the longest of these tests is run when the disk is active again.
Unix users: please beware that the rules for extended regular expressions [regex(7)] are not the same as the rules for file-name pattern matching by the shell [glob(7)]. smartd will issue harmless informational warning messages if it detects characters in REGEXP that appear to indicate that you have made this mistake. π
-m ADDβ Send a warning email to the email address ADD if the-H,-l error,-l xerror,-l selftest,-f,-C,-U, or-WDirectives detect a failure or a new error, or if a SMART command to the disk fails. This Directive only works in conjunction with these other Directives (or with the equivalent default-aDirective). π§
To prevent your email in-box from getting filled up with warning messages, by default only a single warning and (depending on -s option) daily reminder emails will be sent for each of the enabled alert types. See the -M Directive below for details. π
To send email to more than one user, please use the following "comma separated" form for the address: user1@add1,user2@add2,...,userN@addN (with no spaces).
To test that email is being sent correctly, use the -M test Directive described below to send one test email message on smartd startup.
By default, email is sent using the system mail(1) command. In order that smartd find this command (normally /usr/bin/mail) the executable must be in the path of the shell or environment from which smartd was started. If you wish to specify an explicit path to the mail executable (for example /usr/local/bin/mail) or a custom script to run, please use the -M exec Directive below.
Note also that there is a special argument <nomailer> which can be given to the -m Directive in conjunction with the -M exec Directive. Please see below for an explanation of its effect.
If the mailer or the shell running it produces any STDERR/STDOUT output, then a snippet of that output will be copied to SYSLOG. The remainder of the output is discarded. If problems are encountered in sending mail, this should help you to understand and fix them. If you have mail problems, we recommend running smartd in debug mode with the -d flag, using the -M test Directive described below. π
If a word of the comma separated list has the form @plugin, a custom script /etc/smartmontools/smartd_warning.d/plugin is run and the word is removed from the list before sending mail. The string plugin may be any valid name except ALL. If @ALL is specified, all scripts in /etc/smartmontools/smartd_warning.d/* are run instead. This is handled by the script /etc/smartmontools/smartd_warning.sh (see also -M exec below). Plugin scripts without execute permission are silently ignored. If any plugin script is missing or fails with a nonzero exit status, the warning script exits immediately without sending mail. π
-M TYPEβ These Directives modify the behavior of thesmartdemail warnings enabled with the-memail Directive described above. These-MDirectives only work in conjunction with the-mDirective and can not be used without it. π
Multiple -M Directives may be given. If more than one of the following three -M Directives are given (example: -M once -M daily) then the final one (in the example, -M daily) is used.
The valid arguments to the -M Directive are (one of the following three):
onceβ send only one warning email for each type of disk problem detected. This is the default unless state persistence (-soption) is enabled.alwaysβ [NEW EXPERIMENTAL SMARTD 7.4 FEATURE] send additional warning reminder emails, upon each check, for each type of disk problem detected.dailyβ send additional warning reminder emails, once per day, for each type of disk problem detected. This is the default if state persistence (-soption) is enabled.diminishingβ send additional warning reminder emails, after a one-day interval, then a two-day interval, then a four-day interval, and so on for each type of disk problem detected. Each interval is twice as long as the previous interval. [NEW EXPERIMENTAL SMARTD 7.4 FEATURE] The interval length will stay at 32 days after 5 warning reminder emails.
If a disk problem is no longer detected, the internal email counter is reset. If the problem reappears a new warning email is sent immediately. π
In addition, one may add zero or more of the following Directives:
testβ send a single test email immediately uponsmartdstartup. This allows one to verify that email is delivered correctly. Note that if this Directive is used,smartdwill also send the normal email warnings that were enabled with the-mDirective, in addition to the single test email! βexec PATHβ run the executable PATH instead of the default mail command, whensmartdneeds to send email. PATH must point to an executable binary file or script. π§
so like, if you point PATH at your own custom script, you can make smartd pull off some genuinely useful tricks whenever a disk problem gets detected β beeping the console, shutting the machine down, broadcasting warnings to literally every logged-in user, all of it. π
but bestie, please be careful: smartd will block until the executable PATH returns, so if your executable hangs, smartd hangs right along with it. it's giving mutual hostage situation. π some sample scripts are included in /usr/share/doc/smartmontools/examplescripts/.
the exit status of your executable gets recorded by smartd in SYSLOG. and heads up β the executable is not expected to write to STDOUT or STDERR. if it does, that's read as a sign something is going wrong with your executable, and a fragment of that output gets logged to SYSLOG to help you figure out what the problem is. normally, if you wanna leave some record behind, your executable should send mail or write to a file or device. π
before running your executable, smartd sets a whole lineup of environment variables. these are how you steer the executable's behavior. the ones smartd exports are:
SMARTD_MAILERβ set to the argument of-M exec, if present, or else tomail(examples:/usr/local/bin/mail,mail).SMARTD_DEVICEβ the device path (example:/dev/sda).SMARTD_DEVICETYPEβ the device type specified by the-ddirective, orautoif none.SMARTD_DEVICESTRINGβ the device description. it starts withSMARTD_DEVICEand may be followed by an optional controller identification (example:/dev/sda [SAT]). this string may contain a space and is NOT quoted.SMARTD_DEVICEINFOβ the device identify information. it includes most of the info printed bysmartctl -ibut uses a brief single line format. this device info is also logged when smartd starts up. the string contains space characters and is NOT quoted.SMARTD_FAILTYPEβ the reason for the warning or message email. the possible values it takes, and what they mean, are:EmailTest: this is an email test message.Health: the SMART health status indicates imminent failure.Usage: a usage Attribute has failed.SelfTest: the number of self-test failures has increased.ErrorCount: the number of errors in the ATA error log has increased.CurrentPendingSector: one of more disk sectors could not be read and are marked to be reallocated (replaced with spare sectors).OfflineUncorrectableSector: during off-line testing, or self-testing, one or more disk sectors could not be read.Temperature: Temperature reached critical limit (see-Wdirective).FailedHealthCheck: the SMART health status command failed.FailedReadSmartData: the command to read SMART Attribute data failed.FailedReadSmartErrorLog: the command to read the SMART error log failed.FailedReadSmartSelfTestLog: the command to read the SMART self-test log failed.FailedOpenDevice: theopen()command to the device failed.
SMARTD_ADDRESSβ determined by the address argument ADD of the-mDirective. if ADD is<nomailer>, thenSMARTD_ADDRESSis not set. otherwise, it's set to the comma-separated-list of email addresses given by the argument ADD, with the commas replaced by spaces (example:admin@example.com root). if more than one email address is given, then this string will contain space characters and is NOT quoted, so to use it in a shell script you may want to enclose it in double quotes.SMARTD_ADDRESS_ORIGβ set to the original value ofSMARTD_ADDRESSwith@pluginstrings still present. if there are no such strings in the-mDirective, this variable is NOT set.SMARTD_MESSAGEβ the one sentence summary warning email message string from smartd. this message string contains space characters and is NOT quoted. so to use$SMARTD_MESSAGEin a shell script you should probably enclose it in double quotes.SMARTD_FULLMESSAGEβ the contents of the entire email warning message string from smartd. this message string contains space and return characters and is NOT quoted. so to use$SMARTD_FULLMESSAGEin a shell script you should probably enclose it in double quotes.SMARTD_TFIRSTβ a text string giving the time and date at which the first problem of this type was reported. this text string contains space characters and no newlines, and is NOT quoted. for example:
Sun Feb 9 14:58:19 2003 CST
SMARTD_TFIRSTEPOCHβ an integer, which is the unix epoch (number of seconds since Jan 1, 1970) forSMARTD_TFIRST.SMARTD_PREVCNTβ an integer specifying the number of previous messages sent. it's set to0for the first message.SMARTD_NEXTDAYSβ an integer specifying the number of days until the next message will be sent. it's set to empty on-M once, set to0on-M alwaysand set to1on-M daily.
if the -m ADD Directive is given with a normal address argument, then the executable pointed to by PATH will be run in a shell with STDIN receiving the body of the email message, and with the same command-line arguments:
-s "$SMARTD_SUBJECT" $SMARTD_ADDRESS
that would normally be provided to mail. examples include:
-m user@home -M exec /usr/bin/mail
-m admin@work -M exec /usr/local/bin/mailto
-m root -M exec /Example_1/shell/script/below
if the -m ADD Directive is given with the special address argument <nomailer> then the executable pointed to by PATH is run in a shell with no STDIN and no command-line arguments, for example:
-m <nomailer> -M exec /Example_2/shell/script/below
if the executable produces any STDERR/STDOUT output, then smartd assumes that something is going wrong, and a snippet of that output will be copied to SYSLOG. the remainder of the output is then discarded. ποΈ
some EXAMPLES of scripts that can be used with the -M exec Directive are given below. some sample scripts are also included in /usr/share/doc/smartmontools/examplescripts/.
the executable is run by the script /etc/smartmontools/smartd_warning.sh. this script formats subject and full message based on SMARTD_MESSAGE and other environment variables set by smartd. the environment variables SMARTD_SUBJECT and SMARTD_FULLMESSAGE are set by the script before running the executable. β¨
okay now back to the directive flags, bestie, we're so close π
-fβ [ATA] check for 'failure' of any Usage Attributes. if these Attributes are less than or equal to the threshold, it does NOT indicate imminent disk failure. it "indicates an advisory condition where the usage or age of the device has exceeded its intended design life period." [please see thesmartctl -Acommand-line option.]
[NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] log a message with LOG_CRIT level and send a warning email if the SMART/Health value "Percentage Used" has changed and exceeds 95 percent or "Media and Data Integrity Errors" has increased.
-pβ [ATA] report anytime that a Prefail Attribute has changed its value since the last check. [please see thesmartctl -Acommand-line option.]
[NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] report anytime that the SMART/Health value "Available Spare" has changed its value since the last check. this will be logged with LOG_CRIT level and a warning email will be sent if the value is below "Available Spare Threshold".
-uβ [ATA] report anytime that a Usage Attribute has changed its value since the last check. [please see thesmartctl -Acommand-line option.]
[NVMe: NEW EXPERIMENTAL SMARTD 7.5 FEATURE] report anytime that the SMART/Health value "Percentage Used" or "Media and Data Integrity Errors" has changed its value since the last check.
-tβ equivalent to turning on the two previous flags-pand-u. two-for-one deal, we love to see it. π-iID β [ATA only] ignore device Attribute number ID when checking for failure of Usage Attributes. ID must be a decimal integer in the range from 1 to 255. this Directive modifies the behavior of the-fDirective and has no effect without it.
this is useful, for example, if you have a very old disk and don't want to keep getting messages about the hours-on-lifetime Attribute (usually Attribute 9) failing. this Directive may appear multiple times for a single device, if you want to ignore multiple Attributes.
-IID β [ATA only] ignore device Attribute ID when tracking changes in the Attribute values. ID must be a decimal integer in the range from 1 to 255. this Directive modifies the behavior of the-p,-u, and-ttracking Directives and has no effect without one of them.
this is useful, for example, if one of the device Attributes is the disk temperature (usually Attribute 194 or 231). it's annoying to get reports each time the temperature changes. this Directive may appear multiple times for a single device, if you want to ignore multiple Attributes.
-rID[!] β [ATA only] when tracking, report the Raw value of Attribute ID along with its (normally reported) Normalized value. ID must be a decimal integer in the range from 1 to 255. this Directive modifies the behavior of the-p,-u, and-ttracking Directives and has no effect without one of them. this Directive may be given multiple times.
a common use of this Directive is to track the device Temperature (often ID=194 or 231). π‘οΈ
And if you stick the optional ! flag on the end? Then a change of the Normalized value is treated as critical π. The report gets logged as LOG_CRIT, and a warning email goes out if -m is specified. So like, that's your "hey bestie something moved and it's serious" alarm. π¨
-R ID[!]β[ATA only]While it's tracking, this reports every single time the Raw value of Attribute ID changes. (By default smartd only tracks and reports changes of the Normalized Attribute values, so this is the glow-up where you get the raw tea too. π΅) ID has to be a decimal integer, range1to255. Heads up though: this directive just modifies how the-p,-u, and-ttracking directives behave β it does literally nothing on its own without one of them. π You can give this directive as many times as you want.
And if you do give it? It automatically implies the -r directive for that same Attribute, so the Raw value of the Attribute gets reported too. Two for one, slay. β¨
The most iconic use of this is tracking your device Temperature (often ID=194 or 231). It's also lowkey perfect for figuring out how different types of system behavior affect the values of certain Attributes. π
If the optional flag ! is appended, a change of the Raw value is considered critical. The report gets logged as LOG_CRIT and a warning email is sent if -m is specified. A classic example is -R 5! β that warns you when new sectors get reallocated. π
-C ID[+]β[ATA only]Report if the current number of pending sectors is non-zero. Here ID is the id number of the Attribute whose raw value is the Current Pending Sector count. The allowed range of ID is0to255inclusive. To turn this reporting off, useID = 0. If you don't give the-C IDoption at all, it defaults to-C 197(because Attribute 197 is generally used to monitor pending sectors). And if the name of this Attribute gets changed by a-v 197,FORMAT,NAMEdirective, the default flips to-C 0.
If + is specified, a report is only printed if the number of sectors has increased between two check cycles. Some disks do not reset this attribute when a bad sector is reallocated, so this is your filter for that. See also -v 197,increasing below. π§
The warning email counter is reset if the number of pending sectors dropped to 0. This typically happens when all pending sectors have been reallocated or could be read again. So like, it resets itself when things heal. π©Ή
Okay bestie, story time, because this one actually matters: a pending sector is a disk sector (containing 512 bytes of your data) which the device would like to mark as "bad" and reallocate. Typically this is because your computer tried to read that sector, and the read failed because the data on it has been corrupted and has inconsistent Error Checking and Correction (ECC) codes. This is important to know, because it means there is some unreadable data on the disk. π The problem of figuring out what file this data belongs to is operating system and file system specific. You can typically force the sector to reallocate by writing to it (translation: make the device substitute a spare good sector for the bad one) but at the price of losing the 512 bytes of data stored there. So yeah β it fixes itself by sacrificing the data. Not me making that sound cute. π
-U ID[+]β[ATA only]Report if the number of offline uncorrectable sectors is non-zero. Here ID is the id number of the Attribute whose raw value is the Offline Uncorrectable Sector count. The allowed range of ID is0to255inclusive. To turn this reporting off, useID = 0. If the-U IDoption is not given, it defaults to-U 198(since Attribute 198 is generally used to monitor offline uncorrectable sectors). But if the name of this Attribute is changed by a-v 198,FORMAT,NAME(except-v 198,FORMAT,Offline_Scan_UNC_SectCt) directive, the default changes to-U 0. Careful with that exception, iykyk. β οΈ
If + is specified, a report is only printed if the number of sectors has increased since the last check cycle. Some disks do not reset this attribute when a bad sector is reallocated. See also -v 198,increasing below. π
The warning email counter is reset if the number of offline uncorrectable sectors dropped to 0. This typically happens when all offline uncorrectable sectors have been reallocated or could be read again. β¨
An offline uncorrectable sector is a disk sector which was not readable during an off-line scan or a self-test. This is important to know, because if you have data stored in this disk sector, and you need to read it, the read will fail. Periodt. π Please see the previous -C option for more details.
-W DIFF[,INFO[,CRIT]]β Report if the current temperature had changed by at least DIFF degrees since last report, or if a new min or max temperature is detected. Report or Warn if the temperature is greater or equal than one of INFO or CRIT degrees Celsius. If the limit CRIT is reached, a message with loglevelLOG_CRITwill be logged to syslog and a warning email will be sent if-mis specified. If only the limit INFO is reached, a message with loglevelLOG_INFOwill be logged. π‘οΈ
The warning email counter is reset if the temperature dropped below INFO or CRIT-5 if INFO is not specified. π§
If this directive is used in conjunction with state persistence (the -s option), the min and max temperature values are preserved across boot cycles. The minimum temperature value is not updated during the first 30 minutes after startup. Give it a sec to settle, bestie. β³
To disable any of the 3 reports, set the corresponding limit to 0. Trailing zero arguments may be omitted. By default, all temperature reports are disabled (-W 0).
To track temperature changes of at least 2 degrees, use:
-W 2
To log informal messages on temperatures of at least 40 degrees, use:
-W 0,40
For warning messages/mails on temperatures of at least 45 degrees, use:
-W 0,0,45
To combine all of the above reports, use:
-W 2,40,45
[ATA] smartd interprets Attribute 194 or 190 as Temperature Celsius by default. This can be changed to Attribute 9 or 220 by the drive database or by the -v 9,temp or -v 220,temp directive. π₯
[NVMe] smartd checks the Composite Temperature value reported by the SMART/HealthInformation log.
[NEW EXPERIMENTAL SMARTD 7.5 FIX] The individual Temperature Sensor values are no longer checked because some devices use these to report other values like maximum temperature. So that was giving lies and we fixed it. π
-F TYPEβ[ATA only]Modifies the behavior of smartd to compensate for some known and understood device firmware bug. This directive may be used multiple times. The valid arguments are:noneβ Assume that the device firmware obeys the ATA specifications. This is the default, unless the device has presets for-Fin the drive database. Using this directive will override any preset values.nologdirβ Suppresses read attempts of SMART or GP Log Directory. Support for all standard logs is assumed without an actual check. Some Intel SSDs may freeze if log address 0 is read. π§samsungβ In some Samsung disks (example: modelSV4012HFirmware Version:RM100-08) some of the two- and four-byte quantities in the SMART data structures are byte-swapped (relative to the ATA specification). Enabling this option tells smartd to evaluate these quantities in byte-reversed order. Some signs that your disk needs this option are (1) no self-test log printed, even though you have run self-tests; (2) very large numbers of ATA errors reported in the ATA error log; (3) strange and impossible values for the ATA error log timestamps. πsamsung2β In some Samsung disks the number of ATA errors reported is byte swapped. Enabling this option tells smartd to evaluate this quantity in byte-reversed order.samsung3β Some Samsung disks (at leastSP2514Nwith FirmwareVF100-37) report a self-test still in progress with 0% remaining when the test was already completed. If this directive is specified, smartd will not skip the next scheduled self-test (see Directive-sabove) in this case. πxerrorlbaβ This only affects smartctl.
[Please see the smartctl -F command-line option.]
-v ID,FORMAT[:BYTEORDER][,NAME]β[ATA only]Sets a vendor-specific raw value print FORMAT, an optional BYTEORDER and an optional NAME for Attribute ID. This directive may be used multiple times. Please seesmartctl -vcommand-line option for further details. π οΈ
The following arguments affect smartd warning output:
197,increasingβ Raw Attribute number 197 (Current Pending Sector Count) is not reset if uncorrectable sectors are reallocated. This sets-C 197+if no other-Cdirective is specified.198,increasingβ Raw Attribute number 198 (Offline Uncorrectable Sector Count) is not reset if uncorrectable sectors are reallocated. This sets-U 198+if no other-Udirective is specified.
-P TYPEβ[ATA only]Specifies whether smartd should use any preset options that are available for this drive. The valid arguments to this Directive are:useβ use any presets that are available for this drive. This is the default. βignoreβ do not use any presets for this drive. πshowβ show the presets listed for this drive in the database.showallβ show the presets that are available for all drives and then exit.
[Please see the smartctl -P command-line option.]
-aβ Equivalent to turning on all of the following Directives:-H -f -t -l error -l selftest -l selfteststs. If none of the above is given, then-ais assumed. So it's the "just give me everything" button. β¨
[ATA only] Note: for historical reasons, -C 197 -U 198 are also set by default. π«Ά
-c OPTION=VALUEβ Allows one to override smartd command line options for specific devices. Only the following OPTION is currently supported:-c i=N,-c interval=Nβ Sets the interval between disk checks to N seconds, where N is a decimal integer. The minimum allowed value isten. The default is the value from the-i N, --interval=Ncommand line option or its default of1800seconds. β°#β Comment: ignore the remainder of the line. Your lil note-to-self, fully ignored. π\β the continuation character, and she's lowkey iconic π if this is the last non-white or non-comment character on a line, then the line right after it is a continuation of the current one. that's it, that's the whole vibe.
okay bestie, if you're sitting there like "which Directives do I even use π" β genuinely, the move is to go experiment for a few minutes with smartctl and see what SMART functionality your disk(s) support(s). no cap, just poke at it.
and if you do NOT want voluminous syslog messages (valid, honestly), a good choice of smartd configuration file Directives might be: -H -l selftest -l error -f. periodt. π
but if you want more frequent information, use: -a. she's chatty. she tells you everything. πΈ
β¨ EXAMPLES OF SHELL SCRIPTS FOR '-M exec' β¨
these are two examples of shell scripts that can be used with the -M exec PATH Directive described previously (iykyk π). the paths to these scripts and similar executables is the PATH argument to the -M exec PATH Directive.
π¦ Example 1 π¦
this script is for use with -m ADDRESS -M exec PATH. it appends the output of smartctl -a to the output of the smartd email warning message and sends it to ADDRESS. so basically: email, but with receipts attached π
#! /bin/sh
# Save the email message (STDIN) to a file:
cat > /root/msg
# Append the output of smartctl -a to the message:
/usr/bin/smartctl -a -d $SMART_DEVICETYPE \
$SMARTD_DEVICE >> /root/msg
# Now email the message to the user at address ADD:
/usr/bin/mail -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS \
< /root/msg
π§ Example 2 π§
this script is for use with -m <nomailer> -M exec PATH. it warns all users about a disk problem, waits 30 seconds, and then powers down the machine. dramatic? yes. necessary? also yes π
#! /bin/sh
# Warn all users of a problem
wall <<EOF
Problem detected with disk: $SMARTD_DEVICESTRING
Warning message from smartd is: $SMARTD_MESSAGE
Shutting down machine in 30 seconds...
EOF
# Wait half a minute
sleep 30
# Power down the machine
/sbin/shutdown -hf now
some example scripts are distributed with the smartmontools package, in /usr/share/doc/smartmontools/examplescripts/. go look, they're cute π«Ά
β οΈ please note that these scripts typically run as root, so any files that they read/write should NOT be writable by ordinary users or reside in directories like /tmp that are writable by ordinary users and may expose your system to symlink attacks. bestie this is the part where you actually pay attention π
as previously described, if the scripts write to STDOUT or STDERR, this is interpreted as indicating that there was an internal error within the script, and a snippet of STDOUT/STDERR is logged to SYSLOG. the remainder is flushed. so like... don't be noisy on stdout, she'll take it personally π
π FILES π
/etc/smartmontools/smartd.confβ full path of this file. that's the one, the main character π
π SEE ALSO π
smartd(8), smartctl(8), mail(1), regex(7).
go read them, they're all part of the same little family π
π PACKAGE VERSION π
smartmontools-7.5 2025-04-30 r5714
$Id: smartd.conf.5.in 5697 2025-04-22 15:02:53Z chrfranke $
and that's a wrap, bestie π«Ά you just read the whole SMARTD.CONF(5) page, sourced from smartmontools-7.5, dated 2025-04-30 (and the footer on this one says the same thing, so consider yourself officially caught up π). now go forth and configure your disks like the icon you are β¨π
π¦ where this page comes from
- fedora 43: smartmontools 1:7.5-10.fc43
- fedora 43: smartmontools 1:7.5-11.fc43 Β· GPL-2.0-or-later
- fedora 43: smartmontools 1:7.5-4.fc43 Β· GPL-2.0-or-later
- fedora 44: smartmontools 1:7.5-10.fc44
- fedora 44: smartmontools 1:7.5-11.fc44 Β· GPL-2.0-or-later
- fedora 44: smartmontools 1:7.5-6.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms