HomeRaspberry PiHow to boot Raspberry Pi 5 from NVMe M.2 SSD

How to boot Raspberry Pi 5 from NVMe M.2 SSD

Nice, quick and simple

Argon40 sent me awesome cases for Raspberry Pi 5 to try out. Both Argon One V3 and Argon NEO 5 come with support for NVMe M.2 SSD drives, so I decided to give it a go. I already have a guide on how to boot from USB on Raspberry Pi 4 – so this little tutorial will serve me well. I write most of them to learn how to do it, and to have an easy-to-understand guide to look up later!

Let’s go!

Boot from NVMe M.2 SSD

To get started, you have to have a compatible SSD drive. If this is your first time, read this chapter to make sure you have the correct storage at hand. It’s easy to pick up the wrong SSD on Amazon – so let me quickly explain.

Shop carefully

M.2 is a connector type. It’s a hardware specification shared by NVMe (PCIe controller) and SATA-based solid-state drives. I have a Super6C cluster that uses six M.2 ports for SSDs, but as the board is made for Compute Module 4, it only supports SATA-based storage. If I were to install an NVMe-based M.2 SSD – they wouldn’t work.

To take advantage of the boot via PCIe port exclusive to Raspberry Pi 5 board, you need an M.2 NVMe drive – take a look at these listings on AmazonUK|AmazonUS to find compatible storage.

The next step is to understand the form factor. M.2 SSDs come with various storage capacities and sizes. The numbers like 2240 or 2280 refer to the physical footprint. M.2 SSD board is 22mm wide and comes with various lengths: 40/60/80mm which is noted with the corresponding footprint numbers 2240/2260/2280 etc.

Mystery sorted.

Raspberry Pi 5 boot from NVMe

I’m using Argon40 One V3 with M.2 NVMe support, but the process will work for other PCIe expansion boards. Your first steps are to enable the PCIe port and configure it to support Gen3. To do that, open your config.txt located on the boot partition

sudo nano /boot/firmware/config.txt

#old path
sudo nano /boot/config.txt

and add the following lines:

[all]
dtparam=nvme
dtparam=pciex1_gen=3

Reboot your Raspberry Pi 5 board and install M.2 NVMe storage now. Once done, you can confirm that the PCIe port is working correctly and you can detect the new hardware with:

lspci

#output
PCI bridge: Broadcom Inc. and subsidiaries BCM2712 PCIe Bridge (rev 21)
Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller 980
PCI bridge: Broadcom Inc. and subsidiaries BCM2712 PCIe Bridge (rev 21)
Ethernet controller: Raspberry Pi Ltd RP1 PCIe 2.0 South Bridge

The terminal output should appear above with the orange line listing your newly installed storage. You can also check if the system sees the drive present with:

lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk0 179:0 0 29.7G 0 disk
├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware
└─mmcblk0p2 179:2 0 29.2G 0 part /
nvme0n1 259:0 0 931.5G 0 disk

The next step is to format the drive and prepare the partition. We can do this with fdisk:

sudo fdisk /dev/nvme0n1 

#then use the commands below, if you want multiple partitions, remember to define the sizes of each new partition correctly

n - create new partition 
p - primary partition
w - write (save changed)

When you run lsblk again the table should look like this:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
mmcblk0     179:0    0  29.7G  0 disk
├─mmcblk0p1 179:1    0   512M  0 part /boot/firmware
└─mmcblk0p2 179:2    0  29.2G  0 part /
nvme0n1     259:0    0 931.5G  0 disk
└─nvme0n1p1 259:1    0 931.5G  0 part

The next step is to change the boot order. Use sudo raspi-config to open the configuration menu and navigate to Advanced Options > Boot Order > NVMe /USB Boot

Don’t reboot your Raspberry Pi, just yet. We need to copy partitions over to your new drive. We can use dd to achieve this with a single line of code:

sudo dd if=/dev/mmcblk0 of=/dev/nvme0n1 bs=4MB status=progress

Now you can reboot your Raspberry Pi 5.

If all went ok, on your next boot the board should be booting from M.2 NVMe SSD. You can confirm this by running:

lsblk

#output
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
mmcblk0     179:0    0  29.7G  0 disk
├─mmcblk0p1 179:1    0   512M  0 part
└─mmcblk0p2 179:2    0  29.2G  0 part
nvme0n1     259:0    0 931.5G  0 disk
├─nvme0n1p1 259:1    0   512M  0 part /boot/firmware
└─nvme0n1p2 259:2    0  29.2G  0 part /

Final thoughts

Booting Raspberry Pi 5 from NVMe SSD is a piece of pie! it takes only a few minutes, and you can take advantage of reliable storage, fast file access and an incredibly swift boot! Let me know how you will use your Raspberry Pi 5 and the new storage in this Reddit thread. Also, what was the storage capacity you went for?

📈 – See the transparency note for details.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

M5Paper

Programable, ESP32 based awesome dev platform with 4.7 e-ink display by M5Stack

More HATs

client-image
client-image

Argon One M.2

Enclose Raspberry Pi 4 inside this great case with custom I/O, cooling and GPIO and M.2 SSD support

More cases on

client-image
client-image

Best Raspberry Pi Projects

How to use Raspberry PI as WOL (wake on lan) server

0
While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

Slow Internet Warning

0
From time to time my Internet grinds to a stop. Since Raspberry Pi 4 comes with a 1Gbps Ethernet, I decided to take advantage of it and create a reporting system in NodeRED that will monitor and report when the ISP is not keeping the contractual agreements. Works with Alexa, Google Home, Android and Windows 10.

How fast Raspberry Pi NAS is?

0
Let's see how fast Raspberry Pi NAS really is?

Argon18: Argon ONE SSD modification

0
Argon One case just got better - now you can boot it from USB without ruining the design thanks to Argon 18: Argon One SSD modification

HOW TO...

It took me 2 months to boot CM4 from NVMe

0
Complete beginners guide to Compute Module 4 boot from NVMe.

Raspberry Pi Zero 2 W vs other Zero boards

0
It's time to test the Raspberry Pi Zero 2 W against other Raspberry Pi boards from Zero series: power, WiFi, temperature and core performance

C/C++ and MicroPython SDK for Raspberry Pi Pico on Windows

0
A guide to SDK toolchain for Raspberry Pi Pico and C/C++ , Micropython on Windows.

A comprehensive guide to Grafana & InfluxDB

0
How to use Grafana and InfluxDB on Raspberry Pi for IoT sensors in home automation

How to boot Raspberry Pi 4 from USB

0
How to set up and boot Raspberry Pi 4 from USB drive - headless guide.