[SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post Reply
domih
Posts: 285
Joined: Mon Feb 11, 2019 4:48 pm
languages_spoken: English, French
ODROIDs: UX4, HC2, N2, H2, C4, H2+
Location: San Francisco Bay Area
Has thanked: 92 times
Been thanked: 108 times
Contact:

[SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by domih »

On N2 running Ubuntu 18.04.4 LTS I have the USB disk driver set to UAS:

domih@n2a:~$ lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
|__ Port 4: Dev 3, If 0, Class=Mass Storage, Driver=uas, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M

On C4 running Ubuntu 20.04 LTS I get the USB disk driver set to usb-storage:

domih@c4a:~$ lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
|__ Port 3: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 3: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 3: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M

How do I set the USB disk driver set to uas on the C4?

I performed searches on the forums and the wiki but could not find the info. TIA!
Last edited by domih on Mon Jul 20, 2020 3:58 pm, edited 2 times in total.

misaz
Posts: 72
Joined: Sat Jul 27, 2019 3:58 am
languages_spoken: english, czech
ODROIDs: H2+
Has thanked: 7 times
Been thanked: 12 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by misaz »

Is it in both cases the same drive? Some drives do not support UAS.

fvolk
Posts: 456
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 42 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by fvolk »

This also depends on the kernel version. Certain USB enclosures are buggy and are/should be blocked for UAS for stability, so if for example a newer kernel blocks UAS for a specific model there may be a good reason for it...
I block uas via a long usb-storage.quirks=.... options line for all my Seagate Backup Plus externals.

domih
Posts: 285
Joined: Mon Feb 11, 2019 4:48 pm
languages_spoken: English, French
ODROIDs: UX4, HC2, N2, H2, C4, H2+
Location: San Francisco Bay Area
Has thanked: 92 times
Been thanked: 108 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by domih »

Different USB/SATA bridges. Different SSDs. Different OSes.

On the N2
152d:0578 JMicron Technology Corp. / JMicron USA Technology Corp. JMS578 SATA 6Gb / WD Blue 1TB / Ubuntu 18.04.4 LTS / 4.9.219-72 #1 SMP PREEMPT Mon Apr 13 13:55:42 -03 2020 aarch64

On the C4
174c:1351 ASMedia Technology Inc. / ASM1351 / Crucial CT1000MX 1TB (a.k.a. MX500) / Ubuntu 20.04 LTS / 4.9.218-25 #1 SMP PREEMPT Mon Jun 8 13:54:52 UTC 2020 aarch64

fvolk
Posts: 456
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 42 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by fvolk »

The ASM family seems to have some buggy members, maybe this disables uas also for your ASM1351?
https://git.kernel.org/pub/scm/linux/ke ... 19.132#n74
These users thanked the author fvolk for the post:
domih (Tue Jul 14, 2020 7:52 am)

domih
Posts: 285
Joined: Mon Feb 11, 2019 4:48 pm
languages_spoken: English, French
ODROIDs: UX4, HC2, N2, H2, C4, H2+
Location: San Francisco Bay Area
Has thanked: 92 times
Been thanked: 108 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by domih »

Mm... I guess I'm going to order more of these JMS578 from HK/Ameridroid because while running cassandra-stress testing on N2, C4 and Pi 4, the N2 passes flying colors while the C4 and Pi 4 both simply die in the middle of it (timeouts) and both are doing so with the ASM1351. In addition, although the errors are timeouts I know it goes deeper because the SSD then no longer behaves correctly: no longer mounts and even no longer appears in lsblk. I have to disconnect it and reconnect to get it back *&^%$#@!

fvolk
Posts: 456
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 42 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by fvolk »

That's curious, I've seen I/O timeouts happen with shingled harddisks when their fast cache is full and they desperately try to reorganize their data internally - almost all new 2.5" consumer drives are SMR today :-/
But SSDs shouldn't degrade that bad, there are also cheap ones with throughput problems - for example at work I have an OEM PC where the original internal NVME SSD is slower than a USB connected one - but a SSD should not degrade to slower than a harddisk?

domih
Posts: 285
Joined: Mon Feb 11, 2019 4:48 pm
languages_spoken: English, French
ODROIDs: UX4, HC2, N2, H2, C4, H2+
Location: San Francisco Bay Area
Has thanked: 92 times
Been thanked: 108 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by domih »

Sorry for the confusion, the timeout errors I was talking about are very high level DB errors inside Cassandra not low-level disk I/O errors. The USB disk going AWOL is just the cause at the bottom. I will retry testing on the C4 once I received the JMS578 from Ameridroid to see if I get a much more stable USB/SATAIII bridge and hopefully using UAS. Thanks for your input in the meantime.

fvolk
Posts: 456
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 42 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by fvolk »

I recently bought 3x USB HD cases at random from Amazon and they also behave... weird... Older cases from the same vendor bought years ago work fine. Sadly its impossible to know which current USB cases offered at Amazon are not cheap crap and hold up under load :-/

superpowter77
Posts: 197
Joined: Mon Sep 09, 2019 9:14 pm
languages_spoken: english,french,spanish
ODROIDs: Odroid-N2+ 4Gb,N2 4Gb(2),C4
Has thanked: 19 times
Been thanked: 9 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by superpowter77 »

ASM1153E widely available at amazon, works great without zero compatibility issues so far (supports UASP and Trim) on Rpi 4(64 bit Manjaro 20.06, 64bit Ubuntu-mate 20.04, 32 bit twisterOS 1.3 and Raspbian 32/64 bit and Odroid-N2 w/official Ubuntu 18.04.4

domih
Posts: 285
Joined: Mon Feb 11, 2019 4:48 pm
languages_spoken: English, French
ODROIDs: UX4, HC2, N2, H2, C4, H2+
Location: San Francisco Bay Area
Has thanked: 92 times
Been thanked: 108 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by domih »

I received the JMicron USB SATA bridge from Ameridroid and tried it on the C4: same issue, I get Driver=usb-storage instead of Driver=uas. I tried two SSD: a Crucial 1TB and a WD Blue 250GB. I then try it the JMicron + WD Blue on a PC and I get Driver=uas. As mentioned in the OP, I also get Driver=uas on an N2 with the JMicron + WD Blue.

Anybody has ideas on how to get uas active on the C4?

misaz
Posts: 72
Joined: Sat Jul 27, 2019 3:58 am
languages_spoken: english, czech
ODROIDs: H2+
Has thanked: 7 times
Been thanked: 12 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by misaz »

Check that your kernel was compiled with UAS enabled. If output is empty, then UAS support is not compiled into your kernel and you need to load (maybe also compile) it manually using modprobe command.

Code: Select all

cat /lib/modules/$(uname -r)/modules.builtin | grep uas
If you don't see uas module in output of previous command try to load it using following command

Code: Select all

modprobe uas
These users thanked the author misaz for the post:
domih (Fri Jul 17, 2020 4:41 am)

joshua.yang
Posts: 409
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 23 times
Been thanked: 89 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by joshua.yang »

Hi.

The USB-UAS feature is disabled by default for now. You can enable UAS by editing the kernel source.

Download our Linux kernel source, and move to "odroidg12-4.9.y" branch, and edit this line: https://github.com/hardkernel/linux/blo ... nfig#L4798

Code: Select all

CONFIG_USB_UAS=y
Then build, apply to your board: https://wiki.odroid.com/odroid-c4/softw ... ing_kernel

If an USB drive supports UAS mode, it will be enabled automatically.
These users thanked the author joshua.yang for the post:
domih (Fri Jul 17, 2020 4:41 am)

domih
Posts: 285
Joined: Mon Feb 11, 2019 4:48 pm
languages_spoken: English, French
ODROIDs: UX4, HC2, N2, H2, C4, H2+
Location: San Francisco Bay Area
Has thanked: 92 times
Been thanked: 108 times
Contact:

Re: Driver=usb-storage vs Driver=uas on C4

Post by domih »

@misaz @joshua

Thanks. Done. I see Driver=uas in lsusb -t now. I can now go back to testing.

domih
Posts: 285
Joined: Mon Feb 11, 2019 4:48 pm
languages_spoken: English, French
ODROIDs: UX4, HC2, N2, H2, C4, H2+
Location: San Francisco Bay Area
Has thanked: 92 times
Been thanked: 108 times
Contact:

Re: [SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by domih »

Tip
Once USB Attached SCSI (uas) is active in the kernel, a USB SSD might become "temperamental": dismounting and disappearing as soon as you ask it to do something.

Solution so far: it looks like a power through the USB port issue, the SSD behaves OK once you use a powered USB hub. The SSD is still accessed via UAS. The only difference is that the SSD is powered by the hub instead of the board. Tested on Pi 4, but I'm pretty sure it is the same story with the C4. Reason: the latter was able to run a Cassandra stress test without the USB hub but I had to reboot after copying the Cassandra application files before running the test because the SSD had "evaporated".

superpowter77
Posts: 197
Joined: Mon Sep 09, 2019 9:14 pm
languages_spoken: english,french,spanish
ODROIDs: Odroid-N2+ 4Gb,N2 4Gb(2),C4
Has thanked: 19 times
Been thanked: 9 times
Contact:

Re: [SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by superpowter77 »

domih wrote:
Mon Jul 20, 2020 4:08 pm
Tip
Once USB Attached SCSI (uas) is active in the kernel, a USB SSD might become "temperamental": dismounting and disappearing as soon as you ask it to do something.

Solution so far: it looks like a power through the USB port issue, the SSD behaves OK once you use a powered USB hub. The SSD is still accessed via UAS. The only difference is that the SSD is powered by the hub instead of the board. Tested on Pi 4, but I'm pretty sure it is the same story with the C4. Reason: the latter was able to run a Cassandra stress test without the USB hub but I had to reboot after copying the Cassandra application files before running the test because the SSD had "evaporated".
Can you run this from your C4 booting from SSD w/ UAS enabled and share results?
sudo dd if=/dev/sda of=/dev/null bs=16M count=256

fvolk
Posts: 456
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 42 times
Contact:

Re: [SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by fvolk »

Attaching a Samsung T5 1TB as /dev/sda on a C4, booted from microSD with tobetter's image (Ubuntu 5.7.11-202007300228~focal)

Code: Select all

$ lsusb -tv
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        ID 2109:0817 VIA Labs, Inc. 
        |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=uas, 5000M
            ID 04e8:61f5 Samsung Electronics Co., Ltd Portable SSD T5
Working it:

Code: Select all

$ hdparm -t /dev/sda
/dev/sda:
 Timing buffered disk reads: 1098 MB in  3.00 seconds = 365.85 MB/sec

$ dd if=/dev/sda of=/dev/null bs=16M count=256
256+0 records in
256+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 11.1521 s, 385 MB/s

/media/sda1/test $ dd if=/dev/zero of=foobar.xxx bs=1048756 count=20000
20000+0 records in
20000+0 records out
20975120000 bytes (21 GB, 20 GiB) copied, 77.7951 s, 270 MB/s

/media/sda1/test $ dd if=foobar.xxx of=/dev/null bs=1048576
20003+1 records in
20003+1 records out
20975120000 bytes (21 GB, 20 GiB) copied, 83.7209 s, 251 MB/s
Raw read is a bit slower than on a x86 PC, the T5 is capable of 4xx MB/s.
File read/write is even slower here because /sda1 is actually a LUKS encrypted partition, so this includes aes-xts en/decryption done by the C4 CPU.
...and that is impressive! The C4 crypto speed is way, WAY better than previous C2 or XU4. :-)

Code: Select all

$ cryptsetup benchmark |grep aes-xts
        aes-xts        256b       623.8 MiB/s       623.6 MiB/s
        aes-xts        512b       565.4 MiB/s       566.4 MiB/s
Stability? No problems observed.
We use Samsung T3 and T5 drives daily at work with PCs, for a long time now, the oldest drives have 1xxxx power on hours, and never had any problems with them.

superpowter77
Posts: 197
Joined: Mon Sep 09, 2019 9:14 pm
languages_spoken: english,french,spanish
ODROIDs: Odroid-N2+ 4Gb,N2 4Gb(2),C4
Has thanked: 19 times
Been thanked: 9 times
Contact:

Re: [SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by superpowter77 »

fvolk wrote:
Sun Aug 02, 2020 5:12 am
Attaching a Samsung T5 1TB as /dev/sda on a C4, booted from microSD with tobetter's image (Ubuntu 5.7.11-202007300228~focal)

Code: Select all

$ lsusb -tv
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        ID 2109:0817 VIA Labs, Inc. 
        |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=uas, 5000M
            ID 04e8:61f5 Samsung Electronics Co., Ltd Portable SSD T5
Working it:

Code: Select all

$ hdparm -t /dev/sda
/dev/sda:
 Timing buffered disk reads: 1098 MB in  3.00 seconds = 365.85 MB/sec

$ dd if=/dev/sda of=/dev/null bs=16M count=256
256+0 records in
256+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 11.1521 s, 385 MB/s

/media/sda1/test $ dd if=/dev/zero of=foobar.xxx bs=1048756 count=20000
20000+0 records in
20000+0 records out
20975120000 bytes (21 GB, 20 GiB) copied, 77.7951 s, 270 MB/s

/media/sda1/test $ dd if=foobar.xxx of=/dev/null bs=1048576
20003+1 records in
20003+1 records out
20975120000 bytes (21 GB, 20 GiB) copied, 83.7209 s, 251 MB/s
Raw read is a bit slower than on a x86 PC, the T5 is capable of 4xx MB/s.
File read/write is even slower here because /sda1 is actually a LUKS encrypted partition, so this includes aes-xts en/decryption done by the C4 CPU.
...and that is impressive! The C4 crypto speed is way, WAY better than previous C2 or XU4. :-)

Code: Select all

$ cryptsetup benchmark |grep aes-xts
        aes-xts        256b       623.8 MiB/s       623.6 MiB/s
        aes-xts        512b       565.4 MiB/s       566.4 MiB/s
Stability? No problems observed.
We use Samsung T3 and T5 drives daily at work with PCs, for a long time now, the oldest drives have 1xxxx power on hours, and never had any problems with them.
When I boot on C4 from uSD and plug my T5 500Gb or 1Tb, it does detect my T5 with UAS capability. If I boot from USB3 SSD, it does Not and performance get severely affected regarding reading and writing speeds. Barely gets 180 MB/sec, almost eMMC speeds. It does exactly the same with N2/N2Plus.
I tested with official 20.04 w/ 4.9 kernel and 20.04 /gnome/wayland w 5.7 w/ 5.7.0-odroid-arm64. Did you build a kernel to support UAS?

fvolk
Posts: 456
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 42 times
Contact:

Re: [SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by fvolk »

superpowter77 wrote:
Sun Aug 02, 2020 11:49 am
Did you build a kernel to support UAS?
I tried with tobetter's image, upgraded to lastest available packages viewtopic.php?f=202&t=38557

superpowter77
Posts: 197
Joined: Mon Sep 09, 2019 9:14 pm
languages_spoken: english,french,spanish
ODROIDs: Odroid-N2+ 4Gb,N2 4Gb(2),C4
Has thanked: 19 times
Been thanked: 9 times
Contact:

Re: [SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by superpowter77 »

fvolk wrote:
Sun Aug 02, 2020 3:23 pm
superpowter77 wrote:
Sun Aug 02, 2020 11:49 am
Did you build a kernel to support UAS?
I tried with tobetter's image, upgraded to lastest available packages viewtopic.php?f=202&t=38557
You haven't answered my question. Please do it so. Did you boot from your Samsung T5 on C4 w/ latest petiboot image? or you just boot from uSD and then run benchmarks on T5?

fvolk
Posts: 456
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 42 times
Contact:

Re: [SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by fvolk »

superpowter77 wrote:
Mon Aug 03, 2020 6:28 am
You haven't answered my question. Please do it so. Did you boot from your Samsung T5 on C4 w/ latest petiboot image? or you just boot from uSD and then run benchmarks on T5?
You originally asked:
superpowter77 wrote:
Sat Aug 01, 2020 10:01 am
Can you run this from your C4 booting from SSD w/ UAS enabled and share results?
I answered:
fvolk wrote:
Sun Aug 02, 2020 5:12 am
Attaching a Samsung T5 1TB as /dev/sda on a C4, booted from microSD with tobetter's image (Ubuntu 5.7.11-202007300228~focal)
I did not mention Petitboot, but used tobetter's image as it is intended, to be flashed to and run from microSD.

Reading it again, I think both your question and my answer can be confusing. Your question did not specifically point to Petitboot and my answer could be confusing due to the comma in the sentence. So yeah, someone should try Petitboot AND the rest of the system on a T5.

superpowter77
Posts: 197
Joined: Mon Sep 09, 2019 9:14 pm
languages_spoken: english,french,spanish
ODROIDs: Odroid-N2+ 4Gb,N2 4Gb(2),C4
Has thanked: 19 times
Been thanked: 9 times
Contact:

Re: [SOLVED+TIP] Driver=usb-storage vs Driver=uas on C4

Post by superpowter77 »

fvolk wrote:
Tue Aug 04, 2020 4:48 am
superpowter77 wrote:
Mon Aug 03, 2020 6:28 am
You haven't answered my question. Please do it so. Did you boot from your Samsung T5 on C4 w/ latest petiboot image? or you just boot from uSD and then run benchmarks on T5?
You originally asked:
superpowter77 wrote:
Sat Aug 01, 2020 10:01 am
Can you run this from your C4 booting from SSD w/ UAS enabled and share results?
I answered:
fvolk wrote:
Sun Aug 02, 2020 5:12 am
Attaching a Samsung T5 1TB as /dev/sda on a C4, booted from microSD with tobetter's image (Ubuntu 5.7.11-202007300228~focal)
I did not mention Petitboot, but used tobetter's image as it is intended, to be flashed to and run from microSD.

Reading it again, I think both your question and my answer can be confusing. Your question did not specifically point to Petitboot and my answer could be confusing due to the comma in the sentence. So yeah, someone should try Petitboot AND the rest of the system on a T5.
Semantics!. Got you. Thank you for clarifying my concern.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest