Debian + USB3 HDD + UAS:I/O 错误

Debian + USB3 HDD + UAS:I/O 错误

我正在运行 rsync 将远程计算机备份到 ARM SBC 上的 USB 硬盘驱动器,有时 rsync 只是因“从输入设备读取错误(I/O 错误)”而停止。我相信这个问题与 UAS + USB 3.0 + rsync 导致高 I/O 负载有关,uas_eh_device_reset_handler因为/var/log/messages

sd 0:0:0:0: [sda] tag#1 data cmplt err -32 uas-tag 2 inflight: 
sd 0:0:0:0: [sda] tag#1 CDB: opcode=0x28 28 00 38 80 0a 68 00 00 a0 00
sd 0:0:0:0: [sda] tag#0 data cmplt err -32 uas-tag 1 inflight: CMD 
sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 57 50 28 78 00 03 00 00
sd 0:0:0:0: [sda] tag#1 uas_eh_abort_handler 0 uas-tag 2 inflight: CMD 
sd 0:0:0:0: [sda] tag#1 CDB: opcode=0x28 28 00 38 80 0a 68 00 00 a0 00
sd 0:0:0:0: [sda] tag#2 uas_eh_abort_handler 0 uas-tag 3 inflight: CMD 
sd 0:0:0:0: [sda] tag#2 CDB: opcode=0x2a 2a 00 19 47 7f 20 00 00 90 00
sd 0:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD 
sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 57 50 28 78 00 03 00 00
scsi host0: uas_eh_device_reset_handler start
usb 5-1: reset high-speed USB device number 2 using ehci-platform
scsi host0: uas_eh_device_reset_handler success
sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08
sd 0:0:0:0: [sda] tag#0 Sense Key : 0x2 [current] 
sd 0:0:0:0: [sda] tag#0 ASC=0x3a ASCQ=0x0 
sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 57 50 28 78 00 03 00 00
sd 0:0:0:0: [sda] tag#1 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08
sd 0:0:0:0: [sda] tag#1 Sense Key : 0x2 [current] 
sd 0:0:0:0: [sda] tag#1 ASC=0x3a ASCQ=0x0 
sd 0:0:0:0: [sda] tag#1 CDB: opcode=0x2a 2a 00 19 47 7f 20 00 00 90 00
EXT4-fs warning (device sda1): ext4_end_bio:323: I/O error 10 writing to inode 13001563 (offset 0 size 73728 starting block 53014518)

该 SBC 没有 USB 3 端口,但它仍然使用 UAS 加载硬盘。根据这个,UAS在某些高清外壳芯片上被破坏。这提供的解决方案是禁用 UAS,然而:

1-如果我将无人机完全列入黑名单进入我得到blacklist uas/etc/modprobe.d/blacklist-uas.conf

lsusb -t
    /:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
        |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=, 480M

查看Class=Mass Storage, Driver=, 480M=> 似乎系统没有加载任何其他方式来处理驱动器。

2-如果我只是尝试禁用特定 USB 设备的 UAS,就像帖子推荐的那样,仍然装载无人机:

echo options usb-storage quirks=174c:55aa:u | tee /etc/modprobe.d/blacklist-uas.conf
update-initramfs -u
reboot

(...)

dmesg | grep sda
[    2.488105] sd 0:0:0:0: [sda] 2930277168 512-byte logical blocks: (1.50 TB/1.36 TiB)
[    2.488584] sd 0:0:0:0: [sda] Write Protect is off
[    2.488592] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[    2.489335] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.539288]  sda: sda1
[    2.543875] sd 0:0:0:0: [sda] Attached SCSI disk
[    6.898109] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: errors=remount-ro,data=ordered

lsusb | grep ASMedia
Bus 005 Device 002: ID 174c:55aa ASMedia Technology Inc. ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge

lsusb -t
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 480M

我究竟做错了什么?是否可以通过其他方式禁用 UAS 并让系统仍然使用 HD?为什么options usb-storage quirks=174c:55aa:u不按应有的方式禁用无人机系统?

谢谢。

