User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 1:58 pm

After playing around with different USB 3.0 external drive enclosures, for use with the Raspberry Pi, the first I tried to use had the issue of random disocnnects and read errors - this was related to UAS issues - use of the 'quirks' option in /boot/cmdline.txt sorted the issues 100% - reduced performance but still quick.

Reading that ASMedia controller based enclosures seemed to do quite well, I changed to this CSL USB 3.0 to M.2 NGFF external drive enclosure - it uses the ASM1153E controller chip and is UAS compatible with the RPi4B. I loaded it with a spare M.2 256GB drive made by Micron, it was left over from a laptop hard drive upgrade a couple of years ago, but they're now cheaply and readily available on eBay (approx £30) or there's many a bargain M.2 NGFF high capacity drive if you so desire.

With it being UAS compatible, the transfer sppeds are pretty good :D

  • Sequential write speed 329326 KB/sec
  • Random write speed 17084 IOPS
  • Random read speed 15738 IOPS
All in all, this setup results in a very nice low power desktop replacement system with great responses and ample quick storage 8-)

USB 3.0 to M.2 NGFF enclosure pictured below, it costs £14.85 ( https://www.amazon.co.uk/CSL-Enclosure- ... 567&sr=8-1 )
CSL M.2 Enclosure.png
CSL USB 3.0 to M.2 NGFF external drive enclosure.
CSL M.2 Enclosure.png (199.9 KiB) Viewed 4867 times
Micron 1100-2.png
Micron 256GB M.2 NGFF hard drive.
Micron 1100-2.png (107.66 KiB) Viewed 4867 times

'dmesg' output related to the CSL enclosure and drive: -

Code: Select all

[    1.311286] usb 2-2: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[    1.332205] usb 2-2: New USB device found, idVendor=174c, idProduct=55aa, bcdDevice= 1.00
[    1.333362] usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[    1.334474] usb 2-2: Product: USB3.0 External M.2 SSD
[    1.335660] usb 2-2: Manufacturer: ASMedia
[    1.336826] usb 2-2: SerialNumber: 2016050000B9
[    1.345575] scsi host0: uas
[    1.347557] scsi 0:0:0:0: Direct-Access     Micron 1 100 SATA 256GB   0    PQ: 0 ANSI: 6
[    1.349602] sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
[    1.350753] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    1.352105] sd 0:0:0:0: [sda] Write Protect is off
[    1.353319] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[    1.353511] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.355276] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

ejolson
Posts: 8631
Joined: Tue Mar 18, 2014 11:47 am

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 2:53 pm

What program did you use to check the performance? Is the case plastic or made of aluminium? How hot does it get?

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 3:02 pm

ejolson wrote:
Sun Jun 14, 2020 2:53 pm
What program did you use to check the performance? Is the case plastic or made of aluminium? How hot does it get?
Hi, to check the performance I used the standard RPi diagnostic SDTest tool, as seen below, just tested again now: -

Code: Select all

pi@phoenix-pi-x64:~ $ sh /usr/share/agnostics/sdtest.sh
Run 1
prepare-file;0;0;327680;640
seq-write;0;0;330989;646
rand-4k-write;0;0;87732;21933
rand-4k-read;62894;15723;0;0
Sequential write speed 330989 KB/sec (target 10000) - PASS
Random write speed 21933 IOPS (target 500) - PASS
Random read speed 15723 IOPS (target 1500) - PASS
It's a metal case with plastic end caps and doesn't get too warm really, the USB3.0 cable is about 20/30cm long from memory, just not there at the moment but will check.
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

Kendek
Posts: 296
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 3:35 pm

Don't forget about the TRIM/UNMAP. The ASM1153E is capable, but you will probably need a firmware update. There are two compatible firmware; 140509_A1_82_40 and 141126_A1_EE_82. I'm using the first one with StarTech SATA to USB Cable.

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 5:14 pm

