From owner-freebsd-hackers@freebsd.org Thu Aug 15 17:05:28 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AE40AF10F for ; Thu, 15 Aug 2019 17:05:28 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 468Xrm2f1tz45pf for ; Thu, 15 Aug 2019 17:05:28 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.228] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id F3FF04E5F for ; Thu, 15 Aug 2019 17:05:27 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1b.0.190715 Date: Thu, 15 Aug 2019 10:05:24 -0700 Subject: Re: please help translate smartctl output to human language From: Ravi Pokala To: "freebsd-hackers@freebsd.org" Message-ID: <0D470EB1-D893-4855-B081-0351DB9FF93E@panasas.com> Thread-Topic: please help translate smartctl output to human language Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Aug 2019 17:05:28 -0000 > Date: Thu, 15 Aug 2019 11:28:47 +0100 > From: Graham Perrin > To: freebsd-hackers@freebsd.org > Subject: Re: please help translate smartctl output to human language > Message-ID: <7bed2865-46c0-8649-d6b4-79a096f563c8@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@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@momh167-gjp4-8570p:~ # > > In context: > > > >