xref: /freebsd/contrib/smart/smart.8 (revision 7419d6e463fee40f0f52cd5bc46a93cbb7ac6114)
1.\"
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\" Copyright (c) 2021-2026 Chuck Tuffli
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" Note: The date here should be updated whenever a non-trivial
28.\" change is made to the manual page.
29.Dd February 14, 2026
30.Dt SMART 8
31.Os
32.Sh NAME
33.Nm smart ,
34.Nm diskhealth
35.Nd monitor disk health from a storage device via SMART
36.Sh SYNOPSIS
37.Nm
38.Op Fl dhitvx
39.Oo Fl a Ar page:attribute Ns Oo , Ns Ar page:attribute Oc Ns ... Oc
40.Op Fl Fl debug
41.Ar device
42.Nm diskhealth
43.Op Fl Dhitvx
44.Oo Fl a Ar page:attribute Ns Oo , Ns Ar page:attribute Oc Ns ... Oc
45.Op Fl Fl debug
46.Ar device
47.Sh DESCRIPTION
48The
49.Nm
50command allows the user to monitor the various information reported
51by Self-Monitoring, Analysis and Reporting Technology (SMART) present
52on most ATA, SCSI, and NVMe storage media.
53Because the structure of this information varies across protocols,
54.Nm
55normalizes entries using the format:
56.Bd -literal
57	<Page ID>    <Attribute ID>    <Value>    <Thresholds>
58.Ed
59.Pp
60Fields are tab-delimited by default, but the command can output
61data in any format supported by
62.Xr libxo 3 .
63.Pp
64Because ATA does not have log pages,
65.Nm
66uses the Command Feature field value in place of the log page ID.
67For SMART READ DATA, this value is 208 / 0xd0.
68Note that devices choose which attribute ID values they support, their
69descriptions, and the format of the data.
70The three values displayed with the
71.Fl Fl threshold
72option are:
73.Pp
74.Bl -dash -compact -offset indent
75.It
76Status flags (byte offset 1, 2 bytes)
77.It
78Nominal attribute value (byte offset 3, 1 byte)
79.It
80Worst Ever attribute value (byte offset 4, 1 byte)
81.El
82.Pp
83Additionally,
84.Nm
85reports the value of the SMART STATUS command (Command Feature field
86value 218 / 0xda).
87As this command does not return any data,
88the command represents this entry with a synthetic attribute
89ID of 0, and it uses the command status (0 or 1) as the attribute
90value.
91.Pp
92NVMe devices support the SMART/Health log page (Page ID 2 / 0x2).
93The data returned in this log page is not structured as attribute IDs.
94Instead,
95.Nm
96uses the byte offset of each field as the attribute ID.
97For example,
98byte 3 is the Available Spare.
99Thus, for NVMe, attribute ID 3 is
100Available Spare.
101Note that NVMe health data does not include threshold
102values, and as a result, the command will ignore the
103.Fl Fl threshold
104option.
105.Pp
106SCSI devices can support a number of log pages which report drive
107health.
108The command will report the following pages:
109.Pp
110.Bl -dash -compact -offset indent
111.It
112Write Errors (Page ID 2 / 0x2)
113.It
114Read Errors (Page ID 3 / 0x3)
115.It
116Verify Errors (Page ID 5 / 0x5)
117.It
118Non-medium Errors (Page ID 6 / 0x6)
119.It
120Last N Errors (Page ID 7 / 0x7)
121.It
122Temperature (Page ID 13 / 0xd)
123.It
124Start-stop Cycles (Page ID 14 / 0xe)
125.It
126Informational Exceptions (Page ID 47 / 0x2f)
127.El
128.Pp
129Note that all log pages are optional, and a particular drive
130may not support all these pages.
131For SCSI devices, the Attribute ID
132maps to the SCSI parameter code defined by the command.
133Parameter
134codes are integer values from 0 to N, and, by themselves, are ambiguous
135outside the context of a particular log page.
136Note that SCSI health data
137does not include threshold values, and as a result, the command will
138ignore the
139.Fl Fl threshold
140option.
141.Pp
142The following options are available:
143.Bl -tag -width "-d argument"
144.It Fl a Ar page:attribute , Fl Fl attribute= Ns Ar page:attribute
145A comma-separated list of attributes to display.
146If page is missing, display the matching attribute from any page.
147.It Fl d , Fl Fl decode
148Decode the attribute ID values.
149This is the default when invoked as
150.Nm diskhealth .
151.It Fl D , Fl Fl no-decode
152Do not decode the attribute ID values.
153This is the default when invoked as
154.Nm .
155.It Fl h , Fl Fl help
156Prints a usage message and exits.
157.It Fl i , Fl Fl info
158Print general device information.
159.It Fl t , Fl Fl threshold
160Also print the threshold values.
161.It Fl v , Fl Fl version
162Print the version and copyright.
163.It Fl x , Fl Fl hex
164Print the values in hexadecimal.
165.It Ar device
166An explicit device path
167.Pq Pa /dev/ada0
168or GEOM provider
169.Pq Pa ada0
170.
171.El
172.El
173.Sh EXIT STATUS
174.Ex -std
175.Sh EXAMPLES
176Print all SMART READ DATA and SMART STATUS including the
177threshold values for ATA drive ada0.
178.Pp
179.Dl # smart -t ada0
180.Pp
181Print only attribute ID 5 ("Reallocated Sectors Count") for
182ATA drive ada0.
183.Pp
184.Dl # smart -a 5 ada0
185.Pp
186Print attribute IDs 5 ("Reallocated Sectors Count") and 171
187("SSD Program Fail") for ATA drive ada0.
188.Pp
189.Dl # smart -a 5,171 ada0
190.Pp
191Print all health pages supported by SCSI device da0 including:
192.Bl -dash -compact -offset indent
193.It
194Write Errors
195.It
196Read Errors
197.It
198Verify Errors
199.It
200Non-medium Errors
201.It
202Last N Errors
203.It
204Temperature
205.It
206Start-stop Cycles
207.It
208Informational Exceptions
209.El
210.Pp
211.Dl # smart da0
212.Pp
213Print all Health log page entries in hexadecimal for NVMe
214device nda0.
215.Pp
216.Dl # smart -x nda0
217.Sh DIAGNOSTICS
218The command may fail for one of the following reasons:
219.Bl -diag
220.It "No output displayed"
221The device does not support health data.
222.It "CAMGETPASSTHRU ioctl failed"
223.Nm
224relies on
225.Xr cam 4
226to retrieve data from devices and will display this message if the
227device does not have a passthrough driver.
228This can happen, for
229example, if the system uses the
230.Xr nvd 4
231NVMe driver instead of the
232.Xr nda 4
233driver.
234.El
235.Sh SEE ALSO
236.Xr libxo 3 ,
237.Xr cam 4 ,
238.Xr nda 4 ,
239.Xr nvd 4
240.Sh AUTHORS
241This
242utility was written by
243.An Chuck Tuffli Aq Mt chuck@FreeBSD.org .
244.Sh BUGS
245Probably.
246