Upgrade Raspberry Pi 4 with a NVMe boot drive
alexellisuk.medium.com
alexellisuk.medium.com
I should probably dedicate a post and video to NVMe support, but basically you get double the random IO numbers if using NVMe vs NVMe-via-USB3. You can't boot off internal NVMe though, at least not natively with no microSD card or eMMC volume.
Not if Javascript is disabled. No need for cookies either.
Alternatively, blocking cdn.client.medium.com where the Javascript is sourced in Developer Tools or via ad blocker, /etc/hosts, DNS, etc. will work, too.
Good to know but the default experience matters. I have a beef here and I want the author to know that they need to switch blog host if they want their articles to be out on the open web and not behind logins or whatever.
I also think the "default experience" matters in terms of web browsers. Why do they all default to Javascript and cookies enabled. In this case, and there are hundreds of thousands of others, neither was technically necessary to read the blog.
Quick fix: remove the <noscript> tags
curl https://alexellisuk.medium.com/upgrade-your-raspberry-pi-4-with-a-nvme-boot-drive-d9ab4e8aa3c2 |sed 's/<noscript>//g;s/<.noscript>//g' > 1.htm
firefox ./1.htm
Note you can still zoom on these images. Right-click and open the image in a new tab, then zoom. Or you can open the larger versions in a browser tab and then zoom. The full URLs for all different-sized copies of images can be seen with view source.And incognito browser will get you to read the post for free, but I won't get any royalties as the author, if that's what you want.
I honestly don't understand why developers have such a problem valuing their time and the time of others.
Is this going to be any better than using an SSD with UAS which is what I'm doing already? (https://rwmj.wordpress.com/2020/09/24/raspberry-pi-4-running...)
There's two modest perks to NVMe over SATA. First, the drives tend to be faster. For large reads/writes, this probably wont help, as you'll be bus limited to USB3 speeds. But for smaller reads & writes, the NVMe drive can maybe probably do more iops, and you may see wins & better latency on workloads. NVMe also has a bunch of under the hood improvements. There's a quite in depth comparison of the two[1]. Larger queues, multiple queues, less round trips to issue commands, better completion model. I am very much unsure of how many of these advantages are exposed & would carry over when the host-to-device connection is still UAS based, which is what adapters like the one in this article still feature, same as if it were SATA. But some of these wins will help latency & iops again vs a SATA drive.
[1] https://sata-io.org/system/files/member-downloads/NVMe%20and...
It's a straightforward technology to implement and I believe it is now royalty free. The only implementations are Intel's though and I'm sure they're expensive.
Expansion is a complicated business model. Apple doesn't even ship headphone ports. The AirPods are smash hit, not least because when you sell a $1,100 device a $100 accessory suddenly seems really well priced. PCs are similarly pretty high ticket items, that market supports a situation where spending $100 on custom internal PSU cabling is not that bad.
The Raspberry Pi is tough. Accessories cost more than 2x the device. It's a model that doesn't really make sense. You could say that people are buying these accessories, but really its greatest limiting factor is that it's too cheap, it's hard to psychologically deliver on the big ticket item + accessories shopping cart for it.
Current Intel host-adapters seem to be ~$10 for the dual-port chip itself[1] (JHL8540). Not sure how much else it adds to the bill-of-material beyond a regular USB port! Adding it direct to the CPU would be a wonderful way to save space, & significantly reduce how hard it is to implement, since one would no longer need to route USB and PCIe and power to this extra chip.
I wouldn't expect Thunderbolt support on the low end for a long time. But I really do think it's really time that cpu makers begin offering it onboard. They already need to start moving towards USB4. Adding PCIe as well would be a courtesy, & a big enabler, for their customers. Hopefully we see these great awesome futures begin arriving in a more well-distributed manner.
[1] https://www.mouser.com/new/intel/intel-8000-thunderbolt-4-co...
First, both are SSDs, so I don't know what he is trying to compare. Both use M.2, but different keys from the sounds of it (the "notches").
M.2 drives can be either SATA or NVME, but it is harder to come across a SATA M.2 drive than an NVME drive these days, so I'm having trouble seeing the point.
Though for the Pi a SATA SSD would be fast enough.
[0] https://miro.medium.com/max/1400/1*xcGnOTsPvZtPdGSj8yODiA.pn...
But the keys for the different type of M.2 slots are not large enough on M.2 SATA vs M.2 SSD to prevent them from mixing up. It's easy to force, and forcing it will be fatal for the device.
I know this from an expensive lesson I learned, long ago :(
A M.2 SATA SSD will fit into any socket designed for M.2 SATA or M.2 PCIe SSDs, without damage. A M.2 PCIe SSD that only uses two PCIe lanes will fit into any socket designed for M.2 SATA or M.2 PCIe SSDs, without damage.
The only way to run into trouble is to force a M.2 PCIe SSD keyed for four lanes of PCIe into a M.2 socket keyed for SATA only with no PCIe lanes. Forcing this requires you to install the drive upside down and overcome the 0.5mm misalignment of the 1.2mm wide notch in the drive (meant to be filled by a 1.1mm key in the slot).
If you merely install a SATA SSD in a slot only wired for PCIe, or a PCIe x2 SSD into a slot only wired for SATA, the drive will fail to work but nothing will be damaged.
(You could theoretically also end up in trouble by forcing a SATA or PCIe x2 M.2 SSD into an appropriate slot, but upside down. However, this requires considerably more stupidity on the part of the user because in this scenario the SSD has two notches in the connector, so it is fairly obvious that any mechanical difficulty with installation could be due to having the card upside down. When installing a drive with only one notch, it's less obvious that the difficulty arises from a fundamental and intentional incompatibility.)
The Pi4 compute unit has a PCIe x1 slot, I think, and that could better put an NVME drive to use. But at that cost, for the drive and Pi, I don't see it being widely used outside of hobby or home use.
I'm excited about this and how the official Pi4 firmware now supports USB boot. Maybe if you used the Pi to run a NAS and wanted the NVME drive as accelerated cache (it can do H.265, 4kp60 decode, and H.264)?
But can a Pi even process an NVME drives bandwidth via it's CPU/etc or Gigabit Ethernet/USB 3.0/GPIO add on?
Edit: This guide is basically 1. Put SSD in adapter and 2. Set up USB boot then clone SD card to SSD. How is this article not just a forum post like the dozens of others that provide the same information and process?
There are now lots of low-end M.2 NVMe SSDs on the market, and M.2 SATA SSDs are becoming uncommon. So there's no price remaining price advantage for M.2 SATA over M.2 NVMe—certainly not 40%—and it is not uncommon to find M.2 NVMe sale prices that are better than any M.2 SATA SSD price, since the more popular NVMe SSDs get better and more frequent discounts than the niche M.2 SATA SSDs.
And the M.2 SSDs on the market with the lowest absolute cost (rather than per GB) are usually the Intel Optane Memory 16GB NVMe SSDs that were intended for use as cache devices, but have enough capacity for lots of embedded Linux use cases while also outperforming SATA SSDs of any capacity.
I see the USB3 result for the "M.2 SSD" (I assume the author means SATA?) being ~30/MB but almost surely something is going wrong there. That is not a normal result for any mid-to-high level SATA SSD. Plenty of SATA M.2 SSDs can easily hit the same speeds the NVME drive is hitting (specifically when on USB3). NVME might give you some additional random r/w performance, however.
It seems like overkill to use NVME on USB 3.0 when SATA can saturate that bus just as easily. SATA M.2 drives will also run cooler. Some NVME USB controllers are notoriously hot-running
Though maybe I'm wrong and/or potentially this differs on a per-drive/per-controller basis.
On a performance per Watt basis, most M.2 NVMe SSDs are much more efficient than M.2 SATA SSDs. The most efficient M.2 NVMe SSDs are also at least competitive with M.2 SATA SSDs in terms of absolute power consumption, despite outperforming the SATA SSDs by at least a factor of 2-3x. Power consumption from a M.2 NVMe SSD will also drop slightly when only one or two of its four PCIe lanes are used, which is the case when the drive is behind a USB to NVMe bridge.
For example, comparing a SK hynix NVMe drive against of dozens of other M.2 NVMe and 2.5" SATA drives: https://images.anandtech.com/doci/16012/rr-all.png Unfortunately, I don't think there are any M.2 SATA results in there, and those are often a little bit more efficient than their 2.5" counterparts (running off 3.3V rather than 5V, but stepping it down to at least one or two lower voltages on the drive in either case).
https://www.siliconhighwaydirect.co.uk/product-p/945-82771-0...
High performance ARM with m.2 PCI, not sure, but guessing if it's around it probably isn't cheap
Separately, (random top Google result cutpaste):
Architectural-level power optimization can target different system
components such as CPU, caches, main memory,and buses [5, 6, 22, 4]. Power
spent in off-chip buses can be a significant portion of the overall power
budget. As an example, the core power consumption of Intel Celeron at
266MHz is 16W, while its off-chip bus (for a standard configuration)
operating at 133 MHz consumes 3.3W [12, 13]. The contribution of off-chip
bus power consumption to the overall power budget increases even more for
embedded systems with low-power processor cores and memories, making
off-chip buses a potential candidate for power optimization. Figure
1 shows the power consumption due to off-chip data bus for several embedded
benchmark codes as a percentage of the overall power consumption (which
includes processor data path, caches, buses, TLB, register file,
instruction issue logic, clock, and off-chip memory) for an
embedded processor. From this figure, we see that the off-chip data bus
consumes between 9.8% and 23.2% of the total power consumed by the system
depending on the benchmark being run. So, reducing the power consumption
of the off-chip data bus would reduce the overall power consumption of
the system to a considerable extentIf you can settle for 4GB, there's tye Rock Pi 4 which has a variant with on-board eMMC or an m.2 slot.
M.2 PCIe x4, 4GB LPDDR3 (a bit old perhaps).
https://www.friendlyarm.com/index.php?route=product/product&...
The new pi compute module has an 8gb model with a pci-express slot that can take nvme: https://www.raspberrypi.org/products/compute-module-4-io-boa...
Comparison of "Model B" single-board computers: https://docs.google.com/spreadsheets/d/1jWMaK-26EEAKMhmp6SLh...
... should be "64MB to 16MB".
USB connectors suck balls, one bump or connector dangling over the edge of your desk that gets hit by a hip and you have a device reenumeration, no idea what havoc that would have on the kernel that's running off it.
USB is evil. Never use it for anything mission critical.
It’s fun to think about the horrors which might result with similar mistreatment of old school external SCSI hardware. USB is fine; use quality cables and don’t run your computer in a disco if you can help it.
I often have to design 3D printed housing to go around the USB plug housing to hold and lock the plug snugly in place, because the designers of both the USB ports and plugs are incompetent at designing something industrial grade that locks down firmly.
SCSI cables were fine, their ports were secured to the housing and they had nice screw locks so the cables wouldn't go anywhere. Any cantilever forces were absorbed by metal casing, not PCB. Super reliable.
I don't want to defend USB too heavily (as you say, it is certainly not "industrial grade," but I don't know what the equivalent of something simple and very strong like a Hubbell twist-lock connector would be in data transfer terms, and that's something to contemplate) but this really shouldn't happen with any halfway decent cables or hardware. It doesn't apply to the Raspberry Pi 4 in my experience, or any of my laptops or PCs. Phones and micro-USB are, of course, a special case and uniquely horrible.
> SCSI cables were fine
Except when they weren't, and then you'd have to spend fifty bucks (whatever that equals in 2020 dollars) to test and see if the cable was what was failing you, or the termination, or the jumper settings...
Well, the best brand cables jiggle around. I'm talking Pi's, Macbooks, Pixel phones, you name it, they all jiggle around.
I've had RealSense cameras, StarTech USB hubs fail because of cable jiggling around in the port, and had to make 3D printed add-ons to grip the housing and prevent cable jiggling.
I've personally had WAY more problems with USB that SCSI cables, honestly. Also I break an average of about 1 USB cable a week; SCSI, DB25, DB9, DB15, BNC, and those cables never break.
I think the only cable type that was entirely trouble-free for me over the years was the parallel printer cable with the truly awful Centronics connector. I don't remember ever throwing one of those away. Of course, that's not a cable that you'd plug and unplug much, which certainly helps.
Eg: I convert some RTSP stream from a pi zero to HLS on a pi4 by ffmpegging the RTSP stream to HLS files in the RAM disk. I use bindfs to make this mountpoint available as a www-data folder in /home/pi/ssd/web/hls (which is actually on an USB plugged SSD) for HTML viewing in the browser. Motion triggers events, those events can be recorded from the RTSP stream or the ramdisk (holding HLS files) to the attached SSD. The HLS conversion adds a 30 second buffer so any triggers on the RTSP stream has an hls capture starting 30 seconds before the event and the SD card is never touched and I could use a spinning disk, it wouldn't be a bottleneck (but I am somehow more confident the SSD will be more stable power wise).
I have a Raspberry Pi and I use an SD card because what I’m using it for doesn’t require anything more. If you need fast storage I believe you should buy an appropriate device and maybe petition the Foundation to add it in a future model.
Right tool for the job and all that.
I'm quite curious as to how this is "cringe"worthy. I can certainly see how mechanically stable attached storage is preferable in a lot of situations, but people use Pi's for a vast array of uses, and I cannot imagine that every use case, or even a significant majority of them should be barred from USB attached storage.
One of the leading reasons for using USB attached storage on the Pi is to avoid SD card corruption issues.
Measured the resistance of the "USB charging cable" I had used for it and found it was 1 Ohm! So when the Pi peaked at 1A current draw, the cable dropped 1V.
Swapped it out for something proper (<0.1 Ohm), and haven't had issues since.
In the end I gave up on trying to find low-ohm cables and just wired directly to the power supply. It's surprising how many cables just plain suck.
With an SSD you are increasing power consumption on USB which is limited to around 1.2A or however much power supply allows.
Note: I havent had any corruptions past year on pi3... all I changed was power supply, sd card and using aarch64
I've been wanting to build a 4-bay SBC NAS for years now, but I haven't been able to bring myself to trust the community and support for some of the other boards that do give you direct access to the PCIe bus so you can actually get decent performance.
Now I'm waiting for someone to come up with something based on the Compute Module 4... (There was a post about someone designing a PCB for something that would do the trick the other day, but it requires some 0.4mm pitch soldering skills that I just don't have the equipment for.)
>"...If you need fast storage I believe you should buy an appropriate device"
Frankly you can cringe all you want but it is really up to the owner to decide how they use their hardware. Your opinion about it is irrelevant as people have their unique situation and are quite capable to weigh all pros and cons of whatever they decide to do.
Also, plugging in the NVME over USB3 makes them show up as /dev/sdx devices (not /dev/nvme0x)? Is USB3 still allowing a PCI bus lane connection? I thought you needed a thunderbolt connect for that.
Of course eventually the logs will eat everything to you have to write back to USB or SD from time to time.
The best drive shown is a Crucial MX500, using 2.32 watts during cpy and 0.52 watts at on-idle.
There will be some additional power consumption from the usb adapter too but i'd expect no more than 0.2 watts.
[1] https://www.tomshardware.com/reviews/wd-blue-sn550-m2-nvme-s...