smart
— retrieve
health / SMART data from a device
smart |
[-dDhitvx ] [-a
page:attribute[,page:attribute]...]
[--debug ] device |
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 format of this information varies across protocols,
smart
normalizes entries using the format:
<Page ID> <Attribute ID> <Value> <Threshold>
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 and the description for it. 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 / 0x3)
- 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.
-D
,
--no-decode
- Do not decode the attribute ID values.
-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 ).
The smart
utility exits 0 on
success, and >0 if an error occurs.
# smart -t ada0
Print all SMART READ DATA and SMART STATUS including
the threshold values for ATA drive ada0.
# smart -a 5 ada0
Print only attribute ID 5 ("Reallocated Sectors
Count") for ATA drive ada0.
# smart -a 5,171 ada0
Print attribute IDs 5 ("Reallocated Sectors
Count") and 171 ("SSD Program Fail") for ATA drive ada0.
# smart da0
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 -x nda0
Print all Health log page entries in hexadecimal for
NVMe device nda0.
The command may fail for one of the following reasons:
- No output displayed
- The device does not support health data.
- CAMGETPASSTHRU ioctl failed
smart
relies on
cam(4)
to retrieve data from devices and will display this message if the device
does not have a passthrough driver. This can happen, for example, if the
system uses the
nvd(4)
NVMe driver instead of the
nda(4)
driver.