Kendek wrote:
Sun Jun 14, 2020 3:35 pm
Don't forget about the TRIM/UNMAP. The ASM1153E is capable, but you will probably need a firmware update. There are two compatible firmware; 140509_A1_82_40 and 141126_A1_EE_82. I'm using the first one with StarTech SATA to USB Cable.
Thanks for the info, I'll look into that - your 1st link (140509_A1_82_40) doesn't appear to work - I'll have a look on the CSL-Computer website, cheers
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

Kendek
Posts: 296
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 5:24 pm

CaptainMidnight wrote:
Sun Jun 14, 2020 5:14 pm
...
Thanks for the info, I'll look into that - your 1st link (140509_A1_82_40) doesn't appear to work.
It works for me, but you can download my update pack from Dropbox. :)

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 5:42 pm

Thanks, need to look into this.
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 7:56 pm

Hmm, from the looks of it my unit is running the other firmware
1153E Firmware.png
1153E Firmware.png (10.73 KiB) Viewed 4599 times
.... so I would assume I should potentially be looking at using 141126_A1_EE_82.bin

@Kendek
Q. When you flashed your firmware did it wipe the drive?
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 8:09 pm

Sorted, now on latest firmware ;)
1153E Updated Firmware.png
1153E Updated Firmware.png (10.85 KiB) Viewed 4589 times
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

Kendek
Posts: 296
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 8:10 pm

CaptainMidnight wrote:
Sun Jun 14, 2020 7:56 pm
@Kendek
Q. When you flashed your firmware did it wipe the drive?
No, it didn't. But it's not necessary to have a drive attached for firmware update.

Kendek
Posts: 296
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 8:16 pm

CaptainMidnight wrote:
Sun Jun 14, 2020 8:09 pm
Sorted, now on latest firmware ;)
Yeah, now you can test the UNMAP support.
/etc/udev/rules.d/01-unmap.rules

Code: Select all

ACTION=="add|change", ATTRS{idVendor}=="174c", ATTRS{idProduct}=="55aa", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 11:10 pm

Q. How would you go about testing this after creating the file and presumably a reboot?

Some version of fstrim maybe?
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Sun Jun 14, 2020 11:44 pm

.... with just a bit more tinkering: -

Code: Select all

pi@phoenix-pi-x64:~$sudo systemctl enable fstrim.timer
pi@phoenix-pi-x64:~$sudo systemctl start fstrim.timer    
pi@phoenix-pi-x64:~$sudo systemctl status fstrim.timer        
● fstrim.timer - Discard unused blocks once a week                
   Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
   Active: active (waiting) since Mon 2020-06-15 00:28:03 BST; 1min 3s ago          
   Trigger: Mon 2020-06-22 00:00:00 BST; 6 days left            
     Docs: man:fstrim
I presume all I can do now is wait and see if it works?

Edit: well actually maybe not: -

Code: Select all

pi@phoenix-pi-x64:~$ sudo fstrim -a -v                    
/boot: 197.7 MiB (207252480 bytes) trimmed on /dev/sda1
/: 89.3 MiB (93663232 bytes) trimmed on /dev/sda2
 
:D
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

Kendek
Posts: 296
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Mon Jun 15, 2020 6:08 am

CaptainMidnight wrote:
Sun Jun 14, 2020 11:10 pm
Q. How would you go about testing this after creating the file and presumably a reboot?

Some version of fstrim maybe?
Yeah, the fstrim is good, but you can check the actual result with the trim_test.sh script.

Test discard mount option:

Code: Select all

> sudo mount -o remount,discard /
> sudo ./trim_test.sh /
n
1
Test fstrim command:

Code: Select all

> sudo mount -o remount,nodiscard /
> sudo ./trim_test.sh /
y
1

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Mon Jun 15, 2020 8:49 am

Kendek wrote:
Mon Jun 15, 2020 6:08 am
Yeah, the fstrim is good, but you can check the actual result with the trim_test.sh script.

Test discard mount option:

Code: Select all

> sudo mount -o remount,discard /
> sudo ./trim_test.sh /
n
1
Test fstrim command:

Code: Select all

> sudo mount -o remount,nodiscard /
> sudo ./trim_test.sh /
y
1

After installing hdparm ;) and running through those procedures - full success, whoop whoop 8-)

Code: Select all

