SMARTCTL(8)

๐Ÿ’– SMARTCTL(8) โ€” SMART Monitoring Tools ๐Ÿ’–

okay bestie, welcome to the smartctl glow-up tour ๐Ÿซถ this is the Linux edition, and we're about to make your disks tell you everything.


โœจ NAME โœจ

smartctl โ€” the Control and Monitor Utility for SMART Disks ๐Ÿ‘‘


โœจ SYNOPSIS โœจ

smartctl [options] device

โœจ DESCRIPTION โœจ

heads up: this man page is generated for the Linux version of smartmontools. It does not contain info specific to other platforms. k thx.

So. smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system that's built into basically most ATA/SATA and SCSI/SAS hard drives and solid-state drives. What's SMART for? It monitors the reliability of the hard drive and predicts drive failures, and it also runs different types of drive self-tests. Iconic behaviour, honestly. ๐Ÿ’…

smartctl also supports some features that are not related to SMART, because it's versatile like that. This version of smartctl is compatible with ACS-3, ACS-2, ATA8-ACS, ATA/ATAPI-7 and earlier standards (see REFERENCES below, bestie, it's coming).

smartctl also provides support for SCSI tape drives and changers (see TAPE DRIVES below).

The user must specify the device to be controlled or interrogated as the final argument to smartctl. The command set used by the device is often derived from the device path, but sometimes it needs a lil help from the -d option (for more info see the section on "ATA, SCSI command sets and SAT" below). Device paths go like this:

  • LINUX: Use the forms /dev/sd[a-z] for ATA/SATA and SCSI/SAS devices. For SCSI Tape Drives and Changers use the devices /dev/nst* and /dev/sg*. For disks behind 3ware controllers you may need /dev/sd[a-z] or /dev/twe[0-9], /dev/twa[0-9] or /dev/twl[0-9]: see details below. For disks behind HighPoint RocketRAID controllers you may need /dev/sd[a-z]. For disks behind Areca SATA RAID controllers, you need /dev/sg[2-9] (note that smartmontools interacts with the Areca controllers via a SCSI generic device which is different than the SCSI device used for reading and writing data)! For HP Smart Array RAID controllers, there are three currently supported drivers: cciss, hpsa, and hpahcisr. For disks accessed via the cciss driver the device nodes are of the form /dev/cciss/c[0-9]d0. For disks accessed via the hpahcisr and hpsa drivers, the device nodes you need are /dev/sg[0-9]*. (lsscsi -g is helpful in determining which scsi generic device node corresponds to which device.) Use the nodes corresponding to the RAID controllers, not the nodes corresponding to logical drives. See the -d option below, as well. Use the forms /dev/nvme[0-9] (broadcast namespace) or /dev/nvme[0-9]n[1-9] (specific namespace 1-9) for NVMe devices. ๐Ÿฆ‹

If '-' is specified as the device path, smartctl reads and interprets it's own debug output from standard input. See '-r ataioctl' below for details. (yes, it reads its own debug output. main character energy tbh.)

smartctl guesses the device type if possible. If necessary, the '-d' option can be used to override this guess. ๐Ÿ”

ngl, note this: the printed output of smartctl displays most numerical values in base 10 (decimal), but some values are displayed in base 16 (hexadecimal). To distinguish them, the base 16 values are always displayed with a leading "0x", for example: "0xff". This man page follows the same convention. โœจ

โœจ OPTIONS โœจ

The options are grouped below into several categories. smartctl will execute the corresponding commands in the order: INFORMATION, ENABLE/DISABLE, DISPLAY DATA, RUN/ABORT TESTS.


๐ŸŒธ SHOW INFORMATION OPTIONS ๐ŸŒธ

  • -h, --help, --usage โ€” Prints a usage message to STDOUT and exits. bye bestie, but helpfully ๐Ÿ’–
  • -V, --version, --copyright, --license โ€” Prints version, copyright, license, home page and SVN revision information for your copy of smartctl to STDOUT and then exits. it's giving receipts ๐Ÿงพ
  • -i, --info โ€” Prints the device model number, serial number, firmware version, and ATA Standard version/revision information. Says if the device supports SMART, and if so, whether SMART support is currently enabled or disabled. If the device supports Logical Block Address mode (LBA mode) print current user drive capacity in bytes. (If drive has a user protected area reserved, or is "clipped", this may be smaller than the potential maximum drive capacity.) Indicates if the drive is in the smartmontools database (see '-v' options below). If so, the drive model family may also be printed. If '-n' (see below) is specified, the power mode of the drive is printed. ๐Ÿ’ซ

[NVMe] For NVMe devices the information is obtained from the Identify Controller and the Identify Namespace data structure.

  • --identify[=[w][nvb]] โ€” [ATA only] Prints an annotated table of the IDENTIFY DEVICE data. By default, only valid words (words not equal to 0x0000 or 0xffff) and nonzero bits and bit fields are printed. This can be changed by the optional argument which consists of one or two characters from the set 'wnvb'. The character 'w' enables printing of all 256 words. The character 'n' suppresses printing of bits, 'v' enables printing of all bits from valid words, 'b' enables printing of all bits. For example '--identify=n' (valid words, no bits) produces the shortest output and '--identify=wb' (all words, all bits) produces the longest output. choose your fighter ๐ŸŒˆ
  • -a, --all โ€” Prints all SMART information about the device.

For ATA, this is equivalent to '-H -i -c -A -l error -l selftest -l selective'. This option is no longer recommended for ATA disks because it does not enable the SMART options which require support for 48-bit ATA commands (see '-x' below). ๐Ÿ™ˆ

For SCSI, this is equivalent to '-H -i -A -l error -l selftest'.

For NVMe, this is equivalent to '-H -i -c -A -l error -l selftest'.

  • -x, --xall โ€” Prints all SMART and non-SMART information about the device. the overachiever option ๐Ÿ’…

For ATA, this is equivalent to '-H -i -g all -c -A -f brief -l xerror,error -l xselftest,selftest -l selective -l directory -l scttemp -l scterc -l devstat -l defects -l sataphy'. If '-a' is also specified, add '-l error -l selftest'. [NEW EXPERIMENTAL SMARTCTL 7.5 FIX] '-g wcreorder' is no longer included because it is not possible to check whether this feature is supported by the drive.

For SCSI disks, this is equivalent to '-H -i -g all -A -l error -l selftest -l background -l sasphy -l defects -l envrep -l genstats -l ssd -l zdevstat' and for SCSI tape drives and changers, add '-l tapedevstat'.

For NVMe, this is equivalent to '-H -i -c -A -l error -l selftest'.

  • --scan โ€” Scans for devices and prints each device name, device type and protocol ([ATA] or [SCSI]) info. May be used in conjunction with '-d TYPE' to restrict the scan to a specific TYPE. See also info about platform specific device scan and the DEVICESCAN directive on smartd(8) man page. ๐Ÿ•ต๏ธโ™€๏ธ
  • --scan-open โ€” Same as --scan, but also tries to open each device before printing device info. The device open may change the device type due to autodetection (see also '-d test').

This option can be used to create a draft smartd.conf file. All options after '--' are appended to each output line. For example:

smartctl --scan-open -- -a -W 4,45,50 -m admin@work > smartd.conf

Multiple '-d TYPE' options may be specified with '--scan[-open]' to combine the scan results of more than one TYPE. ๐Ÿ”ฅ

  • -g NAME, --get=NAME โ€” Get non-SMART device settings. See '-s, --set' below for further info.

๐ŸŒˆ RUN-TIME BEHAVIOR OPTIONS ๐ŸŒˆ

  • -j, --json[=cgiosuvy] โ€” Enables JSON or YAML output mode. the data girlies ate with this one โœจ

The output could be modified or enhanced by the optional argument which consists of one or more characters from the set 'cgiosuvy':

  • 'c': Outputs compact format without extra spaces and newlines. By default, output is pretty-printed. If used with YAML format, the indentation of arrays is reduced.
  • 'g': Outputs JSON structure as single assignments to allow the usage of grep. Each assignment reflects the absolute path of a value. The syntax is compatible with gron: 'json.KEY1[INDEX2].KEY3 = VALUE;'.
  • 'o': Includes the full original plaintext output of smartctl as a JSON array 'smartctl.output[]'.
  • 's': Outputs JSON object elements sorted by key. By default, object elements are ordered as generated internally.
  • 'v': Enables verbose output of possible unsafe integers. If specified, values which may exceed JSON safe integer (53-bit) range are always output as a number (with some 'KEY') and a string ('KEY_s'), regardless of the actual value. Values which may exceed 64-bit range are also output as a little endian byte array ('KEY_le'). By default, the additional elements are only output if the value actually exceeds the range.
  • 'y': Outputs in YAML format.

The following two arguments are primarily intended for development:

  • 'i': Includes lines from the plaintext output which print info already implemented for JSON output. The lines appear as strings with key 'smartctl_NNNN_i'.
  • 'u': Includes lines from the plaintext output which print info still unimplemented for JSON output. The lines appear as strings with key 'smartctl_NNNN_u'.
  • -q TYPE, --quietmode=TYPE โ€” Specifies that smartctl should run in one of the quiet modes described here. The valid arguments to this option are:
    • errorsonly โ€” only print: For the '-l error' option, if nonzero, the number of errors recorded in the SMART error log and the power-on time when they occurred; For the '-l selftest' option, errors recorded in the device self-test log; For the '-H' option, SMART "disk failing" status or device Attributes (pre-failure or usage) which failed either now or in the past; For the '-A' option, device Attributes (pre-failure or usage) which failed either now or in the past.
    • silent โ€” print no output. The only way to learn about what was found is to use the exit status of smartctl (see EXIT STATUS below). ๐Ÿคซ

okay that's part 1 bestie, and there's so much more coming ๐Ÿ’– don't go anywhere ๐ŸŽ€

Do not print the serial number of the device. This also suppresses the LU WWN Device Id (ATA) and the SAS addresses (SCSI). The related fields are also invalidated in the ATA and NVMe debug outputs.

Note: This is not the case in SCSI debug output. ๐Ÿ’€

[NEW EXPERIMENTAL SMARTCTL 7.4 FEATURE] The Namespace IEEE EUI-64 (NVMe) is also suppressed. โœจ

