Hi there! I'm new to the forum and I would like to ask you about USB 3.0 support for plugging external HDDs on openwrt router since I have found no results for my issue.
I have a linksys wrt3200acm router with openWRT 18.06, which I use plugged to my seagate external HDD (STEB8000100) which I use over samba.
The HDD is working fine and I can copy my files just fine over the net (lan cable), but I see a 22MBps limitation (it should be around 100MBps for a HDD, using this HDD directly to my PC gives me that speed)
I see in my dmesg this warnings:
[ 1.840111] usb 3-1: new SuperSpeed USB device number 2 using xhci-hcd
[ 1.870744] usb 3-1: USB controller f10f8000.usb3 does not support streams, which are required by the UAS driver.
[ 1.881058] usb 3-1: Please try an other USB controller if you wish to use UAS.
[ 1.888399] usb-storage 3-1:1.0: USB Mass Storage device detected
[ 1.894595] scsi host2: usb-storage 3-1:1.0
[ 2.871673] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[ 2.879309] Freeing unused kernel memory: 1024K
[ 2.950468] scsi 2:0:0:0: Direct-Access Seagate Expansion Desk 9401 PQ: 0 ANSI: 6
[ 2.958996] sd 2:0:0:0: [sda] Very big device. Trying to use READ CAPACITY(16).
[ 2.966605] sd 2:0:0:0: [sda] 15628053167 512-byte logical blocks: (8.00 TB/7.28 TiB)
[ 2.974553] sd 2:0:0:0: [sda] 4096-byte physical blocks
[ 2.980119] sd 2:0:0:0: [sda] Write Protect is off
Is it possible that I am missing something for UAS support to use my HDD at full speed?
You'll find your answer in this last link in step 8:
To install support for UASP aka USB Attached SCSI (supported by many USB drives and drive enclosures, especially if USB 3.0. It enhances performance if it's supported by both the drive and the host controller in your device):
Yup, I read that before posting here but unfortunately installing kmod-usb-storage-uas did not solve the issue, I also tried the other recommendations of this post, but with no luck either
Well, I tested with another USB 3.0 HDD (WD My Passport - WDBMWV0020BRD-NESN) and result was the same (testing method was to plug the HDD and copy a 4GB ISO to it):
On PC: 100-110MBps
On WRT3200acm: 20-22MBps
In openwrt logs are different comparing with previous seagate tests, but they are quite similar to PC logs:
openwrt:
[ 1426.396390] usb 3-1: new SuperSpeed USB device number 3 using xhci-hcd
[ 1426.427313] usb-storage 3-1:1.0: USB Mass Storage device detected
[ 1426.433561] scsi host2: usb-storage 3-1:1.0
[ 1427.507009] scsi 2:0:0:0: Direct-Access WD My Passport 0741 1022 PQ: 0 ANSI: 6
[ 1427.515584] scsi 2:0:0:1: Enclosure WD SES Device 1022 PQ: 0 ANSI: 6
[ 1427.524905] sd 2:0:0:0: [sda] Spinning up disk...
[ 1428.547146] .
[ 1429.587530] .
[ 1430.627913] .
[ 1431.668297] .
[ 1432.708673] .
[ 1432.710414] ready
[ 1432.714047] sd 2:0:0:0: [sda] 3906963456 512-byte logical blocks: (2.00 TB/1.82 TiB)
[ 1432.722105] sd 2:0:0:0: [sda] Write Protect is off
[ 1432.726918] sd 2:0:0:0: [sda] Mode Sense: 47 00 10 08
[ 1432.727138] sd 2:0:0:0: [sda] No Caching mode page found
[ 1432.732483] sd 2:0:0:0: [sda] Assuming drive cache: write through
[ 1432.752256] sda: sda1
[ 1432.755564] sd 2:0:0:0: [sda] Attached SCSI disk
PC (debian):
[ 115.765532] usb 2-7: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[ 115.786215] usb 2-7: New USB device found, idVendor=1058, idProduct=0741, bcdDevice=10.22
[ 115.786221] usb 2-7: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[ 115.786225] usb 2-7: Product: My Passport 0741
[ 115.786229] usb 2-7: Manufacturer: Western Digital
[ 115.786232] usb 2-7: SerialNumber: #test
[ 115.803061] usb-storage 2-7:1.0: USB Mass Storage device detected
[ 115.803197] scsi host6: usb-storage 2-7:1.0
[ 115.803258] usbcore: registered new interface driver usb-storage
[ 115.804656] usbcore: registered new interface driver uas
[ 116.810083] scsi 6:0:0:0: Direct-Access WD My Passport 0741 1022 PQ: 0 ANSI: 6
[ 116.810406] scsi 6:0:0:1: Enclosure WD SES Device 1022 PQ: 0 ANSI: 6
[ 116.811598] sd 6:0:0:0: Attached scsi generic sg1 type 0
[ 116.812069] scsi 6:0:0:1: Attached scsi generic sg2 type 13
[ 116.812835] sd 6:0:0:0: [sdb] Spinning up disk...
[ 117.833279] .
[ 121.354247] scsi 6:0:0:1: Wrong diagnostic page; asked for 1 got 8
[ 121.354257] scsi 6:0:0:1: Failed to get diagnostic page 0x1
[ 121.354265] scsi 6:0:0:1: Failed to bind enclosure -19
[ 121.354303] ses 6:0:0:1: Attached Enclosure device
[ 121.360802] ready
[ 121.360934] sd 6:0:0:0: [sdb] 3906963456 512-byte logical blocks: (2.00 TB/1.82 TiB)
[ 121.361305] sd 6:0:0:0: [sdb] Write Protect is off
[ 121.361306] sd 6:0:0:0: [sdb] Mode Sense: 47 00 10 08
[ 121.361532] sd 6:0:0:0: [sdb] No Caching mode page found
[ 121.361535] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 121.370015] sdb: sdb1
[ 121.371505] sd 6:0:0:0: [sdb] Attached SCSI disk
P.D: As you said @mpratt14, kmod-scsi-core was already installed
P.D2: Here are logs of Seagate on debian PC, which also copies the test ISO at 100-110MBps
[ 625.883828] usb 2-7: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
[ 625.904653] usb 2-7: New USB device found, idVendor=0bc2, idProduct=3322, bcdDevice= 1.00
[ 625.904659] usb 2-7: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[ 625.904663] usb 2-7: Product: Expansion Desk
[ 625.904667] usb 2-7: Manufacturer: Seagate
[ 625.904670] usb 2-7: SerialNumber: #test
[ 625.908792] scsi host6: uas
[ 625.909510] scsi 6:0:0:0: Direct-Access Seagate Expansion Desk 9401 PQ: 0 ANSI: 6
[ 625.910433] sd 6:0:0:0: Attached scsi generic sg1 type 0
[ 625.910590] sd 6:0:0:0: [sdb] Spinning up disk...
[ 626.915772] .............ready
[ 639.204575] sd 6:0:0:0: [sdb] 15628053167 512-byte logical blocks: (8.00 TB/7.28 TiB)
[ 639.236115] sd 6:0:0:0: [sdb] Write Protect is off
[ 639.236121] sd 6:0:0:0: [sdb] Mode Sense: 4f 00 00 00
[ 639.236343] sd 6:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 639.325161] sdb: sdb1 sdb2 sdb3 sdb4
[ 639.326958] sd 6:0:0:0: [sdb] Attached SCSI disk
-Was that a "local" copy or a "remote" copy?
-What does usb-utils tell you?
-What is the story with the esata <> usb in the device page? ( rhetorical... just found the picture... doubt it's a prob )
-Have you verified uboot / boot params are not interfering?
1- Local copy: HDD plugged to USB3.0 port on my PC
Remote copy: HDD plugged to USB3.0 port on my wrt3200acm and accessing it via samba share from my PC which is connected with lan cable to the router
2- You mean "usbutils"? "usb-utils is not available to install on openwrt repo, if you mean "usbutils", then I suppose you may want to see "lsusb" output:
lsusb
Bus 003 Device 002: ID 0bc2:3322 Seagate RSS LLC SRD0NF2 [Expansion Desktop Drive]
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
3- The router has 2 ports, esata/usb (usb port 1) and usb3.0 (usb port 2, with traditional blue connector), I am plugging the HDD to usb port 2
4- No idea about uboot, what could I check? I am a bit lost with this point
As always triple check before enter with dd.... we all know what it stands for.....
Also.... The size of your disk ..... Not sure but the last few times I upgraded to the cutting edge it TB..... my PC had dramas let alone a router......
We need to confirm that it's all good regarding that too....
Just to make sure you are not barking up the wrong tree, I would mirror @anon50098793's suggestion: You should do a "proper" speed test on your disk, not going through samba and a network connection.
samba and other services will always be a bottleneck due to the CPU overhead on network connections. I have personally seen limitations like you describe (in the lower 20 MB/s), even on quite capable SoCs with a disk directly attached to SATA.
On the shell, cd to where you mounted your disk and do
# time dd if=/dev/zero of=tempfile bs=1M count=1024
This will write a 1 GB file to disk, divide 1024 by the resulting time in seconds and you got your MB/s for writing. After that you can test your read speed in a similar manner with
# time dd if=tempfile of=/dev/null bs=1M count=1024
(after that you can delete the tempfile file again). It might well very turn out that your USB connection is actually not the limiting factor.
root@OpenWrt:~# lsusb -t
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
|__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=orion-ehci/1p, 480M
You are totally right, it is an excellent approach, here are the measures:
root@OpenWrt:/mnt/sda4# time dd if=/dev/zero of=tempfile bs=1M count=1024
1024+0 records in
1024+0 records out
real 0m 26.26s
user 0m 0.00s
sys 0m 4.01s
root@OpenWrt:/mnt/sda4# time dd if=tempfile of=/dev/null bs=1M count=1024
1024+0 records in
1024+0 records out
real 0m 9.16s
user 0m 0.01s
sys 0m 1.15
So now it gets strange, because my calculator says 38.99MBps write speed and 111.79MBps read speed, why should be only the write speed lower?
It seems to be already added, here are the outputs:
root@OpenWrt:~# opkg install kmod-usb3
Package kmod-usb3 (4.14.95-1) installed in root is up to date.
root@OpenWrt:~# insmod xhci-hcd
Failed to find xhci-hcd. Maybe it is a built in module ?
root@OpenWrt:~# opkg install kmod-usb3
Package kmod-usb3 (4.14.95-1) installed in root is up to date.
root@OpenWrt:~# insmod xhci-hcd
Failed to find xhci-hcd. Maybe it is a built in module ?
With lsmod uas is listed:
uas 16384 0
I remember to install kmod-usb-storage, kmod-usb-storage-uas and kmod-usb3 I am not sure but maybe also usbutils, it does not work anyway
It seems that kernel is not loading the uas module right?
And it seems that it archieves 100+ MBps speeds on write and read on ntfs drives, so there is hope of hardware support, let's see if bug report hits the issue.