How to turbo-charge your Raspberry Pi 5 with an NVMe boot drive

Setting up an NVMe SSD on the Raspberry Pi 5
(Image credit: Tom's Hardware)

The Raspberry Pi 5 introduced PCIe connectivity to the model B form factor and with it we are slowly seeing a number of boards for NVMe SSDs. The first was Pineberry Pi’s Hat Drives, followed by Pimoroni’s NVMe Base. The official Raspberry Pi M.2 board is just on the horizon, as the PIP, a Raspberry Pi word for PCIe Peripheral, specification has just been released.

For the early adopters, who have just received, or built their first NVMe board, how do we get it to work with the Raspberry Pi 5? We’ve been down that road, made the mistakes and have the knowledge to pass on. So let's turbo-charge our Raspberry Pi 5 with a super-speedy NVMe SSD.

For this project you will need 

  • Raspberry Pi 5 running Raspberry Pi OS from micro SD
  • NVMe SSD
  • NVMe HAT
  • USB-to-NVMe adapter (see best SSD enclosures)

Preparing your NVMe drive 

Depending on your NVMe HAT board you can use any of the best NVMe SSDs, but we would choose a 2280 drive as they are cheap and plentiful, just make sure that your HAT board supports them.

1. Boot your Raspberry Pi 5 from a micro SD card.

2. Connect your NVMe SSD to a USB 3 port on the Raspberry Pi 5 via a USB 3 to NVMe adapter. 

3. Complete all of the steps to download and install Raspberry Pi OS in our guide. Install the OS to the NVMe drive and not the micro SD card!

4. Once complete, eject and remove the NVMe drive from the USB adapter. 

Setting up the Raspberry Pi 5 to use an NVMe drive 

With our NVMe drive created, we now need to tell the Raspberry Pi 5 that we want to boot from NVMe and how fast we expect the connection to run at.

1. Open a terminal and use nano to edit the config.txt file. This file is used to alter the configuration of the Raspberry Pi. With it we can overclock the CPU and GPU and in this case set the PCIe connection speed.

sudo nano /boot/config.txt

2. Using the cursor keys, move down to the bottom of the file and add a section for NVMe configuration. We use a comment to denote what this block will do.

#NVMe Configuration

3. Set the PCIe connection speed. There is official support for PCIe Gen 2 speeds, but we’ve tested Gen 3 and it works perfectly. Your mileage may vary, so if it doesn’t work, change this to 2.

dtparam=pciex1_gen=3

(Image credit: Tom's Hardware)

4. Press CTRL + X. Then press Y and Enter to save and exit the editor.

5. Reboot the Raspberry Pi for the change to take effect. 

6. Open a terminal and edit the EEPROM.

sudo rpi-eeprom-config --edit

7. Change the BOOT_ORDER line to boot from NVMe. Adding 6 to the end of the line will set the Raspberry Pi 5 to look for a bootable NVMe drive first.

BOOT_ORDER=0xf416

(Image credit: Tom's Hardware)

8. Add a line to enable custom PCIe boards to be used with the Raspberry Pi 5.

PCIE_PROBE=1

9. Press CTRL + X. Then press Y and Enter to save and exit the editor.

10. Reboot the Raspberry Pi for the change to take effect. Check that your Raspberry Pi 5 reboots correctly before moving on.

11. Power off the Raspberry Pi 5 and remove the USB C power connection from the Pi. We need to make sure that the power is off.

12. Gently lift the PCIe connector plastic housing so that it unlocks and insert the flat flex cable so that the gold “teeth” are facing the USB / Ethernet ports.  

(Image credit: Tom's Hardware)

13. Gently apply pressure to the plastic connector housing so that the cable is locked in place. 

14. Perform the same procedure on the NVMe board. 

15. Insert your NVMe drive with Raspberry Pi OS into the NVMe board and secure it in place. Follow the instructions for your chosen board.

16. Check all of the connections are correct and then power up the Raspberry Pi 5. 

(Image credit: Tom's Hardware)

Your Raspberry Pi 5 is now booting from NVMe and you can enjoy the speed boost that it provides. 

Les Pounder

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".

  • synthetic hooman
    Very helpful, but please include the make and model of the NVMe HAT you are using, and a link so we know where to purchase.
    Thanks
    Reply
  • if not myString:
    synthetic hooman said:
    Very helpful, but please include the make and model of the NVMe HAT you are using, and a link so we know where to purchase.
    Thanks
    The name of the board is printed on it.

    https://pineberrypi.com/
    Reply