I have 2 USB drives connected to NanoPi M4. I want to build a software RAID1.

Everything is OK with one drive, but with 2 drives I get I/O errors, causing the RAID to fail.

Issue:

Code: Select all

sudo dd if=/dev/sda of=/dev/null bs=1M

works fine.

but simultaneaous execution of

Code: Select all

sudo dd if=/dev/sda of=/dev/null bs=1M

and

Code: Select all

sudo dd if=/dev/sdb of=/dev/null bs=1M


fails with I/O errors:

Code: Select all

917+1 records in
917+1 records out
961814528 bytes (962 MB, 917 MiB) copied, 46.0609 s, 20.9 MB/s
dd: error reading '/dev/sdb': Input/output error
16+1 records in
16+1 records out
16916480 bytes (17 MB, 16 MiB) copied, 42.1819 s, 401 kB/s


dmesg output:

Code: Select all

[39994.307714] xhci-hcd xhci-hcd.11.auto: xHCI host not responding to stop endpoint command.
[39994.307753] xhci-hcd xhci-hcd.11.auto: Assuming host is dying, halting host.
[39994.307795] xhci-hcd xhci-hcd.11.auto: xHCI host not responding to stop endpoint command.
[39994.307818] xhci-hcd xhci-hcd.11.auto: Assuming host is dying, halting host.
[39994.321380] xhci-hcd xhci-hcd.11.auto: HC died; cleaning up
[39994.321394] xhci-hcd xhci-hcd.11.auto: HC died; cleaning up
[39994.321805] usb 3-1: USB disconnect, device number 2
[39994.325693] usb 4-1: USB disconnect, device number 2
[39994.325727] usb 4-1.3: USB disconnect, device number 3
[39994.328518] sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=0x00
[39994.328540] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 1c aa 10 00 00 f0 00
[39994.328549] blk_update_request: I/O error, dev sda, sector 1878544
[39994.329205] sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=0x00
[39994.329217] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 1c ab 00 00 00 10 00
[39994.329224] blk_update_request: I/O error, dev sda, sector 1878784
[39994.353659] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[39994.353688] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 81 10 00 00 f0 00
[39994.353699] blk_update_request: I/O error, dev sdb, sector 33040
[39994.384563] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[39994.384587] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 82 00 00 00 10 00
[39994.384596] blk_update_request: I/O error, dev sdb, sector 33280
[39994.419685] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[39994.419709] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 82 10 00 00 f0 00
[39994.419717] blk_update_request: I/O error, dev sdb, sector 33296
[39994.450536] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[39994.450560] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 83 00 00 00 10 00
[39994.450569] blk_update_request: I/O error, dev sdb, sector 33536
[39994.483637] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[39994.483676] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 81 10 00 00 08 00
[39994.483686] blk_update_request: I/O error, dev sdb, sector 33040
[39994.484227] Buffer I/O error on dev sdb, logical block 4130, async page read
[39994.514684] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[39994.514706] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 81 10 00 00 08 00
[39994.514714] blk_update_request: I/O error, dev sdb, sector 33040
[39994.515252] Buffer I/O error on dev sdb, logical block 4130, async page read
[39997.212657] usb 4-1.4: USB disconnect, device number 4


After this both /dev/sda and /dev/sdb have dissapeared from the device list.

race condition in USB driver?