HardwareHardware problems and fixes

Raspberry Pi 5 NVMe SSD not detected: the checks in order

You fitted an NVMe SSD to a Raspberry Pi 5 and nothing shows up: no drive in the file manager, no /dev/nvme0, or the board will not boot from it. Raspberry Pi documents each of the usual causes. Here they are in the order that wastes the least time: the physical connection, the PCIe setting, the firmware, the link speed, then booting.

In short: Power off and reseat the ribbon cable the right way round, then boot from an SD card and run ls -l /dev/nvme*. If nothing is listed, update the bootloader to a release dated 6 December 2023 or later; with a non-HAT+ adapter, add dtparam=pciex1. If the drive is seen but will not boot, set BOOT_ORDER=0xf416. If you forced PCIe Gen 3, go back to Gen 2.

At a glance
Detection checkls -l /dev/nvme* should list /dev/nvme0 and /dev/nvme0n1
Firmware neededbootloader dated 6 December 2023 or later
Non-HAT+ adaptersdtparam=pciex1 in /boot/firmware/config.txt, PCIE_PROBE=1 to boot
Boot from NVMeBOOT_ORDER=0xf416 in the bootloader config
SpeedGen 2 by default; Gen 3 is not certified and might be unstable
M.2 HAT+ sizes2230 and 2242 (Compact: 2230 only), M key

1. Power off, then check the cable and the drive size

Raspberry Pi's first rule for the M.2 HAT+: "Always disconnect your Raspberry Pi from power before connecting or disconnecting a device from the M.2 slot." Then the ribbon cable, which is the most common physical fault. At the Pi end, insert it with the metal contacts facing the USB ports; at the HAT end, with the copper contacts facing up. It has to sit fully and evenly in both connectors.

Check the drive fits the board. The M.2 HAT+ takes M key drives in the 2230 or 2242 form factor; the M.2 HAT+ Compact takes 2230 only. A 2280 drive, the common desktop size, does not fit either of them. The Raspberry Pi SSD is a 2230 drive (Raspberry Pi SSD on Amazon).

2. Ask Linux whether it sees the drive

Boot from an SD card and run:

ls -l /dev/nvme*

A detected drive appears as /dev/nvme0 and /dev/nvme0n1. If you see them, the hardware works: a new or unformatted drive simply does not appear as an icon on the desktop, as the M.2 HAT+ page notes. Skip to step 5 if your problem is booting.

If nothing is listed and you use an adapter that is not a HAT+ (a board without the HAT+ identification), the connector is off: "By default, the PCIe connector is not enabled unless connected to a HAT+ device." Add this line to /boot/firmware/config.txt and reboot (the alias nvme also works):

dtparam=pciex1

3. Update the bootloader and the system

The M.2 HAT+ page has you check the bootloader date first:

sudo rpi-eeprom-update

If it shows 6 December 2023 or later, carry on. If older, open sudo raspi-config, choose Latest under Bootloader Version, then apply and reboot:

sudo rpi-eeprom-update -a

The NVMe boot page also asks for current software before anything else:

sudo apt update && sudo apt full-upgrade

4. If it appears and disappears: go back to Gen 2

The Pi 5 runs its PCIe link at Gen 2.0 (5 GT/s) by default. Many guides suggest dtparam=pciex1_gen=3 or the PCIe Speed option in raspi-config for Gen 3.0 (8 GT/s). Raspberry Pi's warning: "The Raspberry Pi 5 isn't certified for Gen 3.0 speeds. PCIe Gen 3.0 connections might be unstable." Its performance page goes further: forcing it "can lead to data corruption or system instability if the connected HAT or ribbon cable can't handle the increased frequency."

A drive that vanishes under load, throws I/O errors or fails some boots and not others is the textbook case for removing dtparam=pciex1_gen=3 from config.txt. For an agent host that should run unattended, Gen 2 is the boring choice: the HAT+ is a single lane rated at 500 MB/s peak, still far faster than an SD card for the small writes an agent makes.

5. Seen but will not boot: the boot order

"By default, Raspberry Pi devices do not boot from PCIe storage." Edit the bootloader configuration:

sudo rpi-eeprom-config --edit
# set:
BOOT_ORDER=0xf416
# and, with a non-HAT+ adapter, also:
PCIE_PROBE=1

The digit 6 in the boot order is NVMe ("For NVMe boot, use boot mode 6"). The same choice is in raspi-config under Advanced Options > Boot Order. Raspberry Pi also notes that with no SD card inserted, a Pi 5 boots from the NVMe drive automatically once it is flashed with Raspberry Pi Imager. If boot still fails after all this, Raspberry Pi asks for an issue on its rpi-eeprom GitHub repository.

Booting from NVMe is also the main fix on SD card corruption, and the full setup, parts and agent notes are on NVMe on the Raspberry Pi 5.

Other things worth ruling out

  • PCIe switches and dual adapters. "Only certain devices support enumeration of PCIe devices behind a switch." With a board that carries two M.2 slots or an AI accelerator next to the SSD, test the SSD on its own first.
  • Power. The M.2 HAT+ supplies up to 3 A to the drive from the Pi. A board on a weak supply has less to give; see the power supply warning page.
  • Cooling. You cannot fit the Active Cooler beneath the M.2 HAT+ Compact. The SSD Kit includes a 16 mm stacking header and spacers so the HAT+ fits with an Active Cooler.

What to buy

Shop links go through /go/ and open Amazon (amazon.fr in the EU and Switzerland, amazon.com elsewhere). As an Amazon Associate we earn from qualifying purchases. Your price does not change and no brand pays for a place on this page (disclosure). We write no price down: it moves, the shop shows today's.

Questions

Why does ls /dev/nvme* show nothing on my Pi 5?
In order: the ribbon cable is not seated or is reversed, the adapter is not a HAT+ and needs dtparam=pciex1, or the bootloader is older than 6 December 2023. Power off before reseating the cable.
Do I need dtparam=pciex1 with the official M.2 HAT+?
No. Raspberry Pi says the connector is enabled by default when a HAT+ device is connected. The line is for other adapters.
Should I enable PCIe Gen 3 for my NVMe drive?
Not on a host that must stay up. Raspberry Pi says the Pi 5 is not certified for Gen 3 and that forcing it can lead to data corruption or instability. If a drive drops out, removing dtparam=pciex1_gen=3 is the first thing to try.
The drive is detected but the Pi boots from the SD card. Why?
The Pi does not boot from PCIe by default. Set BOOT_ORDER=0xf416 with sudo rpi-eeprom-config --edit (plus PCIE_PROBE=1 on a non-HAT+ adapter), or choose a boot order with NVMe in raspi-config. With no SD card inserted, a flashed NVMe drive boots automatically.
Will a 2280 NVMe SSD work on the M.2 HAT+?
Not mounted on it: the M.2 HAT+ supports 2230 and 2242 drives, and the Compact version 2230 only.

Sources