[NEW EXPERIMENTAL SMARTCTL 7.5 FEATURE] The Serial Number and World Wide Name from the FARM log (see -l farm below) are also suppressed, except for the debug output. ๐Ÿซถ

  • -d TYPE, --device=TYPE โ€” tells smartctl exactly what kind of device it's looking at, bestie. No guessing games. The valid arguments to this option are:
    • auto โ€” try to guess the device type from the device name, or from controller type info the OS hands over, or from a matching USB ID entry in the drive database. This is the default, and honestly? It's giving main character energy. ๐Ÿ‘‘
    • test โ€” prints the guessed TYPE, then opens the device and prints the (possibly changed) TYPE name, then exits without doing anything else. Literally just a vibe check on the device type, no cap. ๐Ÿงš
    • ata โ€” the device type is ATA. This stops smartctl from throwing SCSI commands at an ATA device. periodt. ๐Ÿ’…
    • scsi โ€” the device type is SCSI. This stops smartctl from throwing ATA commands at a SCSI device. slay. ๐ŸŒธ
    • nvme[,NSID] โ€” the device type is NVM Express (NVMe). The optional parameter NSID specifies the namespace id (in hex) passed to the driver. Use 0xffffffff for 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 one's for ATA disks that have a SCSI to ATA Translation Layer (SATL) sitting between the disk and the OS. 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, and you can override that 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. iykyk. ๐Ÿ”ฅ

  • usbasm1352r,PORT โ€” [NEW EXPERIMENTAL SMARTCTL 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 (0 or 1) selects the disk to monitor.
Note: This USB bridge also supports -d sat. That monitors either the first disk, or the second disk if no disk is connected to the first port. ๐Ÿ™ˆ
  • usbcypress โ€” this device type is for ATA disks that are behind a Cypress USB to PATA bridge. This will use the ATACB proprietary scsi pass through command. The default SCSI operation code is 0x24, 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. โš ๏ธ bestie pls be careful.
  • usbjmicron[,p][,x][,PORT] โ€” this device type is 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 (0 or 1) 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/ice names then.

CAUTION: Specifying ,x for a device which does not support it results in I/O errors and may disconnect the drive. The same applies 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 โ€” this device type is for SATA disks that are behind a Prolific PL2571/2771/2773/2775 USB to SATA bridge. โœจ
  • usbsunplus โ€” this device type is for SATA disks that are behind a SunplusIT USB to SATA bridge. ๐Ÿฆ‹
  • sntasmedia[/sat] โ€” this device type is for NVMe disks that are behind an ASMedia USB to NVMe bridge.

[NEW EXPERIMENTAL SMARTCTL 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. ๐ŸŽ€

  • sntjmicron[,NSID][/sat] โ€” this device type is 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 sntasmedia for the /sat suffix. ๐Ÿ’œ
  • sntrealtek[/sat] โ€” this device type is for NVMe disks that are behind a Realtek USB to NVMe bridge. See also -d sntasmedia for the /sat suffix. โญ
  • marvell โ€” [Linux only] (deprecated and subject to remove). ๐Ÿชฆ it's giving legacy.
  • 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 of 0 to 127 inclusive) denotes which disk on the controller is monitored. This interface will also work for Dell PERC controllers. Use syntax such as:
smartctl -a -d megaraid,2 /dev/sda
smartctl -a -d megaraid,0 /dev/sdb
smartctl -a -d megaraid,0 /dev/bus/0

It is possible to set RAID device name as /dev/bus/N, where N is a SCSI bus number.

The following entry in /proc/devices must exist: For PERC2/3/4 controllers: megadevN For PERC5/6 controllers: megaraid_sas_ioctlN

  • 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. Use syntax such as:
smartctl -a -d aacraid,0,0,2 /dev/sda
smartctl -a -d aacraid,1,0,4 /dev/sdb

Option -d sat,auto+... is implicitly enabled to detect SATA disks. Use -d scsi+aacraid,H,L,ID to disable it.

On Linux, the following entry in /proc/devices must exist: aac. Character device nodes /dev/aacH (H=Host number) are created if required. ๐Ÿ”ฅ

  • 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 from 0 to 127 inclusive) denotes which disk on the controller is monitored. Use syntax such as:
smartctl -a -d 3ware,2 /dev/sda  [Linux only]
smartctl -a -d 3ware,0 /dev/twe0
smartctl -a -d 3ware,1 /dev/twa0
smartctl -a -d 3ware,1 /dev/twl0 [Linux only]
smartctl -a -d 3ware,1 /dev/tws0 [FreeBSD only]

The first two forms, which refer to devices /dev/sda-z (deprecated) and /dev/twe0-15, may be used with 3ware series 6000, 7000, and 8000 series controllers that use the 3x-xxxx driver. The devices /dev/twa0-15 must be used with 3ware 9000 series controllers, which use the 3w-9xxx driver. The devices /dev/twl0-15 [Linux] or /dev/tws0-15 [FreeBSD] must be used with the 3ware/LSI 9750 series controllers which use the 3w-sas driver. ๐Ÿซถ

Note that if the special character device nodes /dev/tw[ls]?, /dev/twa? and /dev/twe? do not exist, or exist with the incorrect major or minor numbers, smartctl will recreate them on the fly. iconic behaviour honestly. โœจ

  • 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 from 1 to 24 inclusive) denotes which disk on the controller is monitored. On Linux use syntax such as:
smartctl -a -d areca,2 /dev/sg2
smartctl -a -d areca,3 /dev/sg3

The first line above addresses the second disk on the first Areca RAID controller. The second line addresses the third disk on the second Areca RAID controller. To help identify the correct device on Linux, use the command:

cat /proc/scsi/sg/device_hdr /proc/scsi/sg/devices

to show the SCSI generic devices (one per line, starting with /dev/sg0). The correct SCSI generic devices to address for smartmontools are the ones with the type field equal to 3. If the incorrect device is addressed, please read the warning/error messages carefully. They should provide hints about what devices to use. ๐Ÿ‘€

Important: the Areca controller must have firmware version 1.46 or later. Lower-numbered firmware versions will give (harmless) SCSI error messages and no SMART information. ๐Ÿ˜ญ
  • 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 (range 1 to 128) denotes the channel (slot) and E (range 1 to 8) denotes the enclosure.
Important: This requires Areca SAS controller firmware version 1.51 or later. ๐Ÿ’…
  • 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 from 0 to 127 inclusive) denotes which disk on the controller is monitored.

Option -d sat,auto+... is implicitly enabled to detect SATA disks. Use -d scsi+cciss,N to disable it.

To look at disks behind HP Smart Array controllers, use syntax such as:

smartctl -a -d cciss,0 /dev/cciss/c0d0    (cciss driver under Linux)
smartctl -a -d cciss,0 /dev/sg2    (hpsa or hpahcisr drivers under Linux)
  • hpt,L/M/N โ€” [FreeBSD and Linux only] this device is likeโ€ฆ a whole squad of ATA disks all connected to one HighPoint RocketRAID controller. ๐Ÿ’ซ The integer L is the controller id, M is the channel number, and N is the PMPort number (if it's available). Allowed values: L goes from 1 to 4 inclusive, M from 1 to 128 inclusive, and N from 1 to 4 if PMPort is available. Oh and also โ€” these ranges get limited by whatever model of HighPoint RocketRAID controller you've got, bestie. Use syntax like:
smartctl -a -d hpt,1/3 /dev/sda    (under Linux)
smartctl -a -d hpt,1/2/3 /dev/sda    (under Linux)

Heads up: the /dev/sda-z form should be the device node that stands for the disks derived from the HighPoint RocketRAID controllers under Linux, and under FreeBSD it's the character device which the driver registered (eg, /dev/hptrr, /dev/hptmv6). ๐Ÿฆ‹

  • sssraid,E,S โ€” [Linux only: NEW EXPERIMENTAL SMARTCTL 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 of 0 to 8) denotes the enclosure, and S (range 0 to 128) denotes the slot. Use syntax like:
smartctl -a -d sssraid,0,1 /dev/bsg/sssraid0

It's possible to set RAID device name as /dev/bsg/sssraidN, where N is a SCSI bus number. ๐Ÿ‘‘

  • intelliprop,N[+TYPE] โ€” (deprecated and subject to remove). ๐Ÿ’€
  • jmb39x[-q[2]],N[,sLBA][,force][+TYPE] โ€” the device consists of multiple SATA disks connected to a JMicron JMB39x RAID port multiplier. The suffix -q selects a slightly different command variant used by QNAP TR-004 NAS devices. The integer N is the port number from 0 to 4.

[NEW EXPERIMENTAL SMARTCTL 7.5 FEATURE] The suffix -q2 selects another command variant used by QNAP TR-002 NAS devices.

WARNING: The ATA pass-through commands are issued via READ/WRITE commands to a LBA of the RAID volume. Using this option with other devices may overwrite this sector. ๐Ÿ˜ญ

The default LBA is 33. The LBA could be selected in the range from 1 to 255 inclusive.

If a GPT partition table is used, LBA 33 contains the last 4 (of 128) entries of the partition table. These entries are zero filled in most cases. If a MBR partition table is used, LBA 33 may be zero filled or may contain code from a boot loader.

By default, access to the device is refused if the selected sector is not zero filled. The force flag disables this check.

WARNING: Original sector data is not written back if smartctl is aborted with a signal. ๐Ÿซถ
  • jms56x,N[,sLBA][,force][+TYPE] โ€” the device consists of multiple SATA disks connected to a JMicron JMS56x USB to SATA RAID bridge. See jmb39x... above for valid arguments. โœจ

โœจ -T TYPE, --tolerance=TYPE โœจ

[ATA only] Specifies how tolerant smartctl should be of ATA and SMART command failures.

The behavior of smartctl depends upon whether the command is "optional" or "mandatory". Here "mandatory" means "required by the ATA Specification if the device implements the SMART command set" and "optional" means "not required by the ATA Specification even if the device implements the SMART command set." The "mandatory" ATA and SMART commands are:

  1. ATA IDENTIFY DEVICE
  2. SMART ENABLE/DISABLE ATTRIBUTE AUTOSAVE
  3. SMART ENABLE/DISABLE
  4. SMART RETURN STATUS

The valid arguments to this option are:

  • normal โ€” exit on failure of any mandatory SMART command, and ignore all failures of optional SMART commands. This is the default. Ngl, on some devices, issuing unimplemented optional SMART commands doesn't cause an error. This can result in misleading smartctl messages like "Feature X not implemented", followed shortly by "Feature X: enabled". In most such cases, contrary to the final message, Feature X is not enabled. ๐Ÿ’€
  • conservative โ€” exit on failure of any optional SMART command.
  • permissive โ€” ignore failure(s) of mandatory SMART commands. This option may be given more than once. Each additional use of this option will cause one more additional failure to be ignored. Note that the use of this option can lead to messages like "Feature X not supported", followed shortly by "Feature X enable failed". In a few such cases, contrary to the final message, Feature X is enabled. ๐Ÿ™ˆ
  • verypermissive โ€” equivalent to giving a large number of -T permissive options: ignore failures of any number of mandatory SMART commands. Please see the note above. โœจ

โœจ -b TYPE, --badsum=TYPE โœจ

[ATA only] Specifies the action smartctl should take if a checksum error is detected in the:

  1. Device Identity Structure
  2. SMART Self-Test Log Structure
  3. SMART Attribute Value Structure
  4. SMART Attribute Threshold Structure
  5. ATA Error Log Structure

The valid arguments to this option are:

  • warn โ€” report the incorrect checksum but carry on in spite of it. This is the default. ๐ŸŒธ
  • exit โ€” exit smartctl. ๐Ÿ˜ญ
  • ignore โ€” continue silently without issuing a warning. ๐Ÿคซ

โœจ -r TYPE, --report=TYPE โœจ

Intended primarily to help smartmontools developers understand the behavior of smartmontools on non-conforming or poorly conforming hardware. This option reports details of smartctl transactions with the device. The option can be used multiple times. When used just once, it shows a record of the ioctl() transactions with the device. When used more than once, the detail of these ioctl() transactions are reported in greater detail. The valid arguments to this option are:

  • ioctl โ€” report all ioctl() transactions. ๐Ÿ’…
  • ataioctl โ€” report only ioctl() transactions with ATA devices.
  • scsiioctl โ€” report only ioctl() transactions with SCSI devices. Invoking this once shows the SCSI commands in hex and the corresponding status. Invoking it a second time adds a hex listing of the first 64 bytes of data send to, or received from the device. ๐Ÿ”ฅ
  • nvmeioctl โ€” report only ioctl() transactions with NVMe devices.

Any argument may include a positive integer to specify the level of detail that should be reported. The argument should be followed by a comma then the integer with no spaces. For example, ataioctl,2 The default level is 1, so -r ataioctl,1 and -r ataioctl are equivalent.

For testing purposes, the output of -r ataioctl,2 can later be parsed by smartctl itself if - is used as device path argument. The ATA command input parameters, sector data and return values are reconstructed from the debug report read from stdin. Then smartctl internally simulates an ATA device with the same behaviour. This is does not work for SCSI devices yet. โญ


โœจ -n POWERMODE[,STATUS[,STATUS2]], --nocheck=POWERMODE[,STATUS[,STATUS2]] โœจ

[ATA, SCSI] Specifies if smartctl should exit before performing any checks when the device is in a low-power mode. It may be used to prevent a disk from being spun-up by smartctl. The power mode is ignored by default.

Note: If this option is used it may also be necessary to specify the device type with the -d option. Otherwise the device may spin up due to commands issued during device type autodetection. ๐ŸŒ€

By default, exit status 2 is returned if the device is in one of the specified low-power modes. This status is also returned if the device open or identification failed (see EXIT STATUS below). The optional STATUS parameter allows one to override this default. STATUS is an integer in the range from 0 to 255 inclusive. For example use -n standby,0 to return success if a device is in SLEEP or STANDBY mode. Use -n standby,3 to return a unique exit status in this case. ๐Ÿ’–

The valid arguments to this option are:

  • never โ€” check the device always, but print the power mode if -i is specified.
  • sleep[,STATUS[,STATUS2]] โ€” check the device unless it is in SLEEP mode.
  • standby[,STATUS[,STATUS2]] โ€” 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 disk from spinning up, this is probably what you want. ๐Ÿ‘‘
  • idle[,STATUS[,STATUS2]] โ€” check the device unless it is in SLEEP, STANDBY or IDLE mode. In the IDLE state, most disks are still spinning, so this is probably not what you want. ๐Ÿ’€

The -n option is ignored if the power mode check is not supported or returns an unknown value.

[ATA only] If the optional STATUS2 parameter is specified, smartctl exits immediately with STATUS2 in this case. For example use -n standby,3,5 to return unique exit statuses in the STANDBY and UNSUPPORTED cases. โœจ


๐ŸŒˆ SMART FEATURE ENABLE/DISABLE COMMANDS: ๐ŸŒˆ

Note: if multiple options are used to both enable and disable a feature, then both the enable and disable commands will be issued. The enable command will always be issued before the corresponding disable command. ๐ŸŽ€

โœจ -s VALUE, --smart=VALUE โœจ

Enables or disables SMART on device. The valid arguments to this option are on and off.

[ATA] Note that the ATA commands SMART ENABLE/DISABLE OPERATIONS were declared obsolete in ATA ACS-4 Revision 10 (Nov 2015). ๐Ÿ’€

[SCSI tape drive or changer] It is not necessary (or useful) to enable SMART to see the TapeAlert messages. ๐Ÿฆ‹


โœจ -o VALUE, --offlineauto=VALUE โœจ

[ATA only] Enables or disables SMART automatic offline test, which scans the drive every four hours for disk defects. This command can be given during normal system operation. The valid arguments to this option are on and off. โœจ

ok so important lore drop: the SMART automatic offline test command is listed as "Obsolete" in every version of the ATA and ATA/ATAPI Specifications ๐Ÿ’€. It was originally part of the SFF-8035i Revision 2.0 specification, but it was never part of any ATA specification. That said, vendors implemented it anyway and use it a lot. The way you can tell if automatic offline testing is supported is by seeing whether this command enables and disables it โ€” that shows up in the 'Auto Offline Data Collection' part of the SMART capabilities report (the one you get with -c). ๐Ÿซถ

SMART gives you three basic categories of testing, bestie. Sit with me for a sec:

The first category is called "online" testing, and it literally has no effect on the performance of the device. It gets turned on with the -s on option. Slay. โœจ

The second category is "offline" testing. This one can, in principle, degrade the device performance ๐Ÿ˜ญ. The -o on option makes this offline testing happen automatically on a regular scheduled basis. Normally though, the disk suspends offline testing while disk accesses are going on, then auto-resumes it when the disk would otherwise just be sitting there idle โ€” so in practice it barely does anything. Also, a one-time offline test can be carried out immediately upon receipt of a user command. See the -t offline option below, which does exactly that: one-time offline test, right now, immediately. ๐Ÿ’…

The choice of the word testing for these first two categories (made by the SFF-8035i and ATA specification authors, not me) is genuinely unfortunate and leads to so much confusion. Real talk, those first two categories โ€” online and offline testing โ€” could have been more accurately described as online and offline data collection. ๐ŸŒธ

The results of this automatic or immediate offline testing (data collection) are reflected in the values of the SMART Attributes. So if problems or errors get detected, those Attribute values will drop below their failure thresholds; some types of errors may also show up in the SMART error log. You can see those with the -A and -l error options respectively. ๐Ÿ‘‘

Some SMART attribute values only get updated during off-line data collection activities; the rest get updated during normal operation of the device, or during both normal operation and off-line testing. The Attribute value table produced by the -A option tells you which is which in the UPDATED column. Attributes of the first type are labeled "Offline" and attributes of the second type are labeled "Always".

The third category of testing โ€” and the only category where the word 'testing' is really an appropriate choice โ€” is "self" testing. This third type of test is only performed (immediately) when a command to run it is issued. The -t and -X options can be used to carry out and abort such self-tests; more on that below, keep reading. ๐Ÿฆ‹

Any errors detected in the self testing will show up in the SMART self-test log, which you can examine using the -l selftest option.

Note: in this manual page, the word "Test" is used in connection with that second category we just described, e.g. for the "offline" testing. The words "Self-test" are used in connection with the third category. iykyk ๐ŸŽ€

  • -S VALUE, --saveauto=VALUE โ€” [ATA] Enables or disables SMART autosave of device vendor-specific Attributes. The valid arguments to this option are on and off. Heads up: this feature is preserved across disk power cycles, so you should only need to issue it once. ๐Ÿ’–

The ATA standard does not specify a method to check whether SMART autosave is enabled. Unlike SCSI (below), smartctl is unable to print a warning if autosave is disabled. ๐Ÿ™ˆ

Note that the ATA commands SMART ENABLE/DISABLE AUTOSAVE were declared obsolete in ATA ACS-4 Revision 10 (Nov 2015). ๐Ÿ’€

[SCSI] For SCSI devices this toggles the value of the Global Logging Target Save Disabled (GLTSD) bit in the Control Mode Page. Some disk manufacturers set this bit by default. This prevents error counters, power-up hours and other useful data from being placed in non-volatile storage, so these values may be reset to zero the next time the device is power-cycled ๐Ÿ˜ญ. If the GLTSD bit is set then smartctl -a will issue a warning. Use on to clear the GLTSD bit and thus enable saving counters to non-volatile storage. For extreme streaming-video type applications you might consider using off to set the GLTSD bit. ๐ŸŒˆ

  • -g NAME, --get=NAME, -s NAME[,VALUE], --set=NAME[,VALUE] โ€” Gets/sets non-SMART device settings. Note that the --set option shares its short option -s with --smart. The valid arguments are, and I'm listing them all because you deserve the full tea: ๐Ÿซ–
    • all โ€” Gets all values. This is equivalent to
-g aam -g apm -g lookahead -g security -g wcache -g rcache -g dsn
  • aam[,N|off] โ€” [ATA only] Gets/sets the Automatic Acoustic Management (AAM) feature (if supported). A value of 128 sets the most quiet (slowest) mode and 254 the fastest (loudest) mode, off disables AAM. Devices may support intermediate levels. Values below 128 are defined as vendor specific (0) or retired (1 to 127). Note that the AAM feature was declared obsolete in ATA ACS-2 Revision 4a (Dec 2010). ๐Ÿ’€
  • apm[,N|off] โ€” [ATA only] Gets/sets the Advanced Power Management (APM) feature on device (if supported). If a value between 1 and 254 is provided, it will attempt to enable APM and set the specified value, off disables APM. Note the actual behavior depends on the drive โ€” for example some drives disable APM if their value is set above 128. Values below 128 are supposed to allow drive spindown, values 128 and above adjust only head-parking frequency, although the actual behavior defined is also vendor-specific. ๐Ÿ™ƒ
  • lookahead[,on|off] โ€” [ATA only] Gets/sets the read look-ahead feature (if supported). Read look-ahead is usually enabled by default.
  • security โ€” [ATA only] Gets the status of ATA Security feature (if supported). If ATA Security is enabled an ATA user password is set. The drive will be locked on next reset then. ๐Ÿ”’
  • security-freeze โ€” [ATA only] Sets ATA Security feature to frozen mode. This prevents the drive from accepting any security commands until next reset. Note that the frozen mode may already be set by BIOS or OS.
  • standby,[N|off] โ€” [ATA] Sets the standby (spindown) timer and places the drive in the IDLE mode. A value of 0 or off disables the standby timer. Values from 1 to 240 specify timeouts from 5 seconds to 20 minutes in 5 second increments. Values from 241 to 251 specify timeouts from 30 minutes to 330 minutes in 30 minute increments. Value 252 specifies 21 minutes. Value 253 specifies a vendor specific time between 8 and 12 hours. Value 255 specifies 21 minutes and 15 seconds. Some drives may use a vendor specific interpretation for the values. Note that there is no get option because ATA standards do not specify a method to read the standby timer. If -s standby,now is also specified, the drive is immediately placed in the STANDBY mode without temporarily placing it in the IDLE mode. Note that ATA standards do not specify a command to set the standby timer without affecting the power mode. ๐Ÿ˜ฎโ€๐Ÿ’จ [SCSI] Only the set option with standby,off or standby,0 is accepted and will place the SCSI disk into "ACTIVE" power condition.
  • standby,now โ€” [ATA] Places the drive in the STANDBY mode. This usually spins down the drive. The setting of the standby timer is not affected unless -s standby,[N|off] is also specified. [SCSI] Only the set option is accepted and will place the SCSI disk into "STANDBY_Z" power condition.
  • wcache[,on|off] โ€” [ATA] Gets/sets the volatile write cache feature (if supported). The write cache is usually enabled by default.
  • wcache[,on|off] โ€” [SCSI] Gets/sets the 'Write Cache Enable' (WCE) bit (if supported). The write cache is usually enabled by default.
  • wcache-sct[,ata|on|off[,p]] โ€” [ATA only] Gets/sets the write cache feature through SCT Feature Control (if supported). The state of write cache in SCT Feature Control could be "Controlled by ATA", "Force Enabled", or "Force Disabled". SCT Feature control overwrites the setting by ATA Set Features command (wcache[,on|off] option). If SCT Feature Control sets write cache as "Force Enabled" or "Force Disabled", the setting of wcache[,on|off] is ignored by the drive. SCT Feature Control usually sets write cache as "Controlled by ATA" by default. If ,p is specified, the setting is preserved across power cycles. ๐Ÿ”ฅ
  • wcreorder[,on|off[,p]] โ€” [ATA only] Gets/sets Write Cache Reordering. If it is disabled (off), disk write scheduling is executed on a first-in-first-out (FIFO) basis. If Write Cache Reordering is enabled (on), then disk write scheduling may be reordered by the drive. If write cache is disabled, the current Write Cache Reordering state is remembered but has no effect on non-cached writes, which are always written in the order received. The state of Write Cache Reordering has no effect on either NCQ or LCQ queued commands. If ,p is specified, the setting is preserved across power cycles.
  • rcache[,on|off] โ€” [SCSI only] Gets/sets the 'Read Cache Disable' (RCE) bit. 'Off' value disables read cache (if supported). The read cache is usually enabled by default.
  • dsn[,on|off] โ€” [ATA only] Gets/sets the DSN feature (if supported). The dsn is usually disabled by default.

โœจ SMART READ AND DISPLAY DATA OPTIONS โœจ

  • -H, --health โ€” Prints the health status of the device. ๐Ÿ’–

If the device reports failing health status, that means either the device has already failed, or it's predicting its own failure within the next 24 hours ๐Ÿ˜ญ. If that happens, use the -x option to get more information, and get your data off the disk and to someplace safe as soon as you can. Like, immediately. fr fr. ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ

[ATA] Health status comes from checking the (boolean) result that the SMART RETURN STATUS command hands back. But lowkey, that return value can be โœจmysteriousโœจ because of limitations or bugs in some layer sitting between your disk and your OS (think RAID controller or USB bridge firmware ๐Ÿ‘€). When that happens, smartctl prints a warning and then checks whether any Prefailure SMART Attribute value is less than or equal to its threshold (peep the '-A' below ๐Ÿ‘‡).

[SCSI] Health status comes from checking the Additional Sense Code (ASC) and Additional Sense Code Qualifier (ASCQ) from the Informal Exceptions (IE) log page โ€” if it's supported โ€” and/or from SCSI sense data.

[SCSI tape drive or changer] The TapeAlert status comes from reading the TapeAlert log page, but only if you give this option twice (the TAPE DRIVES section explains why, iykyk).

[NVMe] NVMe status comes from reading the "Critical Warning" byte out of the SMART/Health Information log.

  • -c, --capabilities โ€” [ATA] Prints only the generic SMART capabilities. These show what SMART features are implemented and how your device will respond to some of the different SMART commands. Like, it shows if the device logs errors, if it supports offline surface scanning, and so on bestie. If the device can run self-tests, this option also shows the estimated time required to run those tests โฑ๏ธ.

[NVMe] Prints various NVMe device capabilities obtained from the Identify Controller and the Identify Namespace data structure.

  • -A, --attributes โ€” [ATA] Prints only the vendor specific SMART Attributes. The Attributes are numbered from 1 to 253 and have specific names and ID numbers. For example Attribute 12 is "power cycle count": how many times has the disk been powered up ๐Ÿ’….

Each Attribute has a "Raw" value, printed under the heading "RAW_VALUE", and a "Normalized" value printed under the heading "VALUE". [Note: smartctl prints these values in base-10.] In the example just given, the "Raw Value" for Attribute 12 would be the actual number of times that the disk has been power-cycled โ€” for example 365 if the disk has been turned on once per day for exactly one year ๐ŸŽ‚. Each vendor uses their own algorithm to convert this "Raw" value to a "Normalized" value in the range from 1 to 254. Please keep in mind that smartctl only reports the different Attribute types, values, and thresholds as read from the device. It does not carry out the conversion between "Raw" and "Normalized" values: that's the disk's firmware doing its thing, not us ๐Ÿ™…โ€โ™€๏ธ.

The conversion from Raw value to a quantity with physical units is not specified by the SMART standard. In most cases, the values printed by smartctl are sensible. For example the temperature Attribute generally has its raw value equal to the temperature in Celsius ๐ŸŒก๏ธ. However in some cases vendors use unusual conventions. For example the Hitachi disk on my laptop reports its power-on hours in minutes, not hours ๐Ÿ˜ญ. Some IBM disks track three temperatures rather than one, in their raw values. And so on.

Each Attribute also has a Threshold value (whose range is 0 to 255) which is printed under the heading "THRESH". If the Normalized value is less than or equal to the Threshold value, then the Attribute is said to have failed. If the Attribute is a pre-failure Attribute, then disk failure is imminent ๐Ÿ’€.

Each Attribute also has a "Worst" value shown under the heading "WORST". This is the smallest (closest to failure) value that the disk has recorded at any time during its lifetime when SMART was enabled. [Note however that some vendors firmware may actually increase the "Worst" value for some "rate-type" Attributes.]

The Attribute table printed out by smartctl also shows the "TYPE" of the Attribute. Attributes are one of two possible types: Pre-failure or Old age. Pre-failure Attributes are ones which, if less than or equal to their threshold values, indicate pending disk failure. Old age, or usage Attributes, are ones which indicate end-of-product life from old-age or normal aging and wearout, if the Attribute value is less than or equal to the threshold. Please note: the fact that an Attribute is of type 'Pre-fail' does not mean that your disk is about to fail! It only has this meaning if the Attribute's current Normalized value is less than or equal to the threshold value. Periodt.

If the Attribute's current Normalized value is less than or equal to the threshold value, then the "WHEN_FAILED" column will display "FAILING_NOW". If not, but the worst recorded value is less than or equal to the threshold value, then this column will display "In_the_past". If the "WHEN_FAILED" column has no entry (indicated by a dash: '-') then this Attribute is OK now (not failing) and has also never failed in the past ๐Ÿซถ.

The table column labeled "UPDATED" shows if the SMART Attribute values are updated during both normal operation and off-line testing, or only during offline testing. The former are labeled "Always" and the latter are labeled "Offline".

So to summarize โœจ: the Raw Attribute values are the ones that might have a real physical interpretation, such as "Temperature Celsius", "Hours", or "Start-Stop Cycles". Each manufacturer converts these, using their detailed knowledge of the disk's operations and failure modes, to Normalized Attribute values in the range 1โ€“254. The current and worst (lowest measured) of these Normalized Attribute values are stored on the disk, along with a Threshold value that the manufacturer has determined will indicate that the disk is going to fail, or that it has exceeded its design age or aging limit. smartctl does not calculate any of the Attribute values, thresholds, or types โ€” it merely reports them from the SMART data on the device. We're just the messenger ๐Ÿ’….

Note that starting with ATA/ATAPI-4, revision 4, the meaning of these Attribute fields has been made entirely vendor-specific. However most newer ATA/SATA disks seem to respect their meaning, so we have retained the option of printing the Attribute values.

Solid-state drives use different meanings for some of the attributes. In this case the attribute name printed by smartctl is incorrect unless the drive is already in the smartmontools drive database ๐Ÿ‘€.

Note that the ATA command SMART READ DATA was declared obsolete in ATA ACS-4 Revision 10 (Nov 2015).

[SCSI] For SCSI devices the "attributes" are obtained from the temperature and start-stop cycle counter log pages. Certain vendor specific attributes are listed if recognised. The attributes are output in a relatively free format (compared with ATA disk attributes).

[NVMe] For NVMe devices the attributes are obtained from the SMART/Health Information log. [NEW EXPERIMENTAL SMARTCTL 7.5 FEATURE] If the device indicates support for SMART/Health Information per namespace, the id of the namespace addressed by the device name is used, otherwise the id of the broadcast namespace.

  • -f FORMAT, --format=FORMAT โ€” [ATA only] Selects the output format of the attributes:
    • old โ€” Old smartctl format. This is the default unless the '-x' option is specified.
    • brief โ€” New format which fits into 80 columns (except in some rare cases). This format also decodes four additional attribute flags. This is the default if the '-x' option is specified.
    • hex,id โ€” Print all attribute IDs as hexadecimal numbers.
    • hex,val โ€” Print all normalized values as hexadecimal numbers.
    • hex โ€” Same as '-f hex,id -f hex,val'.
  • -l TYPE, --log=TYPE โ€” Prints various device logs ๐Ÿ“œ. The valid arguments to this option are:
    • error โ€” [ATA] prints the Summary SMART error log. SMART disks maintain a log of the most recent five non-trivial errors. For each of these errors, the disk power-on lifetime at which the error occurred is recorded, as is the device status (idle, standby, etc) at the time of the error. For some common types of errors, the Error Register (ER) and Status Register (SR) values are decoded and printed as text. The meanings of these are:
ABRT:  Command ABoRTed
AMNF:  Address Mark Not Found
CCTO:  Command Completion Timed Out
EOM:   End Of Media
ICRC:  Interface Cyclic Redundancy Code (CRC) error
IDNF:  IDentity Not Found
ILI:   (packet command-set specific)
MC:    Media Changed
MCR:   Media Change Request
NM:    No Media
obs:   obsolete
TK0NF: TracK 0 Not Found
UNC:   UNCorrectable Error in Data
WP:    Media is Write Protected

In addition, up to the last five commands that preceded the error are listed, along with a timestamp measured from the start of the corresponding power cycle. This is displayed in the form Dd+HH:MM:SS.msec where D is the number of days, HH is hours, MM is minutes, SS is seconds and msec is milliseconds. [Note: this time stamp wraps after 2^32 milliseconds, or 49 days 17 hours 2 minutes and 47.296 seconds.] The key ATA disk registers are also recorded in the log. The final column of the error log is a text-string description of the ATA command defined by the Command Register (CR) and Feature Register (FR) values. Commands that are obsolete in the most current spec are listed like this: READ LONG (w/ retry) [OBS-4], indicating that the command became obsolete with or in the ATA-4 specification. Similarly, the notation [RET-N] is used to indicate that a command was retired in the ATA-N specification. Some commands are not defined in any version of the ATA specification but are in common use nonetheless; these are marked [NS], meaning non-standard.

  • error โ€” [SCSI] prints the error counter log pages for reads, write and verifies. The verify row only shows up if it's got an element that isn't zero, bestie. no empty rows here ๐Ÿ’…
  • error[,NUM] โ€” [NVMe] prints the NVMe Error Information log. By default you only get the 16 most recent log entries โ€” that's it, that's the default. Wanna change it? Toss in the optional NUM parameter. The max number of log entries is vendor specific (in the range from 1 to 256 inclusive).
ok so real talk โ€” the contents of this log are not preserved across power cycles or controller resets. But the value of 'Error Information Log Entries' from the SMART/Health Information log is. so there's that ๐Ÿซถ
  • xerror[,NUM][,error] โ€” [ATA only] prints the Extended Comprehensive SMART error log (General Purpose Log address 0x03). And no, it's not the same as the Summary SMART error log (that's -l error up above ๐Ÿ‘†) โ€” this one has enough room to log the contents of the 48-bit LBA register set introduced with ATA-6. It also supports logs with more than one sector, and each sector holds up to 4 log entries. The actual number of log sectors is vendor specific.