一些笔记:

  • 4.14.18-sunxi64操作系统:来自armbian的Debian GNU/Linux 9.4(延伸)内核
  • 单板计算机:NanoPi NEO2

答案1

在@AB 的宝贵帮助下,我成功解决了这个问题。正如他所说,我的内核(可能是每个 armbian SBC 内核)没有usb_storage作为模块加载,它是内置的。

在这种情况下,我们需要更改以下可见的启动选项/proc/cmdline

root=UUID=b58.... rootfstype=ext4 console=tty1 console=ttyS0,115200 panic=10 consoleblank=0 loglevel=1 ubootpart=096d26e5-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=memory swapaccount=1

最后已经usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u设置好了。我们不能直接编辑这个文件,在阿姆比亚语中此选项存储在文件中/boot/armbianEnv.txt

verbosity=1
console=both
overlay_prefix=sun50i-h5
overlays=usbhost1 usbhost2
rootdev=UUID=b58048d3-ca7b-4ea6-9812-95d403fddadd
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

所以我只是在最后一行添加了我的设备,174c:55aa:u,使其:

usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u,174c:55aa:u

以防万一我重新运行update-initramfs -u并重新启动后,USB HD 现在仅使用usb-store而不是uas

lsusb -t
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M

正如您在此处看到的,uas现在已正确列入该设备的黑名单:

dmesg | grep "usb 5-1"
[    2.308569] usb 5-1: new high-speed USB device number 2 using ehci-platform
[    2.467087] usb 5-1: New USB device found, idVendor=174c, idProduct=55aa
[    2.467106] usb 5-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[    2.467117] usb 5-1: Product: ASM1153E
[    2.467127] usb 5-1: Manufacturer: Inateck
[    2.467137] usb 5-1: SerialNumber: 12345678910E
[    2.468297] usb 5-1: UAS is blacklisted for this device, using usb-storage instead

答案2

我在 Debian 9 上遇到了类似的问题,我的答案非常相似,但不完全相同:

(作为根:)

    echo "options usb-storage quirks=4971:8017:u" >> /etc/modprobe.d/usb-storage-quirks.conf
    update-initramfs -u

4971:8017 设备 ID 是基于“SimpleTech”的 Rosewill RX307-PU3-35B USB-3 磁盘盒,宣传为支持 UASB。至少对于某些驱动器,它必须经常重置,从而在系统日志中生成许多警报消息,如下所示:

Nov 16 13:12:10 guy kernel: [226970.895835] sd 8:0:0:0: [sda] tag#8 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
Nov 16 13:12:10 guy kernel: [226970.895840] sd 8:0:0:0: [sda] tag#8 CDB: ATA command pass through(16) 85 08 0e 00 d0 00 01 00 00 00 4f 00 c2 00 b0 00
Nov 16 13:12:10 guy kernel: [226970.919935] scsi host8: uas_eh_device_reset_handler start
Nov 16 13:12:10 guy smartd[1079]: Device: /dev/sda [SAT], failed to read SMART Attribute Data
Nov 16 13:12:10 guy kernel: [226971.217025] scsi host8: uas_eh_device_reset_handler success
Nov 16 13:13:11 guy kernel: [227032.337409] sd 8:0:0:0: [sda] tag#8 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
Nov 16 13:13:11 guy kernel: [227032.337412] sd 8:0:0:0: [sda] tag#8 CDB: ATA command pass through(16) 85 08 0e 00 d5 00 01 00 06 00 4f 00 c2 00 b0 00
Nov 16 13:13:11 guy kernel: [227032.361403] scsi host8: uas_eh_device_reset_handler start
Nov 16 13:13:12 guy smartd[1079]: Device: /dev/sda [SAT], Read SMART Self Test Log Failed
Nov 16 13:13:12 guy kernel: [227032.654494] scsi host8: uas_eh_device_reset_handler success

奇怪的是,至少对于批量数据传输来说,它现在看起来实际上比使用 UAS 驱动程序更快!

答案3

就我而言,IO 问题是由我的计算机到 USB SATA3 适配器的供电不足引起的。日志消息看起来与此处相同。

调整 uas 参数没有帮助。购买有源 USB3 HUB 确实解决了这个问题。

相关内容