Page 1 of 1

S.M.A.R.T no longer working for USB drive

Posted: 26 Sep 2017 10:59
by rootmeansqr
SMART used to work for my USB drive, but no longer does.
Currently running

Code: Select all

11.1.0.4 - Atomics (revision 4551)
I went through a bit of troubleshooting and the following is my trace:
From the S.M.A.R.T Info page:

Code: Select all

/dev/da0: Unknown USB bridge 0x1058:0x25a1 (0x1013)
Please specify device type with the -d option.
So the device type needs to be specified.
I try from SSH:

Code: Select all

# smartctl -a -d sat /dev/da0
smartctl 6.5 2016-05-07 r4318 FreeBSD 11.1-RELEASE-p1 amd64 (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Elements / My Passport (USB, AF)
Device Model:     WDC WD20NMVW-11EDZS7
Serial Number:    WD-WXE1A47C9NHZ
LU WWN Device Id: 5 0014ee 2b9589fd0
Firmware Version: 01.01A01
User Capacity:    2,000,398,934,016 bytes 2.00 TB
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5200 rpm
Device is:        In smartctl database for details use: -P show
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 3.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Tue Sep 26 01:37:04 2017 PDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
...
works with no problem.

So, on the Disk Management page, I add

Code: Select all

-d sat
to the "S.M.A.R.T. extra options" value, thinking it would work.
But when I do that, smartd fails to restart due to error in the /var/etc/smartd.conf file:
It was changed from:

Code: Select all

/dev/da0 -a -T permissive -s (S/../.././01) -W 3,40,50 -n never,q -m <email> -M exec /etc/mail/smartdreport.sh 
to:

Code: Select all

/dev/da0 -a -d -d -T permissive -s (S/../.././01) -W 3,40,50 -n never,q -m <email> -M exec /etc/mail/smartdreport.sh sat
As you can see, it added "-d -d" and then "sat" at the end.
That didn't work out.

Then I take a look at the /usr/rc.d/smartd script and notice that it's rebuilding the smartd.conf file from the config.xml file, so I take a look at that.

Code: Select all

                <disk>
                        <uuid>ae60b9a0-4772-4c1c-a275-1295c62d20a9</uuid>
                        <name>da0</name>
                        <id></id>
                        <devicespecialfile>/dev/da0</devicespecialfile>
                        <model>WD Elements 25A1 1013</model>
                        <desc>WD Elements 25A1 1013</desc>
                        <type>SCSI</type>
                        <serial>5758453141343743394E485A</serial>
                        <size>2.00TB</size>
                        <harddiskstandby>0</harddiskstandby>
                        <acoustic>0</acoustic>
                        <apm>0</apm>
                        <fstype>geli</fstype>
                        <transfermode>auto</transfermode>
                        <controller>umass-sim</controller>
                        <controller_id>0</controller_id>
                        <controller_desc>XHCI (generic) USB 3.0 controller</controller_desc>
                        <smart>
                                <devicefilepath>/dev/da0</devicefilepath>
                                <devicetype/>
                                <devicetypearg/>
                                <enable type="bool">1</enable>
                                <extraoptions/>
                        </smart>
                </disk>
Notice that <devicetype> and <devicetypearg> are both empty.
Looking further, I see that config.xml get regenerated everytime I "Clear Config and Import Disks" from the HDD Management GUI. So something in this process is not working right.

I also see in /var/scripts/CONFIG2 the following:

Code: Select all

MOUNT1DISK0_DEVICETYPEARG=UNAVAILABLE
MOUNT1DISK0=da0
MOUNT2=zfsPool01
MOUNT2VDEVICE0=zfsPool01_raidz1_1
MOUNT2DISK0_DEVICE=ada0
MOUNT2DISK0_DEVICETYPEARG=atacam
MOUNT2DISK0=ada0
MOUNT2DISK1_DEVICE=ada1
MOUNT2DISK1_DEVICETYPEARG=atacam
MOUNT2DISK1=ada1
MOUNT2DISK2_DEVICE=ada2
MOUNT2DISK2_DEVICETYPEARG=atacam
MOUNT2DISK2=ada2
Seeing UNAVAILABLE here for da0, when the others show as atacam indicate to me that somethings not working quite right on the import.
But I should be able to overcome all this with those "S.M.A.R.T. extra options" on the disk configuration.

There seem to be a couple of issues/bugs, but not sure where to go from here.
Any help would be appreciated.

Re: S.M.A.R.T no longer working for USB drive

Posted: 26 Sep 2017 18:47
by tony1
try it with the latest version maybe? revision 4619

Re: S.M.A.R.T no longer working for USB drive

Posted: 13 Oct 2017 11:40
by dimitry
Hi,

I faced the same problem.
I managed to get temperature on the Diagnostics > Information > Disks page, but Diagnostics > Information > S.M.A.R.T. still cant get data.

I manually changed the /cf/conf/config.xml - added the value "sat" to the <devicetypearg>:

Code: Select all

<disk>
	...
	<devicespecialfile>/dev/da0</devicespecialfile>
	<model>WD My Passport 25E2 4004</model>
	<controller_desc>ASMedia ASM1042 USB 3.0 controller</controller_desc>
	...
	<smart>
		<devicefilepath>/dev/da0</devicefilepath>
		<devicetype/>
		<devicetypearg>sat</devicetypearg>
		<enable type="bool">1</enable>
		<extraoptions/>
	</smart>
	...
</disk>
As a side effect I received the warning on the page Disks > Management > HDD Management:
Configuration information about devices is different from physical devices. Please remove those devices and re-add them or run import disks with clear configuration option enabled.

Re: S.M.A.R.T no longer working for USB drive

Posted: 13 Oct 2017 13:46
by dimitry
Not sure if it is a complete solution, but...

I modified the function from /etc/inc/util.inc: 1078, named `parse_controller_config`.

In my case: The controller for my external USB HDD WesternDigital (Device Model: WDC WD30NMZW-11GX6S1) was determined as 'umass-sim'.
the 'case' of 'switch' in that function does not have references to the disks config, so I added it.

Code: Select all

function parse_controller_config(&$devlist) {  
    global $config_disks;  
  
    foreach($devlist as &$device):  
        $devtype = '';  
        $device['desc'] = $config_disks[$device['name']]['desc'] ?? '';  
        switch($device['controller']):  
            // ...... 
            // USB Mass Storage  
            case 'umass-sim':  
                $device['model'] = parse_device_desc($device['name']);  
                $device['controller_desc'] = parse_umass_controller_desc($device['controller_id']);  
                $device['smart']['devicefilepath'] = '/dev/' . $device['name'];
                
                // NEW LINES ARE ADDED HERE ////
                if(!empty($config_disks[$device['smart']['devicefilepath']]['smart']['devicetypearg'])):  
                    $device['smart']['devicetypearg'] = $config_disks[$device['smart']['devicefilepath']]['smart']['devicetypearg'];  
                endif;
                //////////////////////////
                
                break;  
            default:  
                // .......
    return $devlist;  
}  

And finally I can see S.M.A.R.T info of my external HDD on the page Diagnostics > Information > S.M.A.R.T.

smart.png

Re: S.M.A.R.T no longer working for USB drive

Posted: 13 Oct 2017 16:58
by ms49434
enter

Code: Select all

sat #
into extra options

Re: S.M.A.R.T no longer working for USB drive

Posted: 13 Oct 2017 17:10
by dimitry
enter

Code: Select all

sat #
into extra options

I tried. Did not work:

Code: Select all

/dev/da1: Unknown USB bridge [0x058f:0x6366 (0x100)]
Please specify device type with the -d option.

Use smartctl -h to get a usage summary
ID	Attribute Name	Raw Value	Description
No Data
/dev/da1: Unknown USB bridge [0x058f:0x6366 (0x100)]
Please specify device type with the -d option.

Use smartctl -h to get a usage summary

Re: S.M.A.R.T no longer working for USB drive

Posted: 13 Oct 2017 17:30
by ms49434
could you please post the content of /var/etc/smartd.conf

It should show something like:

Code: Select all

/dev/da0 -a -d sat -T permissive -s (S/../.././01) -W 3,40,50 -n never,q -m <email> -M exec /etc/mail/smartdreport.sh #

You should ensure that you revert your modifications so that devicetypearg is empty.

Re: S.M.A.R.T no longer working for USB drive

Posted: 13 Oct 2017 17:47
by dimitry
mm.. I dont have this file. May b/c `Self-Monitoring, Analysis & Reporting Technology` is not enabled? I do not want to enable it, my issue was just related to the Diagnostics > Information > S.M.A.R.T. page, where S.M.A.R.T data is displayed even without 'Self-Monitoring, Analysis...' tool enabled

Here is the list of dirs/files in /var/etc

Code: Select all

afp.conf
cert.pem
crontab
exports
hosts
iscsi
ldap.conf
ldap.secret
lighttpd.conf
mdnsresponder.conf
msmtp.conf
netatalk
nsswitch.conf
nut.conf
pam.d
private
resolv.conf
rsyncd.conf
smb4.conf
ssh
ssl
syslog.conf
ups.conf
upsd.conf
upsd.users
upsmon.conf
upssched.conf

Re: S.M.A.R.T no longer working for USB drive

Posted: 13 Oct 2017 22:25
by ms49434
Ah, ok, the workaround I provided was for the daemon, not for the Diagnostics > Information > S.M.A.R.T. page

You both encounter the issue that your USB device cannot be autodetected by smartmontools.
The USB ID rootmeansqr reported is on the actual list of supported devices (but bcdDevice is unkown).
The USB ID reported by dimitry is on the list of unsupported devices.

Source: Smartmontools supported and unsupported USB devices

Manually overwriting information in config.xml is not the solution as information will be overwritten on the next disk import.
The code snipped provided by dimitry is not a generic solution and requires manual modification of config.xml as well. Information will get lost on the next disk import.
Setting the devicearg value to 'sat' permanently for USB devices will break other controllers as they might use a different mechanism (see above document).

Re: S.M.A.R.T no longer working for USB drive

Posted: 14 Oct 2017 10:20
by dimitry
Thanks for detailed answer!
Now its totally clear.

My fixes are too 'manual', and I' m aware I'll loose it in next import/reboot.

May be in some of future releases you guys invent some way to work with this kind of devices - devise is not supported, but however returns SMART info.

Thanks a lot!

Re: S.M.A.R.T no longer working for USB drive

Posted: 14 Oct 2017 20:26
by tony1
I would think -d sat,auto in S.M.A.R.T. extra options for the disk would work but I have nothing to try it out with.

Re: S.M.A.R.T no longer working for USB drive

Posted: 17 Oct 2017 19:27
by ms49434
dimitry wrote:
14 Oct 2017 10:20
Thanks for detailed answer!
Now its totally clear.

My fixes are too 'manual', and I' m aware I'll loose it in next import/reboot.

May be in some of future releases you guys invent some way to work with this kind of devices - devise is not supported, but however returns SMART info.

Thanks a lot!

The ability to define a device type for an unknown USB mass storage device has been added, see commits 4697,4698,4701 and 4702.

Re: S.M.A.R.T no longer working for USB drive

Posted: 19 Oct 2017 21:33
by ms49434
New release

Please goto Disks > Management > S.M.A.R.T. > USB Mass Storage Devices

rootmeansqr, you should add a new record with identity [0x1058:0x25a1 (0x1013)] and type 'sat'. I was wondering why your ID is not shown in brackets but we'll see if it works for you.
Dimitry, you should add a new record with identity [0x058f:0x6366 (0x100)] and type 'sat'.

Once done you should import your disks with 'clear configuration information before importing disks' checked.

Re: S.M.A.R.T no longer working for USB drive

Posted: 26 Oct 2017 08:17
by rootmeansqr
ms49434, this worked for me, thanks! I had not seen the Disks > HDD Management > S.M.A.R.T. > USB Mass Storage Devices page before, and was managing S.M.A.R.T. settings from Disks > HDD Management and then editing the Disk Settings and attempting to put '-d sat' in the 'S.M.A.R.T. extra options' field.

While the USB Mass Storage Device setting worked for me, I still feel like the 'S.M.A.R.T. extra options' field isn't being implemented properly as the options are added to the /var/etc/smartd.conf file is a very weird way such that it breaks the daemon. See first post to see what it did to the file.

As for those brackets, I've updated from 11.1.0.4 - Atomics (revision 4551) to (revision 4729) and they now appear.

Re: S.M.A.R.T no longer working for USB drive

Posted: 26 Oct 2017 08:21
by rootmeansqr
tony1 wrote:
14 Oct 2017 20:26
I would think -d sat,auto in S.M.A.R.T. extra options for the disk would work but I have nothing to try it out with.
I thought the same thing, but you can see how it puts those options into the /var/etc/smartd.conf file in my first post.

with empty S.M.A.R.T. extra options field:

Code: Select all

/dev/da0 -a -T permissive -s (S/../.././01) -W 3,40,50 -n never,q -m <email> -M exec /etc/mail/smartdreport.sh 
with "-d sat" in the S.M.A.R.T. extra options field (minus the quotes):

Code: Select all

/dev/da0 -a -d -d -T permissive -s (S/../.././01) -W 3,40,50 -n never,q -m <email> -M exec /etc/mail/smartdreport.sh sat
As you can see, it added "-d -d" and then "sat" at the end.

Re: S.M.A.R.T no longer working for USB drive

Posted: 27 Oct 2017 17:54
by ms49434
This is an unwanted parameter shifting caused by an empty devicetypearg value. A bugfix has been committed, see r4804.

Re: S.M.A.R.T no longer working for USB drive

Posted: 06 Nov 2017 11:40
by dimitry
Thanks a lot! Works perfectly :)