Only the 8 most recent error log entries get printed by default. Change that with the optional parameter NUM.

If ,error is appended and the Extended Comprehensive SMART error log is not supported, the Summary SMART self-test log is printed instead.

heads up bestie: recent drives may report errors only in the Extended Comprehensive SMART error log. The Summary SMART error log might claim it's supported but then be always empty. it's giving fake support fr ๐Ÿ’€
  • selftest โ€” [ATA] prints the SMART self-test log. Your disk keeps a little diary of self-test results, and those tests get run with the -t option described below. For each of the most recent twenty-one self-tests, the log shows the type of test (short or extended, off-line or captive) and the final status of the test. If the test didn't complete successfully, you get the percentage of the test remaining. The time the test took place โ€” measured in hours of disk lifetime โ€” is also printed.
[Note: this time stamp wraps after 2^16 hours, or 2730 days and 16 hours, or about 7.5 years.] girl the clock literally resets. iconic behavior ๐Ÿ˜ญ

If any errors were detected, the Logical Block Address (LBA) of the first error is printed in decimal notation.

  • selftest โ€” [SCSI] the self-test log for a SCSI device has a slightly different format than for an ATA device. For each of the most recent twenty self-tests, it shows the type of test and the status (final or in progress) of the test. SCSI standards use the terms "foreground" and "background" (rather than ATA's corresponding "captive" and "off-line") and "short" and "long" (rather than ATA's corresponding "short" and "extended") to describe the type of the test. The printed segment number is only relevant when a test fails in the third or later test segment โ€” it identifies the test that failed and consists of either the number of the segment that failed during the test, or the number of the test that failed and the number of the segment in which the test was run, using a vendor-specific method of putting both numbers into a single byte. The Logical Block Address (LBA) of the first error is printed in hexadecimal notation. If provided, the SCSI Sense Key (SK), Additional Sense Code (ASC) and Additional Sense Code Qualifier (ASCQ) are also printed. The self tests can be run using the -t option described below (using the ATA test terminology).
  • selftest โ€” [NVMe: NEW EXPERIMENTAL SMARTCTL 7.4 FEATURE] prints the NVMe self-test log.
