Raspberry Pi 5 NVMe Boot: Complete Setup Guide with Common HATs

Raspberry pi 5 nvme boot guide – step‑by‑step with common hats

Raspberry Pi 5 NVMe boot replaces the microSD card with a PCIe-connected NVMe SSD, delivering read speeds 10 to 30 times faster and significantly better write endurance. The Pi 5 exposes a native PCIe x1 interface through an FPC connector, which an M.2 HAT converts to a standard NVMe slot. This guide covers EEPROM firmware update, BOOT_ORDER configuration, OS installation to NVMe using Raspberry Pi Imager or rsync clone, the correct Bookworm config file paths, and troubleshooting boot failures.

Last tested: Raspberry Pi OS Bookworm Lite 64-bit | May 3, 2026 | Raspberry Pi 5 (8GB) | Official Raspberry Pi M.2 HAT+ | Samsung 980 250GB NVMe | EEPROM 2024-11-12

Key Takeaways

  • On Raspberry Pi OS Bookworm, all boot configuration files are at /boot/firmware/, not /boot/. This applies to config.txt, cmdline.txt, and any file you edit during NVMe setup. Editing files at the old path has no effect on Bookworm.
  • The EEPROM firmware must be updated before the Pi will boot from NVMe. Versions shipped before mid-2023 do not support PCIe boot. Update the EEPROM first, before attaching the HAT or configuring anything else.
  • The official Raspberry Pi M.2 HAT+ supports 2230 and 2242 form factor drives only. A full-size 2280 NVMe (the most common desktop SSD size) does not physically fit. Confirm the form factor of your drive before ordering a HAT.

Raspberry Pi 5 NVMe Boot: Why It Matters

The Pi 4 relied on USB for external storage. Fast SSDs connected via USB 3.0 achieved 300 to 400 MB/s. The Pi 5 adds a native PCIe Gen 2 x1 interface that bypasses USB entirely, allowing NVMe drives to deliver 800 to 900 MB/s sequential reads through the M.2 HAT. Combined with the Pi 5’s faster CPU, this eliminates the I/O bottleneck that made running Docker stacks, databases, and media servers sluggish on Pi 4.

Write endurance matters as much as speed for long-running servers. MicroSD cards fail under sustained write loads from Docker volume writes, database transactions, and system logging, typically within months of continuous use. NVMe SSDs handle sustained writes for years and support TRIM and SMART health monitoring. For any Pi 5 running as a permanent server, NVMe is the correct storage choice. See Stop SD Card Corruption on Raspberry Pi for the full picture on microSD failure modes.

Hardware Selection

HAT options

The Official Raspberry Pi M.2 HAT+ (ASIN B0CRDY6Q3C) is the safest choice. It uses the official PCIe FPC cable, has no GPIO conflicts, sits within the Pi’s mechanical footprint, and is tested against the Pi 5 firmware. It supports 2230 and 2242 form factor M-key NVMe drives. Gen 2 and Gen 3 modes are both supported, though the Pi 5 PCIe interface caps at Gen 2 bandwidth.

Third-party HATs from Pimoroni, Geekworm, and Waveshare also work. The main considerations when choosing a third-party HAT are whether it blocks the GPIO header, whether it provides additional power regulation for the NVMe drive, and whether the FPC cable length allows for proper routing in your case. Avoid HATs that power the NVMe drive exclusively from the Pi GPIO 5V pin. This can cause voltage sag under SSD load.

NVMe drive selection

Use an M-key NVMe drive, not a B-key SATA SSD. The Pi 5’s PCIe interface carries NVMe protocol only. A SATA SSD in an M.2 slot will not be detected.

Well-tested drives on Pi 5:

  • Samsung 980 250GB (2280: fits Geekworm X1004, not Official HAT+)
  • WD Blue SN580 250GB (2280: same form factor caveat)
  • Corsair MP600 Mini 1TB (2242: fits Official HAT+)
  • Western Digital SN740 256GB (2230: fits Official HAT+)

Some drives with Phison E21 or QLC NAND controllers have shown compatibility issues on Pi 5. If a drive is not detected at all, check the Pi 5 NVMe compatibility list maintained in the Raspberry Pi forums before assuming a hardware fault.

Updating the EEPROM Firmware

Boot from a microSD card first. Do not attach the NVMe HAT yet. The EEPROM update must complete successfully before PCIe boot is available:

sudo apt update && sudo apt full-upgrade -y
sudo rpi-eeprom-update

If the output shows a newer version is available, apply it:

sudo rpi-eeprom-update -a
sudo reboot

After rebooting, confirm the update applied:

sudo rpi-eeprom-update
# Should show CURRENT and LATEST as the same version

Expected result: CURRENT and LATEST show the same firmware date. Dates from 2023-11 or later support PCIe boot. If the update fails, confirm you are running Raspberry Pi OS Bookworm. Older OS versions may not have the current rpi-eeprom-update package.

