How to disable USB Attached Storage (UAS)

From Leo's Notes
Last edited on 4 December 2022, at 14:00.

USB Attached Storage (UAS) is now commonly found for USB 3.0 storage devices. However, this sometimes causes issues with non-compliant adapters requiring it to be disabled. Issues with having UAS enabled include slow write performance, or having the device randomly drop off until the USB connection is reset. More on the issues below.

Finding the USB device ID[edit | edit source]

To disable UAS for a specific USB device, find the USB device associated with the drive. This can be accomplished by either reviewing the dmesg kernel logs or using lsusb. For example, this Seagate expansion drive has the device ID 0bc2:3343:

# lsusb
Bus 004 Device 002: ID 0bc2:3343 Seagate RSS LLC Desktop

Disabling UAS[edit | edit source]

After knowing the device ID, there are three ways to disable UAS. In all three ways, the idea is to pass in a quirk parameter to the usb_storage kernel module, telling the module to not use UAS for a specific device. This is done by passing in the USB device ID followed by the u flag.. Other flags that you can use can be found by looking at the kernel source code at https://github.com/torvalds/linux/blob/master/drivers/usb/storage/usb.c#L568.

Manually reload the kernel module (temporary)[edit | edit source]

A temporary solution: Temporarily reload the usb-storage kernel module with the quirks.

Unload the usb-storage kernel module and re-load it with a quirk parameter specifying which device to not enable UAS on.

# lsusb
Bus 002 Device 005: ID 0bc2:3343 Seagate RSS LLC

# rmmod usb-storage
# modprobe usb-storage quirks=0bc2:3343:u

Re-attach the USB device again. This time, dmesg should say that a quirk was detected for this device:

[947347.271519] usb 2-3.2: New USB device found, idVendor=0bc2, idProduct=3343, bcdDevice= 1.00
[947955.635329] usb-storage 2-3.2:1.0: Quirks match for vid 0bc2 pid 3343: 800000

Disable permanently with modprobe.d[edit | edit source]

Create a new file in /etc/modprobe.d/disable-uas.conf with the following contents:

options usb-storage quirks=0bc2:3322:u

Then, rebuild initrd so that the kernel loads the usb-storage module with this option during boot.

# update-initramfs -u

Reboot the machine. When the kernel module is loaded again, it should be aware of the quirk. If this isn't taking effect, try the cmdline argument option below.

Disable permanently with kernel cmdline arguments[edit | edit source]

Change your bootloader so that the quirk values are passed to the kernel.

For CentOS/Fedora/Red Hat based systems, edit /etc/default/grub and add the following to GRUB_CMDLINE_LINUX:

usb-storage.quirks=0bc2:3322:u

Rebuild the grub configs with grub2-mkconfig -o /boot/grub2/grub.cfg and reboot.

On other systems such as Linux on a Raspberry Pi, edit /boot/cmdline.txt and append usb-storage.quirks=XX:YY:u.

Why would you want to disable UAS?[edit | edit source]

When a USB device isn't working properly with UAS enabled, you will most likely see the following symptoms:

  • Slow transfer speeds, sometimes even stalling
  • S.M.A.R.T. information not available (e.g. in smartctl or smartd to monitor a system's disk automatically).
  • Kernel messages are full of errors similar to the ones listed below. However, the drive is still healthy.
  • Error messages from uas_eh_abort_handler.
sd 0:0:0:0: [sda] tag#27 uas_eh_abort_handler 0 uas-tag 19 inflight: CMD IN
sd 0:0:0:0: [sda] tag#27 CDB: opcode=0x28 28 00 02 c2 cc 50 00 01 00 00
sd 0:0:0:0: [sda] tag#26 uas_eh_abort_handler 0 uas-tag 7 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#26 CDB: opcode=0x2a 2a 00 02 60 59 b0 00 00 80 00
sd 0:0:0:0: [sda] tag#25 uas_eh_abort_handler 0 uas-tag 16 inflight: CMD IN
sd 0:0:0:0: [sda] tag#25 CDB: opcode=0x28 28 00 02 82 aa a8 00 03 28 00
sd 0:0:0:0: [sda] tag#24 uas_eh_abort_handler 0 uas-tag 11 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#24 CDB: opcode=0x2a 2a 00 02 64 48 d0 00 00 08 00
sd 0:0:0:0: [sda] tag#23 uas_eh_abort_handler 0 uas-tag 15 inflight: CMD IN
sd 0:0:0:0: [sda] tag#23 CDB: opcode=0x28 28 00 02 82 a6 a8 00 04 00 00
sd 0:0:0:0: [sda] tag#22 uas_eh_abort_handler 0 uas-tag 14 inflight: CMD IN
sd 0:0:0:0: [sda] tag#22 CDB: opcode=0x28 28 00 02 82 b9 d0 00 04 00 00
sd 0:0:0:0: [sda] tag#21 uas_eh_abort_handler 0 uas-tag 13 inflight: CMD IN
sd 0:0:0:0: [sda] tag#21 CDB: opcode=0x28 28 00 02 82 b5 d0 00 04 00 00
sd 0:0:0:0: [sda] tag#20 uas_eh_abort_handler 0 uas-tag 5 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#20 CDB: opcode=0x2a 2a 00 02 a1 16 78 00 00 20 00
sd 0:0:0:0: [sda] tag#19 uas_eh_abort_handler 0 uas-tag 12 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#19 CDB: opcode=0x2a 2a 00 02 64 42 48 00 04 00 00
sd 0:0:0:0: [sda] tag#18 uas_eh_abort_handler 0 uas-tag 10 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#18 CDB: opcode=0x2a 2a 00 02 64 3e 90 00 03 b8 00
sd 0:0:0:0: [sda] tag#17 uas_eh_abort_handler 0 uas-tag 9 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#17 CDB: opcode=0x2a 2a 00 02 64 3a 90 00 04 00 00
sd 0:0:0:0: [sda] tag#16 uas_eh_abort_handler 0 uas-tag 2 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#16 CDB: opcode=0x2a 2a 00 02 64 46 48 00 02 88 00
sd 0:0:0:0: [sda] tag#15 uas_eh_abort_handler 0 uas-tag 4 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#15 CDB: opcode=0x2a 2a 00 02 84 83 68 00 00 38 00
sd 0:0:0:0: [sda] tag#14 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#14 CDB: opcode=0x2a 2a 00 02 64 16 08 00 00 40 00
sd 0:0:0:0: [sda] tag#13 uas_eh_abort_handler 0 uas-tag 18 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#13 CDB: opcode=0x2a 2a 00 01 26 e3 00 00 01 18 00
sd 0:0:0:0: [sda] tag#12 uas_eh_abort_handler 0 uas-tag 6 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#12 CDB: opcode=0x2a 2a 00 01 26 e0 70 00 00 60 00
sd 0:0:0:0: [sda] tag#7 uas_eh_abort_handler 0 uas-tag 3 inflight: CMD IN
sd 0:0:0:0: [sda] tag#7 CDB: opcode=0x28 28 00 02 82 ad d0 00 04 00 00
sd 0:0:0:0: [sda] tag#4 uas_eh_abort_handler 0 uas-tag 17 inflight: CMD IN
sd 0:0:0:0: [sda] tag#4 CDB: opcode=0x28 28 00 02 82 b1 d0 00 04 00 00
sd 0:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 8 inflight: CMD OUT
sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 02 64 36 d0 00 01 40 00
scsi host0: uas_eh_device_reset_handler start
usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
scsi host0: uas_eh_device_reset_handler success