[NEW EXPERIMENTAL SMARTCTL 7.5 FIX] This always uses the broadcast namespace. Self-test results from individual namespaces appear in this single log. so like, they all show up in one place, slay ๐ŸŒˆ
  • xselftest[,NUM][,selftest] โ€” [ATA only] prints the Extended SMART self-test log (General Purpose Log address 0x07). Unlike the SMART self-test log (see -l selftest above), it supports 48-bit LBA and logs with more than one sector. Each sector holds up to 19 log entries. The actual number of log sectors is vendor specific.

Only the 25 most recent log entries are printed by default. Change that with the optional parameter NUM.

If ,selftest is appended and the Extended SMART self-test log is not supported, the old SMART self-test log is printed.

  • selective โ€” [ATA only] peep the -t select option below for a full description of selective self-tests. The selective self-test log shows the start/end Logical Block Addresses (LBA) of each of the five test spans, plus their current test status. If the span is being tested or the remainder of the disk is being read-scanned, the current 65536-sector block of LBAs being tested is also displayed. It also shows whether a read-scan of the remainder of the disk will be carried out after the selective self-test has completed (see the -t afterselect option) and the time delay before restarting this read-scan if it gets interrupted (see the -t pending option).
  • directory[,gs] โ€” [ATA only] if the device supports the General Purpose Logging feature set (ATA-6 and above) then this prints the Log Directory (the log at address 0). The Log Directory shows what logs are available and their length in sectors (512 bytes). The contents of the logs at address 1 [Summary SMART error log] and at address 6 [SMART self-test log] may be printed using the previously-described error and selftest arguments to this option. If your version of smartctl supports 48-bit ATA commands, both the General Purpose Log (GPL) and SMART Log (SL) directories are printed in one combined table. The output can be restricted to the GPL directory or SL directory by -l directory,g or -l directory,s respectively. pick your fighter ๐Ÿ’–
  • background โ€” [SCSI only] the background scan results log outputs information derived from Background Media Scans (BMS) done after power up and/or periodically (e.g. every 24 hours) on recent SCSI disks. If supported, the BMS status is output first, indicating whether a background scan is currently underway (and if so a progress percentage), the amount of time the disk has been powered up and the number of scans already completed. Then there's a header and a line for each background scan "event". These will typically be either recovered or unrecoverable errors. That latter group may need some attention, bestie โ€” like actually look at it. There's a description of the background scan mechanism in section 4.18 of SBC-3 revision 6 (see www.t10.org).
  • scttemp, scttempsts, scttemphist โ€” [ATA only] prints the disk temperature information provided by the SMART Command Transport (SCT) commands. The option scttempsts prints current temperature and temperature ranges returned by the SCT Status command, scttemphist prints temperature limits and the temperature history table returned by the SCT Data Table command, and scttemp prints both. The temperature values are preserved across power cycles. The logging interval can be configured with the -l scttempint,N[,p] option, see below. The SCT commands were introduced in ATA8-ACS and were also supported by many ATA-7 disks. ๐ŸŒก๏ธโœจ
  • scttempint,N[,p] โ€” [ATA only] clears the SCT temperature history table and sets the time interval for temperature logging to N minutes. If ,p is specified, the setting is preserved across power cycles. Otherwise, the setting is volatile and will be reverted to the last non-volatile setting by the next hard reset. The default interval is vendor specific โ€” typical values are 1, 2, or 5 minutes.
  • scterc[,READTIME,WRITETIME][,p|reset] โ€” [ATA only]</p> shows you the values and their descriptions for the SCT Error Recovery Control settings. bestie these are literally the same thing as TLER (that's the Western Digital name for it), CCTL (Samsung and Hitachi/HGST call it that) and ERC (Seagate's name) ๐Ÿ’…. drop in the READTIME and WRITETIME arguments (they're in deciseconds) and you're setting those values. a value of 0 turns the whole feature off, and any value under 65 is probably not supported. for RAID setups you'd typically run it at 70,70 deciseconds. say scterc,READTIME,WRITETIME,p and those times stay persistent across a power-on reset. say scterc,p and it prints the values that survive power-on. say scterc,reset and every SCT timer setting goes back to the manufacturer's default value. heads up: the ,p and ,reset options need the device to support ATA ACS-4 or higher.
  • devstat[,PAGE] โ€” [ATA only]</p> prints the values and descriptions from the ATA Device Statistics log pages (General Purpose Log address 0x04). leave PAGE off and you get entries from every supported page ๐ŸŒˆ. give it PAGE 0 and it prints the list of supported pages instead. Device Statistics showed up in ACS-2 and only some recent devices have it, ngl.
  • defects[,NUM] โ€” [ATA]</p> prints the LBA and hours values out of the ATA Pending Defects log (General Purpose Log address 0x0c). by default you only get the 31 entries from the first log page. the optional NUM parameter changes that number. the size of the log and the order of the entries? vendor specific, no cap ๐Ÿ˜ญ. the Pending Defects log arrived in ACS-4 Revision 01 (Mar 2014).
  • defects โ€” [SCSI]</p> prints the LBAs that the background scan couldn't read (aka a defect ๐Ÿ’€). if there are any entries, they show the defective LBA plus the value of the power-on hours (since manufacture) when the background scan found the defect. note that these pending defects can pop up before any application even tries to read the defective LBA.
  • envrep โ€” [SCSI only]</p> prints the values and descriptions of the SCSI Environmental reporting log page. it's giving one or more temperatures and may include relative humidities too ๐ŸŒก๏ธ. lifetime maximums and minimums get reported as well.
  • genstats โ€” [SCSI only: NEW EXPERIMENTAL SMARTCTL 7.4 FEATURE]</p> prints the values and descriptions of the SCSI General statistics and performance log page โœจ.
  • sataphy[,reset] โ€” [SATA only]</p> prints the values and descriptions of the SATA Phy Event Counters (General Purpose Log address 0x11). pass -l sataphy,reset and every counter gets reset right after the values are read ๐Ÿ”ฅ. this works for SATA devices with a Packet interface too, like CD/DVD drives.
  • sasphy[,reset] โ€” [SAS (SCSI) only]</p> prints the values and descriptions of the SAS (SSP) Protocol Specific log page (log page 0x18). pass -l sasphy,reset and all counters are reset after reading the values ๐Ÿ’….
  • tapealert โ€” [SCSI tape drives and changers]</p> prints the values and descriptions of the (SSC) Tape Alert log page. peep TAPE DRIVES below for the issue that comes with printing this log page ๐Ÿ‘€.
  • tapedevstat โ€” [SCSI tape drives and changers]</p> prints the values and descriptions of the (SSC) Device Statistics log page.
  • zdevstat โ€” [SCSI zoned disks]</p> prints the values and descriptions of the Zoned Block Device Statistics log page (ZBC-2).
  • gplog,ADDR[,FIRST[-LAST|+SIZE]] โ€” [ATA only]</p> prints a hex dump of literally any log you can reach through the General Purpose Logging (GPL) feature ๐Ÿซถ. the log address ADDR is the hex address listed in the log directory (that's the -l directory from above, iykyk). you can set the range of log sectors (pages) with decimal values FIRST-LAST or FIRST+SIZE. FIRST defaults to 0, SIZE defaults to 1. and LAST can be set to max to grab the last page of the log.
  • smartlog,ADDR[,FIRST[-LAST|+SIZE]] โ€” [ATA only]</p> prints a hex dump of any log you can reach via the SMART Read Log command. same parameter syntax as -l gplog,... above, periodt.

okay so for example, all of these commands:

smartctl -l gplog,0x80,10-15 /dev/sda
smartctl -l gplog,0x80,10+6 /dev/sda
smartctl -l smartlog,0x80,10-15 /dev/sda

print pages 10โ€“15 of log 0x80 (first host vendor specific log) ๐ŸŽ€.

the hex dump format is compatible with the xxd -r command. so this command:

smartctl -l gplog,0x11 /dev/sda | grep ^0 | xxd -r >log.bin

writes a binary representation of the one sector log 0x11 (SATA Phy Event Counters) to file log.bin ๐ŸŒธ.

  • nvmelog,PAGE,SIZE โ€” [NVMe only]</p> prints a hex dump of the first SIZE bytes from the NVMe log with identifier PAGE. PAGE is a hexadecimal number in the range from 0x1 to 0xff. SIZE is a hexadecimal number in the range from 0x4 to 0x4000 (16 KiB).
โš ๏ธ WARNING: Do not specify the identifier of an unknown log page. Reading a log page may have undesirable side effects. like. do not. ๐Ÿ’€
  • ssd โ€” [ATA]</p> prints the Solid State Device Statistics log page. this hits exactly the same as -l devstat,7, see above ๐Ÿ‘‘
  • ssd โ€” [SCSI]</p> prints the Solid State Media percentage used endurance indicator. a value of 0 means it's as new condition, while 100 means the device is at the end of its lifetime as projected by the manufacturer. and bestie, the value may reach 255 ๐Ÿ˜ญ.
  • farm โ€” [Seagate ATA or SAS (SCSI) only: NEW EXPERIMENTAL SMARTCTL 7.4 FEATURE]</p> prints predictive drive health metrics and values from Seagate's vendor-specific Field Access Reliability Metrics (FARM) log when you use it on a drive that supports FARM. the ATA and SAS logs differ slightly. > WARNING: Some Seagate drives do not support FARM.

๐Ÿ’– OPTIONS (still going, we're so back)

  • -v ID,FORMAT[:BYTEORDER][,NAME], --vendorattribute=ID,FORMAT... โ€” [ATA only]</p> sets a vendor-specific raw value print FORMAT, an optional BYTEORDER and an optional NAME for Attribute ID. you can use this option multiple times, no cap ๐Ÿซถ.

the Attribute ID can be in the range 1 to 255. and if you pass N as the ID, the settings for all Attributes get changed. iconic.

the optional BYTEORDER is made of 1 to 8 characters from the set 012345rvwz. here's the tea: 0 to 5 select byte 0 to 5 from the 48-bit raw value, r selects the reserved byte of the attribute data block, v selects the normalized value, w selects the worst value, and z inserts a zero byte. the default BYTEORDER is 543210 for all 48-bit formats, r543210 for the 54-bit formats, and 543210wv for the 64-bit formats. so like, -v 5,raw48:012345 prints the raw value of attribute 5 with big endian instead of little endian byte ordering โœจ.

the NAME is a string of letters, digits and underscore. its length should not exceed 23 characters. and the -P showall option reports an error if that's the case, so behave ๐Ÿ’….

-v help โ€” prints (to STDOUT) a list of all valid arguments to this option, then exits. chef's kiss, use it.

valid arguments for FORMAT are:

  • raw8 โ€” prints the Raw value as six 8-bit unsigned base-10 integers. this may be useful for decoding the meaning of the Raw value ๐Ÿ”.
  • raw16 โ€” prints the Raw value as three 16-bit unsigned base-10 integers. also may be useful for decoding the meaning of the Raw value.
  • raw48 โ€” prints the Raw value as a 48-bit unsigned base-10 integer. this is the default for most attributes ๐Ÿ‘‘.
  • hex48 โ€” prints the Raw value as a 12 digit hexadecimal number. may be useful for decoding the meaning of the Raw value.
  • raw56 โ€” prints the Raw value as a 54-bit unsigned base-10 integer. this includes the reserved byte which follows the 48-bit raw value.
  • hex56 โ€” prints the Raw value as a 14 digit hexadecimal number. this includes the reserved byte which follows the 48-bit raw value.
  • raw64 โ€” prints the Raw value as a 64-bit unsigned base-10 integer. this includes two bytes from the normalized and worst attribute value. some SSD devices with an Indilinx controller use this raw format.
  • hex64 โ€” prints the Raw value as a 16 digit hexadecimal number. this includes two bytes from the normalized and worst attribute value. again, some SSD devices with an Indilinx controller use this raw format.
  • min2hour โ€” Raw Attribute is power-on time in minutes. its raw value gets displayed in the form "Xh+Ym". here X is hours, and Y is minutes in the range 0โ€“59 inclusive. Y is always printed with two digits, for example "06" or "31" or "00" โฐ.
  • sec2hour โ€” Raw Attribute is power-on time in seconds. its raw value gets displayed in the form "Xh+Ym+Zs". here X is hours, Y is minutes in the range 0โ€“59 inclusive, and Z is seconds in the range 0โ€“59 inclusive. Y and Z are always printed with two digits, for example "06" or "31" or "00".
  • halfmin2hour โ€” Raw Attribute is power-on time, measured in units of 30 seconds. some Samsung disks use this format. its raw value gets displayed in the form "Xh+Ym". here X is hours, and Y is minutes in the range 0โ€“59 inclusive. Y is always printed with two digits, for example "06" or "31" or "00".
  • msec24hour32 โ€” Raw Attribute is power-on time measured in 32-bit hours and 24-bit milliseconds since last hour update. it gets displayed in the form "Xh+Ym+Z.Ms". here X is hours, Y is minutes, Z is seconds and M is milliseconds.
  • tempminmax โ€” Raw Attribute is the disk temperature in Celsius. info about Min/Max temperature gets printed if it's available. this is the default for Attributes 190 and 194. the recording interval (lifetime, last power cycle, last soft reset) of the min/max values is device specific ๐ŸŒก๏ธ.
  • temp10x โ€” Raw Attribute is ten times the disk temperature in Celsius.
  • raw16(raw16) โ€” prints the raw attribute as a 16-bit value and two optional 16-bit values if these words are nonzero. this is the default for Attributes 5 and 196.
  • raw16(avg16) โ€” Raw attribute is spin-up time. it gets printed as a 16-bit value and an optional "Average" 16-bit value if the word is nonzero. this is the default for Attribute 3.
  • raw24(raw8) โ€” prints that raw attribute as a 24-bit value, plus up to three optional 8-bit values if those bytes aren't zero. This is the default vibe for Attribute 9. ๐ŸŽ€
  • raw24/raw24 โ€” the Raw Attribute is packing two 24-bit values. First one = number of load cycles. Second one = number of unload cycles. Subtract them and you get the number of times the drive got powered off when it was NOT expecting it (aka an emergency unload). Rule of thumb bestie: the mechanical stress from one emergency unload โ‰ˆ one hundred normal unloads. ๐Ÿ˜ญ
  • raw24/raw32 โ€” raw attribute is an error rate made of a 24-bit error count and a 32-bit total count.

And the following old arguments to -v are still valid too, no cap:

  • 9,minutes โ€” same as: 9,min2hour,Power_On_Minutes.
  • 9,seconds โ€” same as: 9,sec2hour,Power_On_Seconds.
  • 9,halfminutes โ€” same as: 9,halfmin2hour,Power_On_Half_Minutes.
  • 9,temp โ€” same as: 9,tempminmax,Temperature_Celsius.
  • 192,emergencyretractcyclect โ€” same as: 192,raw48,Emerg_Retract_Cycle_Ct
  • 193,loadunload โ€” same as: 193,raw24/raw24.
  • 194,10xCelsius โ€” same as: 194,temp10x,Temperature_Celsius_x10.
  • 194,unknown โ€” same as: 194,raw48,Unknown_Attribute.
  • 197,increasing โ€” same as: 197,raw48,Total_Pending_Sectors. Also means Attribute number 197 (Current Pending Sector Count) is not reset if uncorrectable sectors get reallocated (go peek at the smartd.conf(5) man page).
  • 198,increasing โ€” same as: 198,raw48,Total_Offl_Uncorrectabl. Also means Attribute number 198 (Offline Uncorrectable Sector Count) is not reset if uncorrectable sectors get reallocated (again, see smartd.conf(5)).
  • 198,offlinescanuncsectorct โ€” same as: 198,raw48,Offline_Scan_UNC_SectCt.
  • 200,writeerrorcount โ€” same as: 200,raw48,Write_Error_Count.
  • 201,detectedtacount โ€” same as: 201,raw48,Detected_TA_Count.
  • 220,temp โ€” same as: 220,tempminmax,Temperature_Celsius.

๐Ÿ’… OPTIONS ๐Ÿ’… (still going, she's got range)

-F TYPE, --firmwarebug=TYPE

[ATA only] This one tweaks how smartctl behaves so it can compensate for some known and understood device firmware or driver bugs. You can use this option multiple times. The valid arguments are:

  • none โ€” assume the device firmware actually obeys the ATA specifications. This is the default, unless the device has presets for -F in the drive database. Using this option on the command line will override any preset values. ๐Ÿ’โ€โ™€๏ธ
  • nologdir โ€” suppresses read attempts of SMART or GP Log Directory. Support for all standard logs is just assumed without an actual check. Some Intel SSDs may freeze if log address 0 is read. ๐Ÿฅถ
  • samsung โ€” in some Samsung disks (example: model SV4012H Firmware 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 smartctl 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 smartctl to evaluate this quantity in byte-reversed order. An indication that your Samsung disk needs this option is that the self-test log is printed correctly, but there are a very large number of errors in the SMART error log. This is because the error count is byte swapped. So a disk with five errors (0x0005) will appear to have 20480 errors (0x5000). ๐Ÿ˜ณ
  • samsung3 โ€” some Samsung disks (at least SP2514N with Firmware VF100-37) report a self-test still in progress with 0% remaining when the test was already completed. Enabling this option modifies the output of the self-test execution status (see options -c or -a above) accordingly.
  • xerrorlba โ€” fixes LBA byte ordering in Extended Comprehensive SMART error log. Some disks use little endian byte ordering instead of ATA register ordering to specify the LBA addresses in the log entries.
  • swapid โ€” fixes byte swapped ATA identify strings (device name, serial number, firmware version) returned by some buggy device drivers. ๐Ÿ™ˆ

-P TYPE, --presets=TYPE

[ATA only] Specifies whether smartctl should use any preset options that are available for this drive. By default, if the drive is recognized in the smartmontools database, then the presets are used. โœจ

The argument show will show any preset options for your drive and the argument showall will show all known drives in the smartmontools database, along with their preset options. If there are no presets for your drive and you think there should be (for example, a -v or -F option is needed to get smartctl to display correct values) then please contact the smartmontools developers so that this information can be added to the smartmontools database. Contact information is at the end of this man page. ๐Ÿซถ

The valid arguments to this option are:

  • use โ€” if a drive is recognized, then use the stored presets for it. This is the default. Note that presets will NOT override additional Attribute interpretation (-v N,something) command-line options or explicit -F command-line options..
  • ignore โ€” do not use presets.
  • show โ€” show if the drive is recognized in the database, and if so, its presets, then exit.
  • showall โ€” list all recognized drives, and the presets that are set for them, then exit. This also checks the drive database regular expressions and settings for syntax errors. ๐Ÿ‘‘

The -P showall option takes up to two optional arguments to match a specific drive type and firmware version. The command:

smartctl -P showall

lists all entries, the command:

smartctl -P showall 'MODEL'

lists all entries matching MODEL, and the command:

smartctl -P showall 'MODEL' 'FIRMWARE'

lists all entries for this MODEL and a specific FIRMWARE version.

-B [+]FILE, --drivedb=[+]FILE

[ATA only] Read the drive database from FILE. The new database replaces the built in database by default. If + is specified, then the new entries prepend the built in entries. ๐Ÿฆ‹

Optional entries are read from the file /etc/smartmontools/smart_drivedb.h if this option is not specified.

If /usr/share/smartmontools/drivedb.h is present, the contents of this file is used instead of the built in table.

Run /usr/bin/update-smart-drivedb to update this file from the smartmontools SVN repository.

The database files use the same C/C++ syntax that is used to initialize the built in database array. C/C++ style comments are allowed. Example:

/* Full entry: */
{
  "Model family",    // Info about model family/series.
  "MODEL1.*REGEX",   // Regular expression to match model of device.
  "VERSION.*REGEX",  // Regular expression to match firmware version(s).
  "Some warning",    // Warning message.
  "-v 9,minutes"     // String of preset -v and -F options.
},
/* Minimal entry: */
{
  "",                // No model family/series info.
  "MODEL2.*REGEX",   // Regular expression to match model of device.
  "",                // All firmware versions.
  "",                // No warning.
  ""                 // No options preset.
},
/* USB ID entry: */
{
  "USB: Device; Bridge", // Info about USB device and bridge name.
  "0x1234:0xabcd",   // Regular expression to match vendor:product ID.
  "0x0101",          // Regular expression to match bcdDevice.
  "",                // Not used.
  "-d sat"           // String with device type option.
},
/* ... */

๐ŸŒˆ SMART RUN/ABORT OFFLINE TEST AND self-test OPTIONS: ๐ŸŒˆ

-t TEST, --test=TEST

Executes TEST immediately. The -C option can be used in conjunction with this option to run the short or long (and also for ATA devices, selective or conveyance) self-tests in captive mode (known as "foreground mode" for SCSI devices). Note that only one test type can be run at a time, so only one test type should be specified per command line. Note also that if a computer is shutdown or power cycled during a self-test, no harm should result. The self-test will either be aborted or will resume automatically. ๐Ÿ’ซ

All -t TEST commands can be given during normal system operation unless captive mode (-C option) is used. A running self-test can, however, degrade performance of the drive. Frequent I/O requests from the operating system increase the duration of a test. These impacts may vary from device to device.

If a test failure occurs then the device may discontinue the testing and report the result immediately.

[ATA] Note that the ATA command SMART EXECUTE OFF-LINE IMMEDIATE (the command to start a test) was declared obsolete in ATA ACS-4 Revision 10 (Nov 2015).

The valid arguments to this option are:

  • offline โ€” [ATA] runs SMART Immediate Offline Test. This immediately starts the test described above. This command can be given during normal system operation. The effects of this test are visible only in that it updates the SMART Attribute values, and if errors are found they will appear in the SMART error log, visible with the -l error option.

okay so if the -c option to smartctl shows that the device has the "Suspend Offline collection upon new command" capability then you can track the progress of the Immediate Offline test using the -c option to smartctl. If the -c option show that the device has the "Abort Offline collection upon new command" capability then most commands will abort the Immediate Offline Test, so you should not try to track the progress of the test with -c, as it will abort the test. ๐Ÿ˜ญ

  • offline โ€” [SCSI] runs the default self test in foreground. No entry is placed in the self test log. ๐Ÿซถ
  • short โ€” [ATA] runs SMART Short Self Test (usually under ten minutes). This command can be given during normal system operation (unless run in captive mode - see the -C option below). This is a test in a different category than the immediate or automatic offline tests. The "Self" tests check the electrical and mechanical performance as well as the read performance of the disk. Their results are reported in the Self Test Error Log, readable with the -l selftest option. Note that on some disks the progress of the self-test can be monitored by watching this log during the self-test; with other disks use the -c option to monitor progress. ๐Ÿ‘‘
  • short โ€” [SCSI] runs the "Background short" self-test. โœจ
  • short โ€” [NVMe: NEW EXPERIMENTAL SMARTCTL 7.4 FEATURE] runs the "Short" self-test for current namespace. ๐Ÿฆ‹
  • long โ€” [ATA] runs SMART Extended Self Test (tens of minutes to several hours). This is a longer and more thorough version of the Short Self Test described above. Note that this command can be given during normal system operation (unless run in captive mode - see the -C option below). ๐Ÿ”ฅ
  • long โ€” [SCSI] runs the "Background long" self-test. ๐Ÿ’œ
  • long โ€” [NVMe: NEW EXPERIMENTAL SMARTCTL 7.4 FEATURE] runs the "Extended" self-test for current namespace. ๐ŸŒˆ
  • conveyance โ€” [ATA only] runs a SMART Conveyance Self Test (minutes). This self-test routine is intended to identify damage incurred during transporting of the device. This self-test routine should take on the order of minutes to complete. Note that this command can be given during normal system operation (unless run in captive mode - see the -C option below). ๐ŸŽ€
  • select,N-M, select,N+SIZE โ€” [ATA only] runs a SMART Selective Self Test, to test a range of disk Logical Block Addresses (LBAs), rather than the entire disk. Each range of LBAs that is checked is called a "span" and is specified by a starting LBA (N) and an ending LBA (M) with N less than or equal to M. The range can also be specified as N+SIZE. A span at the end of a disk can be specified by N-max. ๐Ÿงš

For example the commands:

smartctl -t select,10-20 /dev/sda
smartctl -t select,10+11 /dev/sda

both runs a self test on one span consisting of LBAs ten to twenty (inclusive). The command:

smartctl -t select,100000000-max /dev/sda

run a self test from LBA 100000000 up to the end of the disk. The -t option can be given up to five times, to test up to five spans. For example the command:

smartctl -t select,0-100 -t select,1000-2000 /dev/sda

runs a self test on two spans. The first span consists of 101 LBAs and the second span consists of 1001 LBAs. Note that the spans can overlap partially or completely, for example:

smartctl -t select,0-10 -t select,5-15 -t select,10-20 /dev/sda

The results of the selective self-test can be obtained (both during and after the test) by printing the SMART self-test log, using the -l selftest option to smartctl. ๐Ÿ’…

Selective self tests are particularly useful as disk capacities increase: an extended self test (smartctl -t long) can take several hours. Selective self-tests are helpful if (based on SYSLOG error messages, previous failed self-tests, or SMART error log entries) you suspect that a disk is having problems at a particular range of Logical Block Addresses (LBAs). ๐ŸŒธ

Selective self-tests can be run during normal system operation (unless done in captive mode - see the -C option below). โญ

The following variants of the selective self-test command use spans based on the ranges from past tests already stored on the disk:

  • select,redo[+SIZE] โ€” [ATA only] redo the last SMART Selective Self Test using the same LBA range. The starting LBA is identical to the LBA used by last test, same for ending LBA unless a new span size is specified by optional +SIZE argument. ๐ŸŽ€

For example the commands:

smartctl -t select,10-20 /dev/sda
smartctl -t select,redo /dev/sda
smartctl -t select,redo+20 /dev/sda

have the same effect as:

smartctl -t select,10-20 /dev/sda
smartctl -t select,10-20 /dev/sda
smartctl -t select,10-29 /dev/sda
  • select,next[+SIZE] โ€” [ATA only] runs a SMART Selective Self Test on the LBA range which follows the range of the last test. The starting LBA is set to (ending LBA +1) of the last test. A new span size may be specified by the optional +SIZE argument. โœจ

For example the commands:

smartctl -t select,0-999 /dev/sda
smartctl -t select,next /dev/sda
smartctl -t select,next+2000 /dev/sda

have the same effect as:

smartctl -t select,0-999 /dev/sda
smartctl -t select,1000-1999 /dev/sda
smartctl -t select,2000-3999 /dev/sda

If the last test ended at the last LBA of the disk, the new range starts at LBA 0. The span size of the last span of a disk is adjusted such that the total number of spans to check the full disk will not be changed by future uses of -t select,next. ๐Ÿ’–

  • select,cont[+SIZE] โ€” [ATA only] performs a 'redo' (above) if the self test status reports that the last test was aborted by the host. Otherwise it run the 'next' (above) test. ๐Ÿฆ‹
  • afterselect,on โ€” [ATA only] perform an offline read scan after a Selective self-test has completed. This option must be used together with one or more of the select,N-M options above. If the LBAs that have been specified in the Selective self-test pass the test with no errors found, then read scan the remainder of the disk. If the device is powered-cycled while this read scan is in progress, the read scan will be automatically resumed after a time specified by the pending timer (see below). The value of this option is preserved between selective self-tests. ๐Ÿ”ฅ
  • afterselect,off โ€” [ATA only] do not read scan the remainder of the disk after a Selective self-test has completed. This option must be use together with one or more of the select,N-M options above. The value of this option is preserved between selective self-tests. ๐Ÿซถ
  • pending,N โ€” [ATA only] set the pending offline read scan timer to N minutes. Here N is an integer in the range from 0 to 65535 inclusive. If the device is powered off during a read scan after a Selective self-test, then resume the test automatically N minutes after power-up. This option must be use together with one or more of the select,N-M options above. The value of this option is preserved between selective self-tests. ๐Ÿ’œ
  • vendor,N โ€” [ATA only] issues the ATA command SMART EXECUTE OFF-LINE IMMEDIATE with subcommand N in LBA LOW register. The subcommand is specified as a hex value in the range 0x00 to 0xff. Subcommands 0x40โ€“0x7e and 0x90โ€“0xff are reserved for vendor specific use, see table 61 of T13/1699-D Revision 6a (ATA8-ACS). Note that the subcommands 0x00โ€“0x04, 0x7f, 0x81โ€“0x84 are supported by other smartctl options (e.g. 0x01: -t short, 0x7f: -X, 0x82: -C -t long). ๐Ÿ‘‘
WARNING: Only run subcommands documented by the vendor of the device. ๐Ÿ’€

Example for some Intel SSDs only: The subcommand 0x40 (-t vendor,0x40) clears the timed workload related SMART attributes (226, 227, 228). Note that the raw values of these attributes are held at 65535 (0xffff) until the workload timer reaches 60 minutes. ๐Ÿ”ฅ

  • force โ€” start new self-test even if another test is already running. By default a running self-test will not be interrupted to begin another test. โœจ
  • -C, --captive โ€” [ATA] Runs self-tests in captive mode. This has no effect with -t offline or if the -t option is not used.
WARNING: Tests run in captive mode may busy out the drive for the length of the test. Only run captive tests on drives without any mounted partitions! ๐Ÿ˜ญ

[SCSI] Runs the self-test in "Foreground" mode. ๐Ÿ’…

  • -X, --abort โ€” Aborts non-captive SMART Self Tests. Note that this command will abort the Offline Immediate Test routine only if your disk has the "Abort Offline collection upon new command" capability. โญ

๐Ÿ’… ATA, SCSI command sets and SAT ๐Ÿ’…

Okay so bestie, back in the day there was a whole clear split between storage devices that used ATA and SCSI command sets. That split was often visible in device naming and hardware. Now various SCSI transports (like SAS, FC and iSCSI) can connect to both SCSI disks (like FC and SAS) and ATA disks (especially SATA). USB and IEEE 1394 storage devices use the SCSI command set on the outside but almost always have ATA or SATA disks (or flash) inside. Some OS storage subsystems have started removing the ATA-vs-SCSI distinction in device naming policies.

99% of operations an OS does on a disk are the SCSI INQUIRY, READ CAPACITY, READ and WRITE commands, or their ATA equivalents. SCSI commands are a little more general than ATA equivalents, so many OSes generate SCSI commands (mainly READ and WRITE) and let a lower level translate them to ATA equivalents when needed. Important note: that "lower level" may live in external equipment, so it can be outside the OS's control.

SCSI to ATA Translation (SAT) is a standard (ANSI INCITS 431-2007) that says how this translation is done. For the other 1% of operations that an OS performs on a disk, SAT gives two options. First is an optional ATA PASS-THROUGH SCSI command (there are two variants). Second is a translation from the closest SCSI command. Most current interest is in the "pass-through" option.

Why does this matter to smartmontools (and therefore smartctl)? Because its interactions with disks fall solidly into that "1%" category. So even if the OS can happily treat (and name) a disk as "SCSI", smartmontools needs to detect the native command set and act accordingly. As more storage manufacturers (including external SATA drives) comply with SAT, smartmontools can automatically distinguish the native command set of the device. In some cases the -d sat option is needed on the command line.

There are also virtual disks. They typically have no useful information to convey to smartmontools, but could conceivably in the future. One example is the OS's view of a RAID 1 box. There are most likely two SATA disks inside a RAID 1 box. Addressing those SATA disks from a distant OS is a challenge for smartmontools. Another approach is running a tool like smartmontools inside the RAID 1 box (e.g. a Network Attached Storage (NAS) box) and fetching the logs via a browser.

๐Ÿ“ผ TAPE DRIVES ๐Ÿ“ผ

Commands for SCSI Tape drives are defined in the SSC-4 standard (ANSI INCITS 516-2013). SSC stands for "SCSI Streaming Commands". Draft standards can be found at https://www.t10.org/.

Many SMART related features of SCSI disks are shared by SCSI tape drives. One important tape-specific log page is called "TapeAlert", and it reports abnormal conditions. Unlike most other log pages, the TapeAlert log page clears pending alerts after that page is fetched (i.e. read from the tape drive). To be more precise, the TapeAlert log page is cleared for the I_T nexus (initiator-target pair) that sent the (SCSI LOG SENSE) command; so another initiator (e.g. a HBA on another machine) will still have pending alerts reported. [This clearing action can be controlled by the TAPLSD bit is the [SSC] Device Configuration Extension mode page but the original and default action remains: clear any pending TapeAlerts. The sdparm utility can be used to access and change TAPLSD.]

Previous versions of smartctl have supported polling the TapeAlert log page when the --health option is given. This clearing of pending alerts has created problems for other tape-specific tools. This version of smartctl will only fetch the TapeAlert log page if the --health option is given twice in the command line invocation (or the --log=tapealert option is given).

There are other tape-specific log pages such as --log=tapedevstat that behave normally (i.e. they don't change any state information in the tape drive).

โœจ EXAMPLES โœจ

smartctl -a /dev/sda

Print a large amount of SMART information for drive /dev/sda.

smartctl -s off /dev/sdd

Disable SMART monitoring and data log collection on drive /dev/sdd.

smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda

Enable SMART on drive /dev/sda, enable automatic offline testing every four hours, and enable autosaving of SMART Attributes. This is a good start-up line for your system's init files. You can issue this command on a running system.

smartctl -t long /dev/sdc

Begin an extended self-test of drive /dev/sdc. You can issue this command on a running system. The results can be seen in the self-test log visible with the -l selftest option after it has completed.

smartctl -s on -t offline /dev/sda

Enable SMART on the disk, and begin an immediate offline test of drive /dev/sda. You can issue this command on a running system. The results are only used to update the SMART Attributes, visible with the -A option. If any device errors occur, they are logged to the SMART error log, which can be seen with the -l error option.

smartctl -A -v 9,minutes /dev/sda

Shows the vendor Attributes, when the disk stores its power-on time internally in minutes rather than hours.

smartctl -q errorsonly -H -l selftest /dev/sda

Produces output only if the device returns failing SMART status, or if some of the logged self-tests ended with errors.

smartctl -q silent -a /dev/sda

Examine all SMART data for device /dev/sda, but produce no printed output. You must use the exit status (the $? shell variable) to learn if any Attributes are out of bound, if the SMART status is failing, if there are errors recorded in the self-test log, or if there are errors recorded in the disk error log.

smartctl -a -d 3ware,0 /dev/twl0

Examine all SMART data for the first SATA (not SAS) disk connected to a 3ware RAID 9750 controller card.

smartctl -t long -d areca,4 /dev/sg2

Start a long self-test on the fourth SATA disk connected to an Areca RAID controller addressed by /dev/sg2.

smartctl -a -d hpt,1/3 /dev/sda (under Linux)
smartctl -a -d hpt,1/3 /dev/hptrr (under FreeBSD)

Examine all SMART data for the (S)ATA disk directly connected to the third channel of the first HighPoint RocketRAID controller card.

smartctl -t short -d hpt,1/1/2 /dev/sda (under Linux)
smartctl -t short -d hpt,1/1/2 /dev/hptrr (under FreeBSD)

Start a short self-test on the (S)ATA disk connected to second pmport on the first channel of the first HighPoint RocketRAID controller card.

smartctl -t select,10-100 -t select,30-300 -t afterselect,on -t
pending,45 /dev/sda

Run a selective self-test on LBAs 10 to 100 and 30 to 300. After the these LBAs have been tested, read-scan the remainder of the disk. If the disk is power-cycled during the read-scan, resume the scan 45 minutes after power to the device is restored.

smartctl -a -d cciss,0 /dev/cciss/c0d0

Examine all SMART data for the first SCSI disk connected to a cciss RAID controller card.

๐Ÿšฆ EXIT STATUS ๐Ÿšฆ

The exit statuses of smartctl are defined by a bitmask. If all is well with the disk, the exit status (return value) of smartctl is 0 (all bits turned off). If a problem occurs, or an error, potential error, or fault is detected, then a non-zero status is returned. In this case, the eight different bits in the exit status have the following meanings for ATA disks; some of these values may also be returned for SCSI disks.

  • Bit 0: Command line did not parse.
  • Bit 1: Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode (see -n option above).
  • Bit 2: Some SMART or other ATA command to the disk failed, or there was a checksum error in a SMART data structure (see -b option above).
  • Bit 3: SMART status check returned "DISK FAILING".
  • Bit 4: We found prefail Attributes <= threshold.
  • Bit 5: SMART status check returned "DISK OK" but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past.
  • Bit 6: The device error log contains records of errors.
  • Bit 7: The device self-test log contains records of errors. [ATA only] Failed self-tests outdated by a newer successful extended self-test are ignored.

To test within the shell for whether or not the different bits are turned on or off, you can use the following type of construction (which should work with any POSIX compatible shell):

smartstat=$(($? & 8))

This looks at only at bit 3 of the exit status $? (since 8=2^3). The shell variable $smartstat will be nonzero if SMART status check returned "disk failing" and zero otherwise.

This shell script prints all status bits:

val=$?; mask=1
for i in 0 1 2 3 4 5 6 7; do
  echo "Bit $i: $(((val & mask) && 1))"
  mask=$((mask << 1))
done

๐Ÿ“ FILES ๐Ÿ“

  • /usr/bin/smartctl โ€” full path of this executable.
  • /usr/share/smartmontools/drivedb.h โ€” drive database (see -B option).
  • /etc/smartmontools/smart_drivedb.h โ€” optional local drive database (see -B option).

๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

  • Bruce Allen (project initiator),
  • Christian Franke (project manager, Windows port and all sort of things),
  • Douglas Gilbert (SCSI subsystem),
  • Volker Kuhlmann (moderator of support and database mailing list),
  • Gabriele Pohl (wiki & development team support),
  • Alex Samorukov (FreeBSD port and more, new Trac wiki).

Many other individuals have made contributions and corrections, see AUTHORS, ChangeLog and repository files.

The first smartmontools code was derived from the smartsuite package, written by Michael Cornwell and Andre Hedrick.

๐Ÿ› REPORTING BUGS ๐Ÿ›

To submit a bug report, create a ticket in smartmontools wiki: https://www.smartmontools.org/.

Alternatively send the info to the smartmontools support mailing list: https://listi.jpberlin.de/mailman/listinfo/smartmontools-support.

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

๐Ÿ“š REFERENCES ๐Ÿ“š

okay bestie, if you wanna go deeper than this manpage (and honestly, respect), here's where to look ๐Ÿ’–

Please see the following web site for more info: <https://www.smartmontools.org/>


There's an intro article about smartmontools called Monitoring Hard Disks with SMART, written by Bruce Allen, published in Linux Journal, January 2004, pages 74โ€“77. See <https://www.linuxjournal.com/article/6983>. like, an actual paper, in an actual magazine, iconic behavior fr fr ๐Ÿ“–โœจ


If you'd genuinely like to understand better how SMART works, and what it does, a good place to start is with Sections 4.8 and 6.54 of the first volume of the 'AT Attachment with Packet Interface-7' (ATA/ATAPI-7) specification Revision 4b. This documents the SMART functionality which the smartmontools utilities provide access to. no cap, that's the source material right there ๐Ÿ‘‘


And listen, the functioning of SMART was originally defined by the SFF-8035i revision 2 and the SFF-8055i revision 1.4 specifications. These are publications of the Small Form Factors (SFF) Committee. history, bestie ๐Ÿฆ‹


Links to these and other documents may be found on the Links page of the smartmontools Wiki at <https://www.smartmontools.org/wiki/Links>. go click around, it's giving research era ๐Ÿ”ฅ


๐ŸŽ€ PACKAGE VERSION ๐ŸŽ€

smartmontools-7.5 2025-04-30 r5714
$Id: smartctl.8.in 5692 2025-04-21 15:21:15Z chrfranke $

and that's the whole entire page, bestie!! you made it to the very end ๐Ÿซถ this version of the page is smartmontools-7.5, dated 2025-04-30, and it's filed under SMARTCTL(8) in your friendly neighborhood manual section 8 ๐Ÿ’… now go run smartctl -a /dev/sda and tell your drives you love them. periodt. ๐Ÿ‘‘๐Ÿ’–โœจ