Attempting to pass -d sat, X with a certain USB<->{SATA, IDE} bridge causes device to require port reset

Rich <[email protected]> Fri, 27 May 2016 08:17:27 -0400
Newsgroups gmane.linux.utilities.smartmontools
Message-ID <CAOeNLuqXH0vk3JsQnym0vKAyz=3HJanRO6XKPCxiLqohSSqztA@mail.gmail.com>
Hi all,
So, I recently replaced my USB<->... bridge with another one [1], and found
some really fascinating behaviors with it, which I thought I'd ask about
and share.

The brief version, before reading on: it triggers an IO timeout and port
reset on -d sat,16 -H (or any option that includes -H) for either IDE or
SATA drives; -d sat,12 works for SATA drives attached and getting out
attribute information; -d sat,16 (partially) works for IDE drives; none of
the -d  usb* options are useful in either case.

Is there a reasonable way for smartctl/drivedb.h to handle something like
this? Also, does anyone have a device like this that they've had any
success getting e.g. SMART counter data on IDE drives through?

Thanks,
- Rich

===

(I have a reasonably modern SATA drive attached currently for purposes of
this example, but I'll touch on what it does with IDE drives after.)

smartctl -a -q noserial /dev/sdo gives:

smartctl 6.4 2014-10-07 r4002 [x86_64-linux-4.4.0-0.bpo.1-amd64] (local
build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.10
Device Model:     ST3500630AS
Firmware Version: 3.AAK
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA/ATAPI-7 (minor revision not indicated)
Local Time is:    Fri May 27 07:53:21 2016 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
[at this point, the device times out and the OS resets the USB port]
SMART Status command failed: Connection timed out
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                                        was completed without error.
                                        Auto Offline Data Collection:
Enabled.
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:                (  430) seconds.
Offline data collection
capabilities:                    (0x5b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off
support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        No Conveyance Self-test supported.
                                        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:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 163) minutes.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED
 WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   118   082   006    Pre-fail  Always
    -       0
  3 Spin_Up_Time            0x0003   093   093   000    Pre-fail  Always
    -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always
    -       131
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always
    -       0
  7 Seek_Error_Rate         0x000f   067   060   030    Pre-fail  Always
    -       25802783171
  9 Power_On_Hours          0x0032   078   078   000    Old_age   Always
    -       19766
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always
    -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always
    -       131
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always
    -       0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always
    -       0
190 Airflow_Temperature_Cel 0x0022   062   046   045    Old_age   Always
    -       38 (Min/Max 26/42)
194 Temperature_Celsius     0x0022   038   054   000    Old_age   Always
    -       38 (0 16 0 0 0)
195 Hardware_ECC_Recovered  0x001a   066   051   000    Old_age   Always
    -       239431346
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always
    -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline
   -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always
    -       0
200 Multi_Zone_Error_Rate   0x0000   100   253   000    Old_age   Offline
   -       0
202 Data_Address_Mark_Errs  0x0032   100   253   000    Old_age   Always
    -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.



Asking just for -i or -A, no timeouts.

Asking for -H, timeout and port reset.

dmesg after one of these rounds of resets looks like:
[220290.762916] program smartctl is using a deprecated SCSI ioctl, please
convert it to SG_IO
[220356.707812] usb 4-2.1: Disable of device-initiated U1 failed.
[220361.707351] usb 4-2.1: Disable of device-initiated U2 failed.
[220361.779488] usb 4-2.1: reset SuperSpeed USB device number 6 using
xhci_hcd


In contrast, with -d sat,12:

# smartctl -d sat,12 -H /dev/sdo
smartctl 6.4 2014-10-07 r4002 [x86_64-linux-4.4.0-0.bpo.1-amd64] (local
build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== 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.


No errors logged in dmesg, no timeout delay, just a "your device seems to
have mangled the response"

(FWIW, I tried iterating over usbjmicron/usbsunplus/usbcypress, and they
all returned things of the form "Read Device Identity failed: scsi error
unsupported scsi opcode" or "Read Device Identity failed: Unknown error")


Also, for what it does with a (working) IDE device (with working SMART on
other IDE controllers) and -d sat:

# smartctl -x -q noserial -d sat,12 /dev/sdo
smartctl 6.4 2014-10-07 r4002 [x86_64-linux-4.4.0-0.bpo.1-amd64] (local
build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.10
Device Model:     ST3500630A
Firmware Version: 3.AAC
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA/ATAPI-7 (minor revision not indicated)
Local Time is:    Fri May 27 08:07:50 2016 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is:   Unavailable
APM feature is:   Unavailable
Rd look-ahead is: Enabled
Write cache is:   Enabled
ATA Security is:  Disabled, NOT FROZEN [SEC1]
Wt Cache Reorder: Unavailable

Read SMART Data failed: scsi error unsupported scsi opcode

=== START OF READ SMART DATA SECTION ===
SMART Status command failed: scsi error unsupported scsi opcode
SMART overall-health self-assessment test result: UNKNOWN!
SMART Status, Attributes and Thresholds cannot be read.

Read SMART Log Directory failed: scsi error unsupported scsi opcode

ATA_READ_LOG_EXT (addr=0x00:0x00, page=0, n=1) failed: 48-bit ATA commands
require SAT ATA PASS-THROUGH (16)
Read GP Log Directory failed

SMART Extended Comprehensive Error Log (GP Log 0x03) not supported

Read SMART Error Log failed: scsi error unsupported scsi opcode

SMART Extended Self-test Log (GP Log 0x07) not supported

Read SMART Self-test Log failed: scsi error unsupported scsi opcode

Selective Self-tests/Logging not supported

SCT Commands not supported

Device Statistics (GP/SMART Log 0x04) not supported

SATA Phy Event Counters (GP Log 0x11) not supported

# smartctl -x -q noserial -d sat,16 /dev/sdo
smartctl 6.4 2014-10-07 r4002 [x86_64-linux-4.4.0-0.bpo.1-amd64] (local
build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.10
Device Model:     ST3500630A
Firmware Version: 3.AAC
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA/ATAPI-7 (minor revision not indicated)
Local Time is:    Fri May 27 08:08:22 2016 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is:   Unavailable
APM feature is:   Unavailable
Rd look-ahead is: Enabled
Write cache is:   Enabled
ATA Security is:  Disabled, NOT FROZEN [SEC1]
Wt Cache Reorder: Unavailable

Read SMART Data failed: scsi error unsupported scsi opcode

=== START OF READ SMART DATA SECTION ===
SMART Status command failed: scsi error unsupported scsi opcode
SMART overall-health self-assessment test result: UNKNOWN!
SMART Status, Attributes and Thresholds cannot be read.

Read SMART Log Directory failed: scsi error unsupported scsi opcode

General Purpose Log Directory Version 1
Address    Access  R/W   Size  Description
0x00       GPL     R/O      1  Log Directory
0x01       GPL     R/O      1  Summary SMART error log
0x02       GPL     R/O      5  Comprehensive SMART error log
0x03       GPL     R/O      5  Ext. Comprehensive SMART error log
0x06       GPL     R/O      1  SMART self-test log
0x07       GPL     R/O      1  Extended self-test log
0x09       GPL     R/W      1  Selective self-test log
0x20       GPL     R/O      1  Streaming performance log [OBS-8]
0x21       GPL     R/O      1  Write stream error log
0x22       GPL     R/O      1  Read stream error log
0x23       GPL     R/O      1  Delayed sector log [OBS-8]
0x80-0x9f  GPL     R/W     16  Host vendor specific log
0xa0       GPL     VS       1  Device vendor specific log
0xa1       GPL     VS      20  Device vendor specific log
0xa2       GPL     VS     101  Device vendor specific log
0xa8       GPL     VS      20  Device vendor specific log
0xa9       GPL     VS       1  Device vendor specific log
0xe0       GPL     R/W      1  SCT Command/Status
0xe1       GPL     R/W      1  SCT Data Transfer
0xff       GPL     -    23552  Reserved

ATA_READ_LOG_EXT (addr=0x03:0x00, page=0, n=1) failed: scsi error
unsupported scsi opcode
Read SMART Extended Comprehensive Error Log failed

Read SMART Error Log failed: scsi error unsupported scsi opcode

ATA_READ_LOG_EXT (addr=0x07:0x00, page=0, n=1) failed: scsi error
unsupported scsi opcode
Read SMART Extended Self-test Log failed

Read SMART Self-test Log failed: scsi error unsupported scsi opcode

Selective Self-tests/Logging not supported

SCT Commands not supported

Device Statistics (GP/SMART Log 0x04) not supported

SATA Phy Event Counters (GP Log 0x11) not supported


So, it would seem we'd want -d sat,12 for SATA attached to this device and
-d sat,16 for IDE, but I don't think the adapter itself exposes useful
information for which type of drive is attached.

(Also, for completeness, here's lsusb -v on the adapter):
Bus 004 Device 006: ID 1f75:0611 Innostor Technology Corporation
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         9
  idVendor           0x1f75 Innostor Technology Corporation
  idProduct          0x0611
  bcdDevice            0.06
  iManufacturer           4
  iProduct                5
  iSerial                 6 20151101
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           44
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength           22
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat        2047 micro seconds
Device Status:     0x000c
  (Bus Powered)
  U1 Enabled
  U2 Enabled



[1] - http://www.amazon.com/dp/B00DQJME7Y

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e

_______________________________________________
Smartmontools-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/smartmontools-support