xref: /freebsd/contrib/smart/README.md (revision 7419d6e463fee40f0f52cd5bc46a93cbb7ac6114)
1*7419d6e4SChuck Tuffli# README #
2*7419d6e4SChuck Tuffli
3*7419d6e4SChuck Tuffli### What is this repository for? ###
4*7419d6e4SChuck Tuffli
5*7419d6e4SChuck Tuffli* Application to output the SMART values of disks
6*7419d6e4SChuck Tuffli
7*7419d6e4SChuck Tuffli### How do I get set up? ###
8*7419d6e4SChuck Tuffli
9*7419d6e4SChuck TuffliClone this repository onto a FreeBSD box and run make
10*7419d6e4SChuck Tuffli
11*7419d6e4SChuck Tuffli    $ git clone https://github.com/ctuffli/smart
12*7419d6e4SChuck Tuffli    $ cd smart && make
13*7419d6e4SChuck Tuffli
14*7419d6e4SChuck Tufflior install it from ports ( http://www.freshports.org/sysutils/smart/ )
15*7419d6e4SChuck Tuffli
16*7419d6e4SChuck Tuffli### How to use
17*7419d6e4SChuck Tuffli    Usage: smart [-htxi] [-a attribute[,attribute]...] <device name>
18*7419d6e4SChuck Tuffli            -h, --help
19*7419d6e4SChuck Tuffli            -t, --threshold : also print out the threshold values
20*7419d6e4SChuck Tuffli            -x, --hex : print the values out in hexadecimal
21*7419d6e4SChuck Tuffli            -a, --attribute : print a specific attribute(s)
22*7419d6e4SChuck Tuffli            -i, --info : print general device information
23*7419d6e4SChuck Tuffli            -d, --decode: decode the attribute IDs
24*7419d6e4SChuck Tuffli            -D, --no-decode: don't decode the attribute IDs
25*7419d6e4SChuck Tuffli            -v, --version : print the version and copyright
26*7419d6e4SChuck Tuffli
27*7419d6e4SChuck Tuffli### Example
28*7419d6e4SChuck Tuffli* List the raw attributes of SATA device /dev/ada0
29*7419d6e4SChuck Tuffli
30*7419d6e4SChuck Tuffli        smart ada0
31*7419d6e4SChuck Tuffli
32*7419d6e4SChuck Tuffli* List the decoded attributes of NVMe device /dev/nda0
33*7419d6e4SChuck Tuffli
34*7419d6e4SChuck Tuffli        smart -d nda0
35*7419d6e4SChuck Tuffli
36*7419d6e4SChuck Tuffli  or
37*7419d6e4SChuck Tuffli
38*7419d6e4SChuck Tuffli        diskhealth nda0
39*7419d6e4SChuck Tuffli
40*7419d6e4SChuck Tuffli### What does the raw output mean?
41*7419d6e4SChuck TuffliThe format and location of SMART / health data varies across protocols.
42*7419d6e4SChuck TuffliTo simplify the output, the application uses a Dumb Unified Model of
43*7419d6e4SChuck TuffliSMART Buffers. In this model, SMART data is located in one or more log
44*7419d6e4SChuck Tufflipages. Each page contains one or more values ("attributes")
45*7419d6e4SChuck Tufflidifferentiated by an ID. Note that ID's are only unique within a log
46*7419d6e4SChuck Tufflipage. Thus, the application outputs:
47*7419d6e4SChuck Tuffli
48*7419d6e4SChuck Tuffli    <Log Page ID> <Attribute ID> <Attribute value>
49*7419d6e4SChuck Tufflifor each selected attribute. Threshold values, if defined by the protocol
50*7419d6e4SChuck Tuffliand selected by the user, are printed after the attribute value.
51*7419d6e4SChuck Tuffli
52*7419d6e4SChuck TuffliSee the shell scripts `atasmart`, `nvmesmart`, and `scsismart` for examples of parsing the output.
53*7419d6e4SChuck Tuffli
54*7419d6e4SChuck Tuffli### What is the decoded output?
55*7419d6e4SChuck TuffliDecoded output converts numeric values (Log Page, Attribute ID and Value tuples) into human-readable descriptions.
56*7419d6e4SChuck Tuffli
57*7419d6e4SChuck TuffliThe output for protocols like NVMe and SCSI which provide standardized descriptions will match the text in the specification. ATA, however, allows vendors to define their own attributes. For ATA, descriptions come from the "SMART Attribute Descriptions (SAD)" (ANSI - INCITS TR-54) specification which documents attributes common to multiple ATA drive vendors.
58*7419d6e4SChuck Tuffli
59*7419d6e4SChuck Tuffli### Protocol Specific Notes
60*7419d6e4SChuck Tuffli* __ATA__ : The attribute and values follow the 'standard'. The log page is the Feature value used in ATA command. Thus, the default page is 208 / 0xd0 (a.k.a SMART Read Data). The threshold values printed are status flags, current value, and worst value. The SMART Return Status (Feature 218 / 0xda) indicates the reliability status of the device and is sometimes used as a top-level SMART health indication. While this command does not return data, the application encodes "no errors" as 0x0 and "threshold exceeded" as 0x1 in attribute 0.
61*7419d6e4SChuck Tuffli* __NVMe__ : The Log Page is the SMART / Health Information LID value in the Get Log Page command (i.e. 0x2). The attribute ID is the byte offset within this page.
62*7419d6e4SChuck Tuffli* __SCSI__ : The Log Page ID is the Page Code value in the Mode Sense command. The attribute ID is the parameter code defined by this page (e.g. 0 in the Write Error Counters log page is 'Errors corrected without substantial delay'). The values will depend on the Page Codes supported by a drive.
63