NAME
smart, diskhealth – monitor disk health from a storage device via SMART
SYNOPSIS
smart [-dhitvx] [-a page:attribute[,page:attribute]...] [--debug] device
diskhealth [-Dhitvx] [-a page:attribute[,page:attribute]...] [--debug] device
DESCRIPTION
The smart command allows the user to monitor the various information reported by Self-Monitoring, Analysis and Reporting Technology (SMART) present on most ATA, SCSI, and NVMe storage media. Because the structure of this information varies across protocols, smart normalizes entries using the format:
<Page ID> <Attribute ID> <Value> <Thresholds>
Fields are tab-delimited by default, but the command can output data in any format supported by libxo(3).
Because ATA does not have log pages, smart uses the Command Feature field value in place of the log page ID. For SMART READ DATA, this value is 208 / 0xd0. Note that devices choose which attribute ID values they support, their descriptions, and the format of the data. The three values displayed with the --threshold option are:
-
Status flags (byte offset 1, 2 bytes)
-
Nominal attribute value (byte offset 3, 1 byte)
-
Worst Ever attribute value (byte offset 4, 1 byte)
Additionally, smart reports the value of the SMART STATUS command (Command Feature field value 218 / 0xda). As this command does not return any data, the command represents this entry with a synthetic attribute ID of 0, and it uses the command status (0 or 1) as the attribute value.
NVMe devices support the SMART/Health log page (Page ID 2 / 0x2). The data returned in this log page is not structured as attribute IDs. Instead, smart uses the byte offset of each field as the attribute ID. For example, byte 3 is the Available Spare. Thus, for NVMe, attribute ID 3 is Available Spare. Note that NVMe health data does not include threshold values, and as a result, the command will ignore the --threshold option.
SCSI devices can support a number of log pages which report drive health. The command will report the following pages:
-
Write Errors (Page ID 2 / 0x2)
-
Read Errors (Page ID 3 / 0x3)
-
Verify Errors (Page ID 5 / 0x5)
-
Non-medium Errors (Page ID 6 / 0x6)
-
Last N Errors (Page ID 7 / 0x7)
-
Temperature (Page ID 13 / 0xd)
-
Start-stop Cycles (Page ID 14 / 0xe)
-
Informational Exceptions (Page ID 47 / 0x2f)
Note that all log pages are optional, and a particular drive may not support all these pages. For SCSI devices, the Attribute ID maps to the SCSI parameter code defined by the command. Parameter codes are integer values from 0 to N, and, by themselves, are ambiguous outside the context of a particular log page. Note that SCSI health data does not include threshold values, and as a result, the command will ignore the --threshold option.
The following options are available:
- -a page:attribute, --attribute=page:attribute
-
A comma-separated list of attributes to display. If page is missing, display the matching attribute from any page.
- -d, --decode
-
Decode the attribute ID values. This is the default when invoked as diskhealth.
- -D, --no-decode
-
Do not decode the attribute ID values. This is the default when invoked as smart.
- -h, --help
-
Prints a usage message and exits.
- -i, --info
-
Print general device information.
- -t, --threshold
-
Also print the threshold values.
- -v, --version
-
Print the version and copyright.
- -x, --hex
-
Print the values in hexadecimal.
- device
-
An explicit device path (/dev/ada0) or GEOM provider (ada0)
EXIT STATUS
The smart utility exits 0 on success, and >0 if an error occurs.
EXAMPLES
Print all SMART READ DATA and SMART STATUS including the threshold values for ATA drive ada0.
# smart -t ada0
Print only attribute ID 5 ("Reallocated Sectors Count") for ATA drive ada0.
# smart -a 5 ada0
Print attribute IDs 5 ("Reallocated Sectors Count") and 171 ("SSD Program Fail") for ATA drive ada0.
# smart -a 5,171 ada0
Print all health pages supported by SCSI device da0 including:
-
Write Errors
-
Read Errors
-
Verify Errors
-
Non-medium Errors
-
Last N Errors
-
Temperature
-
Start-stop Cycles
-
Informational Exceptions
# smart da0
Print all Health log page entries in hexadecimal for NVMe device nda0.
# smart -x nda0
DIAGNOSTICS
The command may fail for one of the following reasons:
- No output displayed
-
The device does not support health data.
SEE ALSO
AUTHORS
This utility was written by Chuck Tuffli ⟨[email protected]⟩.
BUGS
Probably.