please help translate smartctl output to human language
Ravi Pokala
rpokala at freebsd.org
Thu Aug 15 17:05:28 UTC 2019
> Date: Thu, 15 Aug 2019 11:28:47 +0100
> From: Graham Perrin <grahamperrin at gmail.com>
> To: freebsd-hackers at freebsd.org
> Subject: Re: please help translate smartctl output to human language
> Message-ID: <7bed2865-46c0-8649-d6b4-79a096f563c8 at gmail.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> Where the Reallocated_Sector_Ct RAW_VALUE comprises three values, two of which are in parentheses:
>
> - what are the two raw values in parentheses?
>
> A guess: are the two, in parentheses, representations of
> Current_Pending_Sector and Reallocated_Event_Count?
This doesn't really have anything to do with FreeBSD, but rather with smartmontools.
The short version is, the SMART "raw" value is a 48-bit value, which has different interpretations for different attributes.
I happen to have a copy of the smartmontools source handy, so I did some quick `grep'ing. In drivedb.h, "Reallocated_Sector_Ct" by default uses the format string "raw16(raw16)".
The manpage for `smartctl' reports:
| raw16(raw16) - Print 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.
In atacmds.cpp, "raw16(raw16)" is associated with RAWFMT_RAW16_OPT_RAW16, which goes to this code:
| case RAWFMT_RAW16_OPT_RAW16:
| s = strprintf("%u", word[0]);
| if (word[1] || word[2])
| s += strprintf(" (%u %u)", word[2], word[1]);
| break;
So, it's treating the 48-bit value as three separate 16-bit words, and is reporting them separately.
In your case, the value of the low 16-bits is 24 (0x0018), the value of the middle 16-bits is 3 (0x0003), and the value of the high 16-bits is 0 (0x0000).
-Ravi (rpokala@)
> Here, for example:
>
> root at momh167-gjp4-8570p:~ # smartctl -a /dev/ada0 | grep -E 'Reall|Pending'
> ? 5 Reallocated_Sector_Ct?? 0x0033?? 100?? 100?? 005??? Pre-fail Always?????? -?????? 24 (0 3)
> 196 Reallocated_Event_Count 0x0032?? 100?? 100?? 000??? Old_age Always?????? -?????? 3
> 197 Current_Pending_Sector? 0x0032?? 100?? 100?? 000??? Old_age Always?????? -?????? 0
> root at momh167-gjp4-8570p:~ #
>
> In context:
>
> <https://s.put.re/dwcfGGKE.png>
>
> <https://gist.github.com/grahamperrin/e624d443d3f10c7162ac7986f599fbd6#file-hgst_hts725050a7e630_tf0500y906l81l_2019-08-15-txt-L69>
More information about the freebsd-hackers
mailing list