https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=245931
1. Finding the VID and PID of your USB SSD
Disconnect the USB SSD. In a terminal window, run the command sudo dmesg -C.
Now, plug in the SSD and run dmesg with no parameters.
You should get output that looks like this:
CODE: SELECT ALL
[ 4096.609817] usb 2-1: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
[ 4096.646369] usb 2-1: New USB device found, idVendor=2109, idProduct=0715, bcdDevice=a0.00
[ 4096.646385] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4096.646397] usb 2-1: Product: SABRENT
[ 4096.646409] usb 2-1: Manufacturer: SABRENT
[ 4096.646421] usb 2-1: SerialNumber: 000000123AD2
[ 4096.655154] scsi host0: uas
[ 4096.669178] scsi 0:0:0:0: Direct-Access SABRENT 2210 PQ: 0 ANSI: 6
[ 4096.670993] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 4096.673710] sd 0:0:0:0: [sda] 234441648 512-byte logical blocks: (120 GB/112 GiB)
The idVendor and idProduct are the two hexadecimal numbers you need to take a note of.
1a. Multiple SSDs
If you have multiple USB SSD devices plugged into a single Pi 4, then for each device experiencing issues repeat Step 1 above and make a note of each idVendor and idProduct pair.
2. Add the quirks to /boot/cmdline.txt
Run a text editor as root – sudo nano /boot/cmdline.txt from the console or sudo leafpad /boot/cmdline.txt from the desktop.
At the start of the line of parameters, add the text usb-storage.quirks=aaaa:bbbb:u where aaaa is the idVendor for your device and bbbb is the idProduct. So, with the device above the string will be usb-storage.quirks=2109:0715:u.
cmdline.png
cmdline.png (21.45 KiB) Viewed 46967 times
For multiple devices with different VID:PID pairs, expand the parameter with a comma between each vid:pid:u triplet like this: usb-storage.quirks=0123:4567:u,2109:0715:u.
Save the file and exit the editor.
3. Reboot.
4. Check that it worked
To check that the quirk has been applied successfully, run dmesg | grep usb-storage and check that the VID and PID is listed as having a quirk applied:
CODE: SELECT ALL
[ 2.495725] usb 2-1: UAS is blacklisted for this device, using usb-storage instead
[ 2.512739] usb 2-1: UAS is blacklisted for this device, using usb-storage instead
[ 2.531823] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 2.549642] usb-storage 2-1:1.0: Quirks match for vid 2109 pid 0715: 800000
[ 2.566177] scsi host0: usb-storage 2-1:1.0
Re: STICKY: If you have a Raspberry Pi 4 and are getting bad speeds transferring data to/from USB3.0 SSDs, read this
Post by harrytv » 25 Jan 2020 13:42
I had a lot of issues with stuttering video playback using Libreelec 9.2.0. Media files (mkv, h264) were located on a very fast 1TB SSD connected via a USB3.0 adapter. I finally hit this post and it helped tremendously. Here is what I did for completeness.
* I logged in as user `root` using Putty SSH from a Windows machine, using default password.
* Disconnected USB drive and ran (since this is libreelec no need for `sudo`)
CODE: SELECT ALL
dmesh -c
* Reconnected the USB drive and ran:
CODE: SELECT ALL
dmesh
[ 342.605668] usb 2-1: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
[ 342.626900] usb 2-1: New USB device found, idVendor=152d, idProduct=1561, bcd Device= 2.04
[ 342.626921] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 342.626938] usb 2-1: Product: SABRENT
[ 342.626953] usb 2-1: Manufacturer: SABRENT
[ 342.626968] usb 2-1: SerialNumber: DB9876543214E
[ 342.639515] scsi host0: uas
[ 342.640972] scsi 0:0:0:0: Direct-Access SABRENT 0204 PQ : 0 ANSI: 6
[ 345.935277] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/93 2 GiB)
[ 345.935286] sd 0:0:0:0: [sda] 4096-byte physical blocks
[ 345.935531] sd 0:0:0:0: [sda] Write Protect is off
[ 345.935538] sd 0:0:0:0: [sda] Mode Sense: 53 00 00 08
[ 345.936048] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, does n’t support DPO or FUA
[ 345.936856] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a mult iple of physical block size (4096 bytes)
[ 345.940078] sda: sda1
* As can be seen this is a USB3.0 SATA 3 adapter from Sabrent. Running in `uas` mode.
* To verify how poorly this was running I tested the speed using:
CODE: SELECT ALL
hdparm -t /dev/sda1
/dev/sda1:
Timing buffered disk reads: 516 MB in 33.25 seconds = 15.52 MB/sec
* Which of course is extremely slow. I then checked the log again using `dmesg`:
CODE: SELECT ALL
[ 1247.365069] usb 2-1: reset SuperSpeed Gen 1 USB device number 3 using xhci_hcd
[ 1247.387663] scsi host0: uas_eh_device_reset_handler success
[ 1279.648929] sd 0:0:0:0: [sda] tag#3 uas_eh_abort_handler 0 uas-tag 4 inflight: CMD IN
[ 1279.648937] sd 0:0:0:0: [sda] tag#3 CDB: opcode=0x28 28 00 03 fa 64 50 00 01 00 00
[ 1279.649085] sd 0:0:0:0: [sda] tag#1 uas_eh_abort_handler 0 uas-tag 2 inflight: CMD IN
[ 1279.649091] sd 0:0:0:0: [sda] tag#1 CDB: opcode=0x28 28 00 00 00 10 00 00 04 00 00
[ 1279.649553] sd 0:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
[ 1279.649559] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 00 0c 00 00 04 00 00
[ 1286.049165] sd 0:0:0:0: tag#4 uas_eh_abort_handler 0 uas-tag 5 inflight: CMD
[ 1286.049173] sd 0:0:0:0: tag#4 CDB: opcode=0x0 00 00 00 00 00 00
[ 1286.065838] scsi host0: uas_eh_device_reset_handler start
* Same issues as discussed in this post.
* Fixing this on libreelec was a bit different though, hence why I wrote this post.
* Navigate to root after logging in, ensure you can edit the `/flash/cmdline.txt` by remounting, then edit file.
CODE: SELECT ALL
cd ..
mount -o remount,rw /flash
nano /flash/cmdline.txt
* I simply adding the below to the beginning of the file and saved:
CODE: SELECT ALL
usb-storage.quirks=152d:1561:u
* And then rebooted:
CODE: SELECT ALL
reboot
* After rebooting I checked that the quirk was applied:
CODE: SELECT ALL
dmesg | grep usb-storage
[ 0.673330] usbcore: registered new interface driver usb-storage
[ 1.024033] usb 2-1: UAS is blacklisted for this device, using usb-storage in stead
[ 1.024147] usb 2-1: UAS is blacklisted for this device, using usb-storage in stead
[ 1.024163] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 1.024576] usb-storage 2-1:1.0: Quirks match for vid 152d pid 1561: 800000
[ 1.024726] scsi host0: usb-storage 2-1:1.0
* Which it was, and I then retested the performance:
CODE: SELECT ALL
LibreELEC:~ # hdparm -t /dev/sda1
/dev/sda1:
Timing buffered disk reads: 930 MB in 3.00 seconds = 309.71 MB/sec
* A 20x improvement and it runs so much better. So thank you for this sticky. 🙂