How to update smartmontools drivedb in Debian Stretch (without package update)

Written by - 0 comments

Published on October 15th 2020 - Listed in Monitoring Hardware Linux


In Debian Stretch (Debian 9), the smartmontools package comes in version 6.6, even though the package itself is showing as 6.5:

ck@stretch:~$ dpkg -l|grep smartmontools
ii  smartmontools    6.5+svn4324-1   amd64   control and monitor storage systems using S.M.A.R.T.

When the smartctl command is executed with the -V parameter (to show the version), it actually shows 6.6:

root@stretch ~ # smartctl -V
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-8-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

smartctl comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome to redistribute it under
the terms of the GNU General Public License; either
version 2, or (at your option) any later version.
See http://www.gnu.org for further details.

smartmontools release 6.6 dated 2016-05-07 at 11:17:46 UTC
smartmontools SVN rev 4324 dated 2016-05-31 at 20:45:50
smartmontools build host: x86_64-pc-linux-gnu
smartmontools build with: C++98, GCC 5.4.0 20160609
smartmontools configure arguments: '--prefix=/usr' '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--sysconfdir=/etc' '--mandir=/usr/share/man' '--with-initscriptdir=no' '--docdir=/usr/share/doc/smartmontools' '--with-savestates=/var/lib/smartmontools/smartd.' '--with-attributelog=/var/lib/smartmontools/attrlog.' '--with-exampledir=/usr/share/doc/smartmontools/examples/' '--with-drivedbdir=/var/lib/smartmontools/drivedb' '--with-systemdsystemunitdir=/lib/systemd/system' '--with-smartdscriptdir=/usr/share/smartmontools' '--with-smartdplugindir=/etc/smartmontools/smartd_warning.d' '--with-systemdenvfile=/etc/default/smartmontools' '--with-selinux' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CXXFLAGS=-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -fsigned-char -Wall -O2' 'LDFLAGS=-fPIE -pie -Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CFLAGS=-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -fsigned-char -Wall -O2'

Unknown attributes on (newer) drives

When smartctl is launched against (newer) drives and certain SMART attributes only show up as "Unknown Attribute", this means that this physical drive could not be matched against smartmontool's internal drive database (known as drivedb). Here's an example of a WD Blue SSD behind a HP Smart Array controller:

root@stretch ~ # smartctl -a /dev/sda -d cciss,0
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-8-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     WDC WDS100T2B0A
Serial Number:    obfuscated
LU WWN Device Id: 5 001b44 4a769da68
Firmware Version: X61190WD
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   Unknown(0x0ff0), ACS-4 T13/BSR INCITS 529 revision 5
SATA Version is:  SATA >3.2 (0x1ff), 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Thu Oct 15 11:12:46 2020 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART Status not supported: Incomplete response, ATA output registers missing
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.

General SMART Values:
Offline data collection status:  (0x00)    Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:         (    0) seconds.
Offline data collection
capabilities:              (0x11) SMART execute Offline immediate.
                    No Auto Offline data collection support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    No Selective Self-test supported.
SMART capabilities:            (0x0003)    Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01)    Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:      (   2) minutes.
Extended self-test routine
recommended polling time:      (  10) minutes.

SMART Attributes Data Structure revision number: 4
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0032   100   100   ---    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   100   100   ---    Old_age   Always       -       1535
 12 Power_Cycle_Count       0x0032   100   100   ---    Old_age   Always       -       3
165 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       7536705
166 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       1
167 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       71
168 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       4
169 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       1006
170 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       0
171 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       0
172 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       0
173 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       1
174 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       1

184 End-to-End_Error        0x0032   100   100   ---    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   ---    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   ---    Old_age   Always       -       0
194 Temperature_Celsius     0x0022   071   032   ---    Old_age   Always       -       29 (Min/Max 24/32)
199 UDMA_CRC_Error_Count    0x0032   100   100   ---    Old_age   Always       -       0
230 Unknown_SSD_Attribute   0x0032   100   100   ---    Old_age   Always       -       55835230221
232 Available_Reservd_Space 0x0033   100   100   004    Pre-fail  Always       -       100
233 Media_Wearout_Indicator 0x0032   100   100   ---    Old_age   Always       -       1391
234 Unknown_Attribute       0x0032   100   100   ---    Old_age   Always       -       1600
241 Total_LBAs_Written      0x0030   253   253   ---    Old_age   Offline      -       1493
242 Total_LBAs_Read         0x0030   253   253   ---    Old_age   Offline      -       7276
244 Unknown_Attribute       0x0032   000   100   ---    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

Selective Self-tests/Logging not supported

The obvious fix would be to update the smartmontools package - but that's actually not necessary.

Manually updating the smartmontools drive database (drivedb)

The smartmontools drive database is actually a static file (drivedb.h) and not compiled into the smartctl binary. The location of the database can also be seen using the dpkg command:

root@stretch ~ # dpkg -S smartmontools|grep drivedb
smartmontools: /var/lib/smartmontools/drivedb/drivedb.h
smartmontools: /var/lib/smartmontools/drivedb

And this file can be replaced by a newer version from the relevant branch (Release 6.6 in this case).

Make a backup copy of the existing drivedb:

root@stretch ~ # cp /var/lib/smartmontools/drivedb/drivedb.h{,.bkp}

Then download the new drivedb.h from the smartmontools GitHub repository (which is a clone of their own trac repository):

root@stretch ~ # wget https://raw.githubusercontent.com/smartmontools/smartmontools/origin/RELEASE_6_6_DRIVEDB/smartmontools/drivedb.h -O /var/lib/smartmontools/drivedb/drivedb.h

Make sure you are using the correct release branch (RELEASE_6_6_DRIVEDB in this case).

No more unknown attributes

The same smartctl command from before can now be executed again. It will match the drive with the newer drivedb in the background and the correct attribute names are now showing up, instead of Unknown_Attribute:

root@stretch ~ # smartctl -a /dev/sda -d cciss,0
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-8-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     WD Blue / Red / Green SSDs
Device Model:     WDC WDS100T2B0A
Serial Number:    obfuscated
LU WWN Device Id: 5 001b44 4a769da68
Firmware Version: X61190WD
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   Unknown(0x0ff0), ACS-4 T13/BSR INCITS 529 revision 5
SATA Version is:  SATA >3.2 (0x1ff), 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Thu Oct 15 11:20:18 2020 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART Status not supported: Incomplete response, ATA output registers missing
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.

General SMART Values:
Offline data collection status:  (0x00)    Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:         (    0) seconds.
Offline data collection
capabilities:              (0x11) SMART execute Offline immediate.
                    No Auto Offline data collection support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    No Selective Self-test supported.
SMART capabilities:            (0x0003)    Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01)    Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:      (   2) minutes.
Extended self-test routine
recommended polling time:      (  10) minutes.

SMART Attributes Data Structure revision number: 4
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0032   100   100   ---    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   100   100   ---    Old_age   Always       -       1536
 12 Power_Cycle_Count       0x0032   100   100   ---    Old_age   Always       -       3
165 Block_Erase_Count       0x0032   100   100   ---    Old_age   Always       -       7536705
166 Minimum_PE_Cycles_TLC   0x0032   100   100   ---    Old_age   Always       -       1
167 Max_Bad_Blocks_per_Die  0x0032   100   100   ---    Old_age   Always       -       71
168 Maximum_PE_Cycles_TLC   0x0032   100   100   ---    Old_age   Always       -       4
169 Total_Bad_Blocks        0x0032   100   100   ---    Old_age   Always       -       1006
170 Grown_Bad_Blocks        0x0032   100   100   ---    Old_age   Always       -       0
171 Program_Fail_Count      0x0032   100   100   ---    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   100   100   ---    Old_age   Always       -       0
173 Average_PE_Cycles_TLC   0x0032   100   100   ---    Old_age   Always       -       1
174 Unexpected_Power_Loss   0x0032   100   100   ---    Old_age   Always       -       1
184 End-to-End_Error        0x0032   100   100   ---    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   ---    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   ---    Old_age   Always       -       0
194 Temperature_Celsius     0x0022   072   032   ---    Old_age   Always       -       28 (Min/Max 24/32)
199 UDMA_CRC_Error_Count    0x0032   100   100   ---    Old_age   Always       -       0
230 Media_Wearout_Indicator 0x0032   100   100   ---    Old_age   Always       -       0x000d000a000d
232 Available_Reservd_Space 0x0033   100   100   004    Pre-fail  Always       -       100
233 NAND_GB_Written_TLC     0x0032   100   100   ---    Old_age   Always       -       1392
234 NAND_GB_Written_SLC     0x0032   100   100   ---    Old_age   Always       -       1600
241 Host_Writes_GiB         0x0030   253   253   ---    Old_age   Offline      -       1493
242 Host_Reads_GiB          0x0030   253   253   ---    Old_age   Offline      -       7278
244 Temp_Throttle_Status    0x0032   000   100   ---    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

Selective Self-tests/Logging not supported

TL;DR

For a better drive detection in smartctl it's not necessary to update the whole smartmontools package. A manual update from the drivedb.h can already help. However for newer features (such as NVMe drives), an upgrade of smartmontools is recommended.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.