UASP makes Raspberry Pi 4 disk IO 50% faster
jeffgeerling.com
jeffgeerling.com
Wow, holy shit, TIL.. I was always assuming that USB drives were always SCSI — they show up as 'da' (Direct Attach) on FreeBSD after all.
Looking at umass driver source:
* The driver handles 3 Wire Protocols
* - Command/Bulk/Interrupt (CBI)
* - Command/Bulk/Interrupt with Command Completion Interrupt (CBI with CCI)
* - Mass Storage Bulk-Only (BBB) (BBB refers Bulk/Bulk/Bulk for Command/Data/Status phases)
* Over these wire protocols it handles the following command protocols
* - SCSI
* - UFI (floppy command set)
* - 8070i (ATAPI)
* UFI and 8070i (ATAPI) are transformed versions of the SCSI command set.
Huh, they are pretty much always SCSI, and "bulk only" is (unsurprisingly) only a USB transport level thing that doesn't change the command set.
I guess "UASP" is some sort of marketing term for Command/Bulk/Interrupt then..?
Sounds very cursed. I mean, I'm not a hardware vendor, I should not care, but licensing for something that's just another form of SCSI over USB sounds ridiculous.
This does put USB-drive in a better light for me. I might event buy UASP supported USB 3.1g2/3.2 SATA-controller and do some testing myself.
I usually try to reach for a bus-connected controller which usually mean thunderbolt today for external enclosures (expensive), but it would be nice to build a portable DAS-array that can be connected to any device with USB-C.
No no, even better! Peak power consumption is lower, but the same work is completed much more quickly due to increased throughput, so the energy required for the same work is decreased dramatically. Between the performance increase and the lower power usage I wouldn't be surprised if this reduces energy use by 50 %.
For something like the Pi this is unlikely, but in data centers with big, latency-insensitive distributed workloads "using memory for less time" can be a real win. (The battery example with the Pi really is the perfect example though, because you're usually interested in the time-integrated value more than the peak draw.)
Our desktop monoculture has led to serious security problems and massive stagnation at least until recently. Even if you don't use a Pi you should be thankful that they exist.
I’m surprised there’s no Raspberry Pi case with a slot for a 2.5” drive and integrated USB 3.0 SATA controller.
Nowadays I see a Pi as a kiosk style machine with extras. It is what it is. It is a fantastic jack of all trades. You get loads of GPIO of all sorts, bluetooth, wifi, ethernet, USB2 and 3, a quad core CPU and 2-8GB RAM. Two HDMI ports and a GPU. It's too much for jobs that you would deploy an ESP8266 or ESP32 and it's not enough for a full on desktop replacement.
I can't see a need for more than 16 or 32GB of storage on one of these things. If your use case needs greater storage then it probably needs more "box" or I simply lack imagination.
I have a C-64 under the telly in the sitting room (it has a QSII joystick and a USB interface). I have a ZX81 with 3" of rather stiff Blutac holding the 16Kb RAM expansion steady and a keyboard on a ribbon. Sometimes I go back to school and type in definitions for 8x8 blocks and make them run around the screen. I do not own a Sinclair C5, that would be silly.
Mess of cabling: lol!
I can't see a need for more than 16 or 32GB of storage
on one of these things. If your use case needs
greater storage then it probably needs more "box" or
I simply lack imagination.
Generally yeah. One possible (slightly contrived) exception that comes to mind could be using it as "dumb" volatile storage like Redis/memcached/etc.I say "dumb" because if you are leaning into any of Redis' more advanced stuff (sorted sets, pub/sub, whatever else they've thrown in lately) I suspect CPU would tend to become a bottleneck rather quickly once you've got > 8GB of data.
Suppose it was all for graphics. Scaling up for modern color depth and screen size, we should need about 400 MB for the Windows 95 level of efficiency, or about 64 MB for Mac level of efficiency. That's a huge overestimate because RAM is not all consumed by graphics.
In other words, modern software can't run a desktop properly without even 10 to 100 times as much RAM as it ought to need.
RAM consumption by Konsole, tmux, and Neovim (30+ loaded buffers) combined is negligible to say the least.
RAM consumption by my browser with 10+ windows and 100+ tabs loaded easily exceeds 4+ GB even when exclusively visiting supposedly "lightweight" text based sites (ie documentation).
Going beyond RAM, playing a video on YouTube occupies a small but noticeable fraction of total CPU time. A single script heavy ad laden site sometimes manages to occupy a problematically large fraction of all available cores. Depending on the site, Dark Reader might slow this all to a crawl for 10+ seconds as the bloated page gradually loads (I'm looking at you, Amazon).
The problem isn't modern desktop environments.
But still there may not be many such examples so your point is still valid.
I use a 3b+ for a 3d printer and that means, octoprint, klipper, octolapse, live streaming from a webcam while printing, a web server and web ui with various plugins, a slicer (I don't slice on the pi, but it's there and I could) and for all that the 3b+ is hardly scratched while running full out. It's a 4g model that is always using only couple hundred meg if you don't count disk cache. This is exactly consistent with your supposition.
https://psref.lenovo.com/syspool/Sys/PDF/ThinkCentre/ThinkCe...
When this will be available in Europe I’ll get that to replace my MacBook for a developer machine.
https://liliputing.com/2020/06/asus-pn50-is-a-mini-pc-with-u...
Noctua NH-L9A-AM4, 37mm Premium Low-profile CPU Cooler for AMD AM4 (Brown) £36.17 incl. VAT https://www.amazon.co.uk/Noctua-NH-L9A-AM4-Premium-Low-profi...
ASRock USB 2.0 Header to 2 x USB 2.0 Cable for DeskMini Series Chassis £10.93 Incl. VAT https://www.amazon.co.uk/ASRock-Cable-Deskmini-Mini-Stx-Chas...
AMD Ryzen 5 3400G Processor (4C/8T, 6MB cache, 4.2GHz Max Boost) with Radeon™ RX Vega 11 Graphics £139.99 incl. VAT https://www.amazon.co.uk/dp/B07SXNDKNM/?tag=pcp0f-21
Sabrent 1TB Rocket NVMe PCIe M.2 2280 Internal SSD High Performance Solid State Drive (SB-ROCKET-1TB) £109.99 incl. VAT https://www.amazon.co.uk/dp/B07LGF54XR/?tag=pcp0f-21&th=1
ASRock DeskMini A300 Mini PC Barebone for Socket AM4 £146.94 incl. VAT https://www.amazon.co.uk/dp/B07P9GL1LN/?tag=pcp0f-21
ASRock Wi-Fi Kit for DeskMini Series Chassis, includes 2 x Antennas £29.42 incl. VAT https://www.amazon.co.uk/ASRock-Wi-Fi-DeskMini-Chassis-Anten...
2 x ADATA AD4S2666316G19-S 16GB DDR4 2666 MHz Memory Module - Memory Modules (16GB, 1x 16GB, DDR4, 2666MHz, 260-pin SO-DIMM) 2 x £73.12 incl. VAT https://www.amazon.co.uk/ADATA-AD4S2666316G19-S-16GB-Memory-...
Price a few months ago - £619.68
Note that you don’t need the noctua fan but the provided fan that comes with the case is a bit whiny.
DeskMini A300's dimensions: 155 x 155 x 80 mm
From the specs: https://www.asrock.com/nettop/AMD/DeskMini%20A300%20Series/i...
I find them fine for light interactive use, and running network services for the home network. Also gradually moving my lab machines over to them.
None of this is particularly CPU intensive, but does benefit from being x86 compatible. Also having M2 NVME + 2xSata on-board is nice :-)
Even the Pi 3 was already good enough for most of those use cases. The main exception being browsing modern bloated websites.
"most office people, students, and so on" pretty much always do browse lots of modern websites, at the same time as running an office suite, audio player, and more stuff.
The A72 is really the "minimum viable CPU core" for desktop usage. Anything with less single-core performance is absolute hell and suffering.
I don't run a heavy weight desktop though.
The only noticeable thing is some increased latency (mainly due to storage speed limited to 20MiB/s read speeds), but animations and scrolling and basic stuff like that are pretty much smooth. I could easily run the system from USB attached SSD (which can achieve 15-20x the speeds of the SD card), and that would massively improve app startup speeds too.
Also video playback sucks, but that's mainly due to software support, not a hardware issue. It's a chip meant for TV boxes after all.
I wouldn't use it to compile programs, but office work? I can imagine that easily.
So, the most common use case for a desktop computer?
Both of these choices surprised me.
Makes sense though, for browsing performance.
- Needed to set up NTP to set the clock, it was always wrong.
- It can't power down through software, so you have to shut down and then hit the power switch like it's 1990.
- Audio was a mess and had to spend hours researching how to write and edit a bunch of config files to make it predictable.
- The weird set up program means you need to do a lot of googling on how to fix issues in a non-standard to linux way. It mostly works however.
- Raspbian feels not quite "finished." Was much happier with Ubuntu Mate, as they fixed 99% of the paper cuts like audio already, but it doesn't support the 4 yet.
In short, it is a bit too cheap. I would have definitely spent another dollar to see these hardware issues fixed. Or dropped the CPU speed a hundred MHZ, whatever it takes.
In the end, a friend gave us a ten-year-old used iMac for free. I installed Ubuntu Mate on it and it had none of the above problems. It's even a touch faster.
The Pi 4 has come a long way in speed since the lowly original Pi, but its still not even close to a 10 year old desktop PC (or iMac).
But I can say that working on the 2010 MBA is not fun; one of my webcams doesn’t even work with it (choppy at 30p), zoom is... slow at best, and web browsing is a bit choppy even with ad blockers. Even then, it is a smoother overall experience with that hardware and macOS than when I was testing 64-bit Pi OS on the 8 GB Pi 4 a few weeks ago: https://www.jeffgeerling.com/blog/2020/i-replaced-my-macbook...
Now Win 2k I might consider, however it is likely very insecure and newer apps don't support it.
been using it for photo sync only, works fine enough as long as youre not using the web interface
Or, for both CM and the full RPi, a docking header and a corresponding tiny module for a real-time clock module if not outright embed one. It's 2020 ffs.
I have a cheap Inateck dock which does support UASP (the FD2005). Two or three times I had a bunch of errors like these:
Sep 22 17:26:01 nuc kernel: sd 4:0:0:1: [sdb] tag#2 uas_eh_abort_handler 0 uas-tag 3 inflight: CMD OUT
Sep 22 17:26:01 nuc kernel: sd 4:0:0:1: [sdb] tag#2 CDB: Write(16) 8a 00 00 00 00 01 4d b4 c4 00 00 00 03 b0 00 00
...
Sep 22 17:26:22 nuc kernel: usb 2-3: stat urb: no pending cmd for uas-tag 2
...
Sep 22 17:26:22 nuc kernel: xhci_hcd 0000:00:14.0: ERROR Unknown event condition 34 for slot 3 ep 3 , HC probably busted
followed by filesystem corruption.I found other folks complaining about similar problems, eg: https://unix.stackexchange.com/questions/239782/connection-p...
Then I disabled UAS. Haven't had any corruption since. It's not absolute proof, but I believe the firmware and/or driver support for UAS with this dock is buggy, and the older protocol works fine. I like speed as much as the next person, but not if it means repeated filesystem corruption...
However, the article comparing to USB 1.1 is silly.
If you are on USB 2.0 (and I haven't bumped into anything mass storage in the last 10 years that isn't), the bulk endpoints are quite happy to take advantage of the USB 2.0 bulk packet size (512 bytes) and microframes (120us turnarounds) with 13 packets per microframe.
That's going to get you in the 400Mbps+(40Megabytes/sec) range without a lot of problem.
In UAS mode it would work for a couple of seconds and start to fail, dropping transfer speed to a couple of hundred kB/s
I looked it up because i know enough about hardware that this shouldn't be the case (even with a cheap SD Card). Seems it's a limitation of the Pi's SD Card slot. https://www.jeffgeerling.com/blog/2018/raspberry-pi-microsd-...
No it wasn't.
Even on my Mac (tested with 6 different readers, including one purporting A2 compatibility) the best microSD cards are abysmal for random access. But they do get closer to 90-120 MB/sec for reads, at least.
To get advertised speeds on most of the cards, I am guessing you need to work for the SD association's marketing department :D https://www.jeffgeerling.com/blog/2019/raspberry-pi-microsd-...
Note that there's all kinds of special, video camera-oriented things in the SD standard, where you can preallocate/pre-erase a big chunk to sequentially write, stream data in and do big commits. That's where you actually hit the rated speeds, because the flash controller is able to benefit from all the hinting.
Using SD with general purpose filesystem drivers, etc, is really just a very common edge case.
https://www.jeffgeerling.com/blog/2020/im-booting-my-raspber...
Now I see that someone linked another article inbetween, which you beat up for being on 3B+, but the conclusions remain largely the same when tested on the 4. And note that these tests were without UASP on the USB drive, so USB was handicapped.
Even basic photo import / adjustments were a pain with any of the applications I tested, and that was partly due to the Pi's slower GPU/CPU, the 64-bit ARM paucity of desktop apps, and the lack of good (read: like Adobe/Apple/pro-tier media apps) UI-based applications on Linux.
Most of the other issues (like window management and resolution problems) I ran into with the 'Pi for a Day' project I could probably resolve with a few more days' work.
Is it possible to run a Pi 4 using UASP if I set it up to boot from a decent (Sandisk/Samsung/etc) USB 3.1 pen drive?
Also, is this a reliable setup, or will the device be more stable if booted and run from a MicroSD?
S.M.A.R.T doesn't behave well with UASP, so not all Smartmontools's feature work[1]. Especially, LifeTime of the SSD don't and they are crucial. I had to resort to calculating remaining life of the SSD manually from the reported lifecycles and negating it with the manufacture's MTBF if they're reported.
I've faced this with devices from varying price range [USB 3.0/3.1] - MyDigitalSSD(OTG), Samsung T5, various ORICO USB SSD enclosures with Samsung EVO/Crucial SSDs on host systems of different architectures(x86/ARM).
How are you all monitoring the life of your USB SSD on UASP in Linux?
smartctl 6.6 on Ubuntu18.04 Jetson Nano (aarch64) gives Total_LBAs_Written for Samsung 840 Evo in ORICO USB 3.0 SSD enclosure (UASP) and Samsung T5 SSD USB 3.0 but failed to read S.M.A.R.T data properly for MyDigitalSSD(OTG) which is likely the fault of the controller in it.
So with Total_LBAs_Written we can find TBW (Total Bytes Written) and compare it with manufacturer's data[1].
[1]https://www.virten.net/2016/12/ssd-total-bytes-written-calcu...
smartctl -a -d sat /dev/sda
Newer versions of smartmontools shouldn't need it, only the older one that Raspberry PI OS has.
It's not a secret SD cards quickly fail.
I've not bought the RPi for that specific reason. Even if the RPi is 5 times slower, having reliable storage seems seems like a most important feature.
The reasoning behind the SD cards on the consumer pis is that they are quick to swap out, and don't have the problems that "bricking" the OS could get you into with booting from onboard storage. There is the possibility to use USB booting in the latest boards (certainly with the 3+ not sure about the status of the 4) which has a flag set in the onboard eeprom so you can use external SSDs/USB drives.
It is possible that even on-board flash memory could be corrupted by improper shutdown, and if that happened the entire pi would be useless, not just the SD card.
4974456832 bytes (5,0 GB, 4,6 GiB) copied, 25,4896 s, 195 MB/s
Using this controller and a Samsung EVO SSD drive, I'm really happy with the results: https://geekworm.com/collections/raspberry-pi/products/raspb...