As we all know by now, the Raspberry Pi 5 brings a major performance boost over the previous generation of Raspberry Pi devices. The reliance on MicroSD cards for storage, however, has been ridden with issues such as speed and integrity. By leveraging an NVMe SSD with an expansion HAT, we can dramatically improve the speed, reliability, and longevity of our storage. In this article, we're going to walk through setting up NVMe storage on the Raspberry Pi 5, ensuring a seamless and optimized experience.
While MicroSD cards are compact and widely used for Raspberry Pi storage, they're slower and don't last as long. NVMe drives offer super fast read/write speeds (up to 7,000 MB/s - though the Raspberry Pi 5 is limited to PCIe Gen 3 x1, capping speeds at around 985 MB/s), making boot times and data-intensive tasks significantly faster.
Beyond speed and reliability, NVMe SSDs offer greater consistency under heavy workloads. Unlike MicroSD cards, which degrade quickly with repeated writes, NVMe drives are designed for sustained performance. This makes them ideal for applications such as running databases, media servers, and AI workloads on the Raspberry Pi 5, where stable and high-speed storage is absolutely crucial.
Before setting up NVMe storage on the Raspberry Pi 5, start with an existing MicroSD card running the latest Raspberry Pi OS. If you need guidance on setting up the Raspberry Pi 5, refer to the tutorial below.
Next, ensure your Raspberry Pi has the latest bootloader by running the command:
sudo rpi-eeprom-update -a
in the terminal. Once the update is complete, safely remove the MicroSD card from the Raspberry Pi in preparation for the NVMe installation.
In this article, we'll be using the Geekworm X1001 NVMe HAT (not to be confused with the official Raspberry Pi NVMe HAT). I've also purchased the Silicon Power 512 GB NVMe drive that is quite affordable. Note that there are known compatibility issues with different types of NVMe drives, athough that is always changing with EEPROM updates (hence the insistence to update the EEPROM before getting started).
The physical installation of the HAT is quite straightforward. First, add the spacers to the board and insert the ribbon cable into the PCIe slot of the Raspberry Pi. After that, lay the HAT on top of the spacers and secure it down by screwing the board into the spacers. Finally, attach the ribbon cable from the Raspberry Pi to the HAT.
Figure 1: NVMe adapter board (i.e. HAT) without NVMe drive installed
Just like in the getting started video, we'll be using the Raspberry Pi Imager, but we'll be flashing to our NVMe drive. You'll need an external NVMe to USB enclosure to do this. Run the Raspberry Pi Imager, select the OS, the NVMe storage, and start flashing. After the device flashing is complete, unplug it and plug it back in. Open up the NVMe drive and append the following two lines to config.txt:
dtparam=pciex1 dtparam=pciex1_gen=3
At this point, you can remove your drive from the enclosure and install it onto the Raspberry Pi HAT.
Figure 2: NVMe adapter board (i.e. HAT) with NVMe drive installed
Make sure you've removed the MicroSD card before powering on the Raspberry Pi.
An alternative method is to mirror your MicroSD contents onto the NVMe drive by using the utility in your Raspberry Pi OS (Bookworm) found under Applications (the raspberry icon in the top left) > Accessories > SD Card Copier. Before doing this, you will need to add the following lines to /boot/firmware/config.txt (using the command sudo nano /boot/firmware/config.txt):
dtparam=pciex1 dtparam=pciex1_gen=3
Once you restart, the NVMe should show up as an external drive. Once in the SD Card Copier, set "Copy from device" to your MicroSD card and the "Copy to device" path to the NVMe drive. After successfully mirroring your MicroSD card, power down the Raspberry Pi, remove the MicroSD card, and power the device back on.
At this point, your NVMe should boot the operating system just like your MicroSD card does, but you'll notice a massive increase in speed/performance. It's inevitable that life happens and things go wrong. To troubleshoot different issues I used the help guide from Geekworm but, hopefully, you won't run into those issues. One great way to debug the bootup step is to hit the spacebar repeatedly after powering on the Raspberry Pi device until you see the bootup screen. After that, you can hit 6 to boot via NVMe and observe the boot process.
As I've mentioned above, it's absolutely critical to get the latest firmware onto your Raspberry Pi (via sudo rpi-eeprom-update -a). I found this to make a difference in terms of hard drive support. I also tested various NVMe drives and found that some just wouldn't work whatsoever. It's a finicky process, so it's best to stick with what Geekworm suggests or what I've used (the Silicon Power one above or the WD Black SN770 NVMe drive).
Switching from MicroSD to NVMe storage on the Raspberry Pi 5 unlocks higher performance, improved reliability, and a longer-lasting storage solution. While the setup requires an NVMe HAT and some configuration tweaks, the benefits far outweigh the effort. Whether you're looking for faster boot times or a more robust system for intensive applications, NVMe is the future of Raspberry Pi storage.