pi@phoenix-pi-x64:~ $ sudo mount -o remount,discard /
pi@phoenix-pi-x64:~ $ sudo ./trim_test.sh /
Use fstrim? [y/N]n
Choose a method:
[1] hdparm (will fail in LUKS on LVM)
[2] filefrag (warning: you may have to force quit - close the terminal - in some cases of success trim if you see an output that never ends)
Entrying /

Creating the file test-trim-by-desgua at /

10+0 records in
10+0 records out
5242880 bytes (5.2 MB, 5.0 MiB) copied, 0.138847 s, 37.8 MB/s
Syncing and sleeping 2 seconds.


test-trim-by-desgua:
 filesystem blocksize 4096, begins at LBA 532480; assuming 512 byte sectors.
 byte_offset  begin_LBA    end_LBA    sectors
           0    3350528    3360767      10240
As you can see, the file was created and its LBA begins at 3350528

Syncing and sleeping 2 seconds.

Removing file test-trim-by-desgua

Syncing and sleeping 2 seconds.

This is readed from sector 3350528: 

/dev/sda:
reading sector 3350528: succeeded
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
Success!!!



pi@phoenix-pi-x64:~ $ sudo mount -o remount,nodiscard /
pi@phoenix-pi-x64:~ $ sudo ./trim_test.sh /
Use fstrim? [y/N]y
Choose a method:
[1] hdparm (will fail in LUKS on LVM)
[2] filefrag (warning: you may have to force quit - close the terminal - in some cases of success trim if you see an output that never ends)
Entrying /

Creating the file test-trim-by-desgua at /

10+0 records in
10+0 records out
5242880 bytes (5.2 MB, 5.0 MiB) copied, 0.123137 s, 42.6 MB/s
Syncing and sleeping 2 seconds.


test-trim-by-desgua:
 filesystem blocksize 4096, begins at LBA 532480; assuming 512 byte sectors.
 byte_offset  begin_LBA    end_LBA    sectors
           0    3350528    3360767      10240
As you can see, the file was created and its LBA begins at 3350528

Syncing and sleeping 2 seconds.

Removing file test-trim-by-desgua

Syncing and sleeping 2 seconds.

fstrim / && sleep 2

This is readed from sector 3350528: 

/dev/sda:
reading sector 3350528: succeeded
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
Success!!!
pi@phoenix-pi-x64:~ $ 

Thank you very much for your help and patience, much appreciated !!
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

snahl
Posts: 3
Joined: Sun Mar 11, 2018 8:35 pm

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Tue Jan 12, 2021 4:15 pm

Kendek wrote:
Sun Jun 14, 2020 5:24 pm
CaptainMidnight wrote:
Sun Jun 14, 2020 5:14 pm
...
Thanks for the info, I'll look into that - your 1st link (140509_A1_82_40) doesn't appear to work.
It works for me, but you can download my update pack from Dropbox. :)
Link is dead
Would you mind to upload it again, please.

User avatar
CaptainMidnight
Posts: 267
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Tue Jan 12, 2021 7:20 pm

snahl wrote:
Tue Jan 12, 2021 4:15 pm
Kendek wrote:
Sun Jun 14, 2020 5:24 pm
CaptainMidnight wrote:
Sun Jun 14, 2020 5:14 pm
...
Thanks for the info, I'll look into that - your 1st link (140509_A1_82_40) doesn't appear to work.
It works for me, but you can download my update pack from Dropbox. :)
Link is dead
Would you mind to upload it again, please.

If you look back up to the previous post by Kendek link below, both links are working (the firmware, not upgrade pack)

https://www.raspberrypi.org/forums/vie ... 0#p1679047
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

Michel84
Posts: 1
Joined: Tue Feb 23, 2021 5:09 pm

Re: Raspberry Pi 4B UAS compatible external drive enclosure - system response and transfer speeds.

Tue Feb 23, 2021 5:18 pm

When you use an X829 shield, use the 140509_A1_82_40 firmware.

The Pi 4 won't boot when using the 141126_A1_EE_82 firmware in combination with external power for the shield.

Return to “General discussion”