Changes between Version 1 and Version 2 of SAT-with-UAS-Linux


Ignore:
Timestamp:
Aug 5, 2019, 3:24:43 AM (4 months ago)
Author:
Nathan Stratton Treadway
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SAT-with-UAS-Linux

    v1 v2  
    77
    88= SAT with UAS under Linux =
     9
     10
     11== Overview ==
     12
     13As mentioned on the [wiki:USB USB devices and smartmontools] page, in certain situations the Linux "uas" driver disables SAT transfers, which prevents `smartmontools` (and other tools, e.g. `hdparm`) from communicating properly with the attached SATA device.  See [query:?keywords=~uas+linux related tickets] for examples.
     14
     15This is because the Linux kernel rejects SAT ATA pass-through commands for certain devices with broken pass-through support.
     16This depends on Kernel version and may include
     17[https://github.com/torvalds/linux/commit/7fee72d5e8f1e7b8d8212e28291b1a0243ecf2f1 all Seagate enclosures],
     18[https://github.com/torvalds/linux/commit/bda13e35d584dabf52c9f77e0fe62683ac4d9f86 Initio INIC-3069] and
     19[https://github.com/torvalds/linux/commit/673029fe9c16c95600bdaca4760673527af32edf VIA VL711].
     20
     21== Technical Details ==
     22
     23The problem is that certain USB-SATA-bridge chipsets do not properly pass SAT commands on to the SATA device when running in UAS mode, and to work around this problem Linux automatically enables the NO_ATA_1X flag for those chipsets.  This turns off SAT passthrough... which in turn means that smartmontools is prevented from communicating with the device.
     24
     25For many of these chipsets, SAT passthrough works correctly is the old [https://en.wikipedia.org/wiki/USB_mass_storage_device_class BOT] (`usb-storage` driver) mode, and so smartmontools may suddenly stop working when the kernel is upgraded to a version which supports UAS, or from one which did did not apply the flag for that device to a newer kernel which does.
     26
     27For more information on the usb-storage flags, search for the 'usb-storage.quirks' entry in the [https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html Kernel Parameters Documentation].
     28
     29The detailed selection logic used by the kernel to decide which devices get this flag can be found in the `uas_use_uas_driver()` function in the [https://github.com/torvalds/linux/blob/master/drivers/usb/storage/uas-detect.h drivers/usb/storage/uas-detect.h]  combined with the list of entries found in the [https://github.com/torvalds/linux/blob/master/drivers/usb/storage/unusual_uas.h drivers/usb/storage/unusual_uas.h]
     30file.  (As far as smartmontools/SAT passthrough is concerned, only the NO_ATA_1X flag is significant.)
     31
     32There doesn't seem to be a definitive way to confirm that the NO_ATA_1X flag is in fact in effect for a particular device, but if it is the symptom will be that commands which rely on SAT show invalid data, e.g.
     33
     34{{{
     35# smartctl -d sat -a /dev/sdb
     36smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-33-generic] (local build)
     37Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
     38
     39Read Device Identity failed: scsi error unsupported field in scsi command
     40
     41A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
     42
     43
     44# smartctl -d sat -T permissive -a /dev/sdb
     45smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-33-generic] (local build)
     46Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
     47
     48Read Device Identity failed: scsi error unsupported field in scsi command
     49
     50=== START OF INFORMATION SECTION ===
     51Device Model:     [No Information Found]
     52Serial Number:    [No Information Found]
     53Firmware Version: [No Information Found]
     54Device is:        Not in smartctl database [for details use: -P showall]
     55ATA Version is:   [No Information Found]
     56Local Time is:    Mon Aug 27 20:44:01 2018 CEST
     57SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 82-83 don't show if SMART supported.
     58SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 85-87 don't show if SMART is enabled.
     59A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive
     60}}}
     61
     62or
     63
     64{{{
     65# hdparm -I /dev/sdc
     66
     67/dev/sdc:
     68SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     69
     70ATA device, with non-removable media
     71Standards:
     72        Likely used: 1
     73Configuration:
     74        Logical         max     current
     75        cylinders       0       0
     76        heads           0       0
     77        sectors/track   0       0
     78        --
     79        Logical/Physical Sector size:           512 bytes
     80        device size with M = 1024*1024:           0 MBytes
     81        device size with M = 1000*1000:           0 MBytes
     82        cache/buffer size  = unknown
     83Capabilities:
     84        IORDY not likely
     85        Cannot perform double-word IO
     86        R/W multiple sector transfer: not supported
     87        DMA: not supported
     88        PIO: pio0
     89}}}
     90
     91
     92== Permanent Workarounds ==
     93
     94
     95
     96== Short-term Workarounds ==
     97