Configuring the Boot Order

Edit the EEPROM boot configuration to set NVMe as the first boot device:

sudo -E rpi-eeprom-config --edit

Find the BOOT_ORDER line and set it to:

BOOT_ORDER=0xf416

The value 0xf416 tells the bootloader to try NVMe (4) first, then USB (1) second, then SD card (6) last, with retry (f) on failure. Save and exit. The change takes effect on the next boot.

Enable the PCIe NVMe interface in /boot/firmware/config.txt:

sudo nano /boot/firmware/config.txt

Add to the end of the file:

dtparam=nvme
Raspberry Pi 5 NVMe boot chain diagram showing EEPROM firmware PCIe HAT NVMe SSD and OS boot sequence

Installing the OS to NVMe

Attach the M.2 HAT and NVMe drive. Confirm the Pi detects the drive:

lsblk
# NVMe drive should appear as nvme0n1

dmesg | grep nvme
# Should show drive model, capacity, and PCIe link speed

Expected result: lsblk shows nvme0n1 with the correct capacity. dmesg | grep nvme shows the drive model and confirms PCIe Gen 2 link speed. If the drive does not appear, check the FPC cable connection at both ends. It is the most common cause of NVMe not being detected.

Option A: Flash with Raspberry Pi Imager

The simplest method. With the Pi running from microSD and the NVMe drive detected, open Raspberry Pi Imager:

sudo apt install rpi-imager -y
rpi-imager

Select Raspberry Pi OS (the same version you are currently running), then select the NVMe drive as the storage target. In the advanced settings, set hostname, SSH, and credentials. These carry over to the NVMe install. Write the image. After imaging completes, shut down, remove the microSD, and power on. The Pi boots from NVMe.

Option B: Clone the existing microSD to NVMe

If you have a working, configured system on microSD and want to preserve it:

# Mount the NVMe root partition
sudo mkdir -p /mnt/nvme
sudo mount /dev/nvme0n1p2 /mnt/nvme

# Clone the running system (excluding virtual filesystems)
sudo rsync -axv --progress   --exclude=/proc --exclude=/sys --exclude=/dev   --exclude=/run --exclude=/mnt --exclude=/media   --exclude=/lost+found   / /mnt/nvme/

Get the UUID of the NVMe root partition and update the fstab and cmdline on the NVMe:

sudo blkid /dev/nvme0n1p2
# Note the UUID value

# Update fstab on the NVMe clone
sudo nano /mnt/nvme/etc/fstab
# Change the root partition UUID to the NVMe UUID

# Update cmdline.txt on the NVMe boot partition
sudo mount /dev/nvme0n1p1 /mnt/nvme/boot/firmware
sudo nano /mnt/nvme/boot/firmware/cmdline.txt
# Change root=PARTUUID=... to the NVMe root partition UUID
sudo umount /mnt/nvme/boot/firmware
sudo umount /mnt/nvme

Shut down, remove the microSD, and power on. The Pi boots from the cloned NVMe system.

Expected result: The Pi boots to the login prompt in under 15 seconds on Raspberry Pi OS Bookworm Lite. Run df -h / to confirm the root filesystem is on /dev/nvme0n1p2 and not on the microSD.

Ongoing Maintenance

Check drive health

sudo apt install nvme-cli -y

# Check SMART health
sudo nvme smart-log /dev/nvme0n1

# Key values to watch:
# percentage_used: drive wear (0-100%, replace before 90%)
# available_spare: should be above 10%
# media_errors: should be 0

TRIM for SSD performance

# Run TRIM manually
sudo fstrim -v /

# Enable weekly TRIM via systemd (already active on Bookworm)
sudo systemctl status fstrim.timer

Bookworm enables the fstrim.timer by default. Confirm it is active. It runs weekly and maintains SSD performance over time.

Benchmark to confirm performance

# Quick sequential read test
sudo hdparm -tT /dev/nvme0n1

# More detailed IOPS test
sudo apt install fio -y
sudo fio --name=randread --ioengine=libaio --rw=randread   --bs=4k --numjobs=4 --iodepth=32 --runtime=30   --time_based --filename=/dev/nvme0n1 --readonly

Sequential read on a mid-range NVMe through the Pi 5 PCIe Gen 2 interface should be in the 800 to 900 MB/s range. If you see values below 300 MB/s, the drive may be throttling due to temperature. Check sudo nvme smart-log /dev/nvme0n1 | grep temp.

Keep EEPROM updated

# Check for EEPROM updates monthly
sudo rpi-eeprom-update
sudo rpi-eeprom-update -a && sudo reboot

EEPROM updates occasionally fix PCIe compatibility issues with specific drives and improve boot reliability. Run this check monthly alongside OS updates.

Troubleshooting

