[bug] smart plugin not detecting hdd's

The latest ‘smart’ plugin does not detect my spinning disks. I grabbed the latest version from github but its behavior is the same so I think this is a bug.

I think I traced it down to line 163:
CMD="smartctl -d ata -v 9,raw48 -A $D"

# smartctl -d ata -v 9,raw48 -A /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.8.3-arch1-1] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

Read Device Identity failed: Invalid argument

A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.

When I remove the -d ata from the command line it works fine.

Complete output from smartctl for one of the drives:

# smartctl -v 9,raw48 -A /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.8.3-arch1-1] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000b   100   100   016    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   133   133   054    Pre-fail  Offline      -       108
  3 Spin_Up_Time            0x0007   177   177   024    Pre-fail  Always       -       345 (Average 397)
  4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       88
  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0005   128   128   020    Pre-fail  Offline      -       18
  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       165
 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       88
 22 Helium_Level            0x0023   091   091   025    Pre-fail  Always       -       91
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       107
193 Load_Cycle_Count        0x0012   100   100   000    Old_age   Always       -       107
194 Temperature_Celsius     0x0002   176   176   000    Old_age   Always       -       34 (Min/Max 25/42)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       0

The information section from smartctl -a /dev/sda:

=== START OF INFORMATION SECTION ===
Model Family:     HGST Ultrastar He8
Device Model:     HGST HUH728080ALN600
Serial Number:    >redacted>
LU WWN Device Id: 5 000cca 23be82804
Firmware Version: A4GNT907
User Capacity:    8,001,563,222,016 bytes [8.00 TB]
Sector Size:      4096 bytes logical/physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Wed Aug 26 08:38:39 2020 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
1 Like

The “problem” is more the type of your HDD.
If you take a look at the smartmontools DB https://raw.githubusercontent.com/mirror/smartmontools/master/drivedb.h
You will see that your Ultrastar He8 has some special parameters and these parameters are not the same as inside the smart check script. That’s the problem.
It is not a complete bug but you can extend the script to check first if the HDD type is existing inside the database on you system and then decide if you check without options or with the general options from the script. If you scroll inside the database you will see that there are many drives without options and some with like your one.
At the moment you have around 700 entries inside the DB. I don’t know how often there are drives outside that are not inside the DB.

1 Like

I’m not sure I understand you. From the commandline:

smartctl -d ata -v 22,raw48,Helium_Level -A /dev/sda
smartctl -d ata -v 22,raw48 -A /dev/sda

Give the same error as I reported above.

In fact, using -d ata always throws an error.

smartctl -v 22,raw48,Helium_Level -A /dev/sda
smartctl -v 22,raw48 -A /dev/sda
smartctl -A /dev/sda

All give the same output, the -v bla bla bla doesn’t change anything in the output of smartctl which makes complete sense actually.

smartctl -v 9,raw48 -A /dev/sda will actually overwrite ID 9 (Power_On_Hours) with Helium_Level, so I end up with 2 of those.

I’m not even sure why this script wants to enforce those parameters on all sata disks because smartctl without any parameters will work out what its supposed to use anyway, as long as the disk is found in its database. So, if there are custom parameters, smartctl will pick those up from its database. As far as I know (and from my own experience), if smartctl doesn’t find a disk in its database, it will try sane defaults which will work in most cases.

So with that in mind, the smart script shouldn’t be using those parameters as (in my humble opinion), smartctl is smarter than that smart script :slight_smile:. At least for sata disks on standard sata controllers that is.

I’m sure though there’s a good reason why its in there, I don’t think I’m smarter than those developers :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.