Update July 13, 2024
SCSI - Small Computer System Interface.
To determine which protocol you are using, run the following command:
lsusb -t
To determine the read speed of the device, install hdparm and run the following command:
sudo hdparm -t --direct /dev/sda
USB-SSD enclosures use a bridge chip that converts between USB and the SSD. In the beginning, many of the bridge chips did a poor job of implementing the uas protocol. Linux referrs to these as "qirks", and for these, the Linux kernel provides the capibility to fail back to the usb-storage (BOT) protocol.
There appears to be only three simiconductor manufactures that make USB bridge chips: Realtek, JMicorn, and ASMedia. To the best of knownledge, chips from all three of these semiconductor manufactors have Linux "quirks". JMicron appears to have the worst reputationm and some of their chips are noted for running hot and use more current.
To impletment a uas quirk and the following to the begining of the /boot/firmware/"cmdline.txt file:
usb-storage.quirks=VID:PID:u
where VID is the vendor ID and PID the product ID.
To determine the VID and PID, run the following command:
lsusb
The problem with this, is that many of the blacklisted bridge chips have been or can be updated with firmware that meets the uas protocol specification. This is a moving target!
SSDs use non-volitale NAND memory cells. The cells are grouped in blocks. A single cell cannot be erased. The entire block has to be erased. In addition, the cells have a finite number of times they can be written to. SSDs have a garbage collectors, but they need help from the OS.
TRIM informs the SSD garbage collector which cells can be erase. The OS usually runs TRIM once a week. Without TRIM, the SSD has examine all of the cells in a block to determine where to write data. As the SSD gets full, this can considerably slow down the write process. TRIM is only availble for the uas protocol.
References:
I purchased the same Orico USB enclosure for a M.2 NVMe SSD as Chris Barnett (YouTube - ExplainingComputer) from Amazon.com for $17.99.
Orico | PWM2-G2 | USB-C to USB-C |
Orico | PWM2-G2A | USB C to USB-A |
Specifications:
I purchased the one with the USB-C to USB-C cable. To connect it to my Raspberry Pi 5B, I purchased a Electop Double Sided USB 3.1 Gen 2 Male to Female Adapter from Amazon.com for $7.99.
hdparm read benchmarks
hdparm -t --direct /dev/sda
NVMe | Physical | Memory | RPi-4 | RPi-5 | HP-G6 | HP-G6 | ||
---|---|---|---|---|---|---|---|---|
Model | Size | GB | Gen. | Lanes | MB/sec | MB/sec | USB-A | USB-C |
WD 740 | 2230 | 256 | 4 | 4 | 335 | 358 | 388 | 882 |
WD 570 | 2280 | 500 | 3 | 4 | 335 | 358 | 388 | 783 |
WD 520 | 2280 | 256 | 3 | 2 | 335 | 358 | 388 | 783 |
For the HP-G6, lsusb -t output was:
SATA is a serial computer bus interface that connects computers to mass storage devices such as hard drives, optical drives and solid-state drives (SSDs).
SATA was anounced in 2000. It succeeded the earlier Paralle ATA standard. It reduced the number of PATA conductors from 40 or 80 to just 7. The first SATA hard drives came out in 2003.
SATA was the first bus interface to be used with SSDs.
SATA has maximum raw speed of 6 Gbps.
Reference:
I experienced the same problems as others when attempting to boot from an external USB-NVMe SSD enclosure with a Pi 5 connected to a USB 3.0 port [1][2][3]. In addition, my Pi 5 would take almost 40 seconds to shut-down or reboot.
The same hardware appeared to works correctly when connected to a Pi 4, USB 3.0 port.
I spend days on this problem, before I realized that I had discovered the solution earlier and discarded it. To fix the problem, add the following to the beginning of /boot/firmware/cmdline.txt:
usb-storage.quirks=0bda:9210:u
where "0bda:9210" is the ID of my Orico enclosure.
This does change the protocol from uas to usb-storage; however, it is at USB 3 speed!!!
I discarded the solution earlier because I misread 5000M as 500M, and I did not re-run the hdparm speed test.
Important:
Not so Fast!
From what I read on the Internet, the uas protocol is much faster than the USB-storage protocol and more importantly for a boot drive, the USB-Storage protocol does not support TRIM. This eliminates the Orico PWM-G2 enclosure as a viable boot drive!
I am now back to where I started from!
Why does the Pi 4 support the uas protocol for my Orico enclosure (PWM2-G2) and the Pi 5 does not? Is this related to the fact that the Pi 4 uses a dedicated VLI VL805-06 chip for the USB HUB and the Pi 5 uses their in-house RP1 chip?
Afterwards, I found the folling in the Raspberry Pi Doumentation:
Hardware Complatibility - "Before booting from a USB mass storage device, verify that the device works correctly under Linux. Boot using an SD card and plug in the USB mass storage device. This should appear as a removable drive. This is especially important with USB SATA adapters, which may be supported by the bootloader in mass storage mode, but fail if Linux selects USB Attached SCSI-UAS mode" [3].
Athought this a USB-NVMe adapter (Realtek RTL9210), the Realtek RTL9120B is both a USB NVMe and SATA adapter.
The Orico adpter appears to work correct with the faster UAS protocol when not used as the boot drive.
An older that USB-NVMe adpater that uses the JMicron 583 chip, appears to work correctly with the Pi 5. However, I have not been able to get consistnt speed benchmarks with this adapter.
References:
Updating Realtek's firmware for the RTL9120 is not an easy or straight forward task. Whether you need to update the firmware depends on which version of the firmware your product has. Version V1.32.87.082923 addresses USB instability seen in some SSD models when used in conjunction with Linux-based PC. Versions before this, address problems with the Samsung 980 Pro, and the Western Digital SN550 NVMe.
First you should check you vendor's website to see if they provide software to update the firmware. If they do, I highly recommend using their software.
Unfortunately, Orico does not provide firmware updates for any of their USB to NMVe enclosures.
Other vendors such as "JEYI" and "Plugable" do provide firmware updates [3]. However, they may not be the latest updates.
You may be able to use another vendor's firmware updates to update your product. The source for firware that is most referenced for Realtek firmware updates is Station-Drivers.com . To me, it looks like all they did was collect the firware updates from other vendors such as JEYI and Plugable. Their website has 76 pages of user comments that explain the update procedure and many of the users have bricked their devices and asking for help.
One user states that the Orico products are actually mande by Unionsine [ [].
Be warned - There is no way to back up your current firmware and restore it. Proceed at your own risk.
All of the firmware updates require:
The best that I can determine, there are 3 parts to upgrading the firmware [ ]:
Configuration | RTL9210_BV_CG_Orico_0.cfg | |
Firmware Bin | User Space | UTNVMExxxx.bin |
Firmware GD (Golden) | Bootloader | UTGDFWxxxx.bin |
Although there may be some included default configuration files, in general, the configuration files are vendor specific. Therefore, it is highly recommended that you do a dump of your device information and save it so it can be converted to a cfg file.
The best I can determine, the software that allows you to dump your device information, "JEYI.exe", is for the RTL9210B series only. You can use this software to obtain a dump of a plain RTL9210 without the B, but that is all you should do with it. My understanding is that if you use the B series software to upgrade the firmware of a plain RTL9210, you will brick the device. Furthermore, using the "JEYI.exe" (which is for the "B" series) appears is the only way to determine whether you plain RTL9120 or an "A" or "B" series and what version of the firmware you currently have.
To convert your saved dump device information file to a configuration file:
There may be some guessing here. The referenced tool, UTHSB_MPool_Lite, is out of date and not included in any of the current software for updating the firmware.
There is absolutely nothing straight forward about any of this! It is no wonder that there are 76 pages, and many people have bricked their device. There is a way to unbrick your device, but you have short two pins together with the device powered. To get to this IC, I would probably have to cut plastic with a Dremel tool.
When I did a dump of my Orico PWM2-G2 device information, my firmware is version 1.32.901 which was built on 2022-12-07. After I realized the designation RTL9120(B) meant that "(B)" is optional, and that the firmware contains updates for both the RTL9210 and RTL9210B, I did find a newer version: 1.33.7.191023. Station-Drivers.com RTL9210(B) .It contained a default cfg file, and I just used it.
TRIM (trimming) minimizes the wear and tear of flash drives and improves its performance.
Not all Linux File Systems support TRIM [2]
Plugable makes a NVMe USB enclosure very simular to Orico's. According to Plugable's Knowledge Base [2], USB connected SSDs do not automatically have TRIM enabed, and require some manual configuration. For their USB enclosure, they recommend runing the following:
echo 'ACTION=="add|change", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="9210", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"' | sudo tee --append /etc/udev/rules.d/10-uas-discard.rules
Note that the Vendor ID, 0bda, and the Product ID 9210 are the same as the Orico Model No. PWM2-G2.
To determine if TRIM is supported run:
lsblk -D
If there are non-zero entries in the DISC-GRAN and DISC-MAX columns, TRIM and DISCARD are enabled [1].
I have a USB stick that came with a Samsung M.2 SSD upgrade. It uses the a JMicron 583 bridge chip. It runs hot. However, it appears to run flawlessly as the boot drive with Raspberry Pi 5. It is not as fast as the Realtek RTL9210: 360 MB/sec vs 325 MB/sec.
I have also had problems benchmarking using hdparm with this device. When I repeat the tests a number of times, I get two numbers and slower number is about one-half of the faster number. The faster number results when I repeat the test with a very short pause, the slower number is after about a 30 second pause.
I have not been able to find anything that states the Orico PWM2-G2 supports the the USB-PD specification. A dump of my Orico PWM2-G2 device information, has PD : n/a.
Since a NVMe SSD can draw considerable current, at the end of the /boot/firmware/condig.txt file, I added:
usb_max_current_enable=1
Before, my USC-C male to USB-A female adapter arrived, I tried using a previous purchased (Aug 1, 2022 for $15.10), 3 feet, Amazon Basics, USB-C to USB-A, 3 feet cable, USB 3.1 Gen 2, USB-IF Certified, tobasic Amazon Certified USB-C to USB-A cable 3.1 Gen 2 cable. . Initial I had problems with the cable not seating correctly and only communicating at the slower 37 Gbps speed. This was due to a bent pin inside the USB-A connector. I was able to straighten the pin, and now it is working a full speed.
I tried other uncertified cables, but I was unable to achieve anything higher than USB 2.0:
Cable | Length | Speed MB/sec |
---|---|---|
Orico USB-C with 10 Gbps Adapter | 9 | 358 |
Amazon Basic Certified 10Gbps | 36 | 360 |
Logitech Mouse Anywhere 3.0 | 36 | 37 |
Amazon USB-C with 10 Gbps Adapter | 38 | 37 |
Apple USB-C with 10 Gbps Adapter | 72 | 37 |
I also tested the enclosure with different NVMe SSD:
If you want comptibility exFAT is the way to go. Microsoft NTFS is a very complex file system with owner, groups and permission similar to Linux. The extended File Allocation Table (exFAX) was design for large thumb drives and it does not have the complexity that NTFS does.
I read on the Internet that some guy wanted to format the M.2 drive in his external Orico M.2 encloser with Microsoft NTFS so that it would be compatible with Microsoft Windows, MacOS (Apple) and Linux. I thought the guy new what he was talking about, and I went down the rabbit hole.
The BIG Problem seems to be with Linux's ability to read and write to a NTFS drive (Microsoft's New Technologic File System) and not the Orico enclosure or its bridge converter, the Realtek RTL9120). The Linux Kernel only recently included the ability to read and write to NTFS drives [9] [10 ].
Currently my Raspberry Pi 5B cannot read an NTFS drive that was formatted on a Windows PC. Just plugging one in via the Orico PWM2-G2 encloser will cause numerous problems: the system will not shutdown, the system will not reboot, and if you boot with it plugged in, you might not be able to login via a Bluetooth keyboard and your Bluetooth mouse may freeze.
Similar things happen if you NTFS format the drive with the Raspberry Pi and Gparted software and plug the Orico enclosure in a Windows PC.
The best tool to undo the NTFS formatting is Microsoft's Disk Management: Hit Widows Button + x, then from the drop-down menu select Disk Management. Click on the drive and remove the volume. You can then plug the drive into a Raspberry Pi and use Gparted to format the drive.
This problem is not unique to NVMe SSD's; thumb drives have the exact same problem.