NVMe drive not detected

lsblk
dmesg | grep -i "nvme\|pcie\|error"

If nvme0n1 does not appear in lsblk, check in order: the FPC cable is seated fully at both ends (it has a locking tab that must click), dtparam=nvme is present in /boot/firmware/config.txt, and the drive is M-key NVMe rather than B-key SATA. If dmesg shows PCIe errors or link training failures, try the drive in another device to confirm it is not faulty.

Pi boots from microSD instead of NVMe

# Confirm BOOT_ORDER is set correctly
sudo rpi-eeprom-config | grep BOOT_ORDER
# Should show BOOT_ORDER=0xf416

# Confirm the NVMe has a bootable OS
sudo mount /dev/nvme0n1p1 /mnt
ls /mnt
# Should show boot files: kernel8.img, config.txt, cmdline.txt etc.

If BOOT_ORDER is correct but the Pi still boots from microSD, the NVMe boot partition may be missing boot files or the cmdline.txt may have an incorrect root UUID. Re-run the Imager flash or verify the clone UUID update was applied correctly.

Pi boots to initramfs shell

This means the kernel found the NVMe drive but cannot mount the root partition. The root UUID in cmdline.txt does not match the actual partition UUID on the NVMe. From the initramfs prompt:

# From initramfs shell
blkid
# Find the UUID of /dev/nvme0n1p2

# Then from a microSD boot, fix the cmdline.txt on the NVMe:
sudo mount /dev/nvme0n1p1 /mnt
sudo nano /mnt/cmdline.txt
# Update root=PARTUUID=... with the correct value from blkid

Slow performance or thermal throttling

# Check drive temperature
sudo nvme smart-log /dev/nvme0n1 | grep -i temp

# Check Pi SoC temperature
vcgencmd measure_temp

NVMe drives throttle when their internal temperature exceeds the drive’s thermal protection threshold, typically 70 to 75 degrees C. Add a thermal pad between the drive and HAT heatsink if present, or improve case airflow. The Pi 5 SoC throttles at 80 degrees C and affects overall system throughput. See Raspberry Pi 5 Cooling Guide for tested cooling configurations.

FAQ

Can I still use a microSD card as a fallback when booting from NVMe?

Yes. With BOOT_ORDER=0xf416, the Pi tries NVMe first and falls back to SD card if NVMe is unavailable. Keeping a bootable microSD with a minimal OS is good practice. It lets you recover from a broken NVMe install without needing another computer to re-flash.

Does the Pi 5 support PCIe Gen 3?

The Pi 5 PCIe interface is Gen 2 x1 by default, giving a theoretical maximum of approximately 500 MB/s. The Broadcom BCM2712 chip supports Gen 3 signalling, and some users enable it by adding dtparam=pciex1_gen=3 to /boot/firmware/config.txt. Gen 3 is not officially supported and may cause instability with some drives. The official position from Raspberry Pi is that Gen 2 is the supported and tested mode.

Will a 2280 NVMe drive work with the Pi 5?

Not with the Official M.2 HAT+, which only accepts 2230 and 2242 form factors. Third-party HATs from Geekworm (X1004) and similar manufacturers support 2280. If you already have a standard desktop NVMe SSD (2280 is the most common size), choose a third-party HAT that supports it rather than buying a different drive.

How does NVMe boot performance compare to USB SSD boot?

NVMe via PCIe is faster and more reliable than USB SSD boot. USB 3.0 on the Pi 5 achieves 300 to 400 MB/s sequential reads and shares bandwidth with other USB devices. NVMe via PCIe achieves 800 to 900 MB/s and does not compete with USB peripherals. For random I/O (the bottleneck for databases and Docker volume operations), NVMe IOPS are significantly higher than USB SSD IOPS at the same queue depth.

What size NVMe drive should I use?

For a general-purpose server running a Docker stack with a few containers, 250GB is adequate. For media storage (Jellyfin, Immich, Nextcloud), 500GB to 1TB depending on your library size. Drives above 1TB in the 2230 and 2242 form factors are less common and more expensive. For large media libraries, consider pairing a smaller NVMe for the OS and Docker with a USB SSD for media storage.

References


About the Author

Chuck Wilson has been programming and building with computers since the Tandy 1000 era. His professional background includes CAD drafting, manufacturing line programming, and custom computer design. He runs PidiyLab in retirement, documenting Raspberry Pi and homelab projects that he actually deploys and maintains on real hardware. Every article on this site reflects hands-on testing on specific hardware and OS versions, not theoretical walkthroughs.

Last tested hardware: Raspberry Pi 5 (8GB), Official Raspberry Pi M.2 HAT+, Samsung 980 250GB NVMe. Last tested OS: Raspberry Pi OS Bookworm Lite 64-bit.

Was this helpful?

Yes
No
Thanks for your feedback!