Raspberry Pi: How to Use an NVMe SSD on Raspberry Pi (Step-by-step Guide)

More Tips & Tricks

banner nvme ssd pi

How to Use an NVMe SSD on Raspberry Pi (Step-by-step Guide)

NVMe SSDs are amazing because not only are they smaller, but they’re also faster than regular SSDs. But it’s not immediately obvious which Pi models support NVMe drives or how to hook one up. In this article, I’ll show you how it works and how to get one up and running.

An NVMe SSD can be installed on Raspberry Pi 5 and Pi 4 with a special case, M.2 HAT, expansion board, or USB enclosure. The Pi’s boot configuration and boot order must be modified to use an NVMe.

Let’s start with a few things you need to know before we get into the technical details of getting the most out of your Raspberry Pi.

Table of Contents

Why Use an NVMe SSD on Raspberry Pi?

Using an NVMe SSD on a Raspberry Pi can dramatically improve storage performance, offer faster read/write speeds and lower latency compared to traditional storage options like SD cards or external hard drives.

Non-Volatile Memory Express (NVMe) drive is still considered an SSD because it uses NAND flash chips. But NVMe SSDs are slim like RAM sticks and are starting to come in smaller packages.

Here’s a comparison of common types of storage and their physical dimensions:

Storage TypeDimensions
HDD (3.5″)146 mm x 102 mm x 20 mm
SSD (2.5″)100 mm x 70 mm x 7 mm
NVME SSD22 mm x 80 mm x 2.5 mm — (M.2 2280)
22 mm x 60 mm x 2.5 mm — (M.2 2260)
22 mm x 42 mm x 2.5 mm — (M.2 2242)
22 mm x 30 mm x 2.5 mm — (M.2 2230)
Micro SD Card15 mm x 11 mm x 1 mm
Traditional SSD, NVMe case, Raspberry Pi case with NVMe slot and another traditional SSD.

As you can see, an NVMe SSD is much smaller than a traditional 2.5-inch SSD.

I think the form factor names are silly. For example, M.2 2280 simply refers to a drive’s size (22 x 80). It can be confusing if you assume those numbers refer to performance specs—but they don’t.

I’m very impressed by the M.2 2230 form factor: these drives can hold 2 terabytes of data in a square the size of a standard SD card. This compact shape makes it a great fit for the Raspberry Pi’s mind-blowing use cases.

nvme ssd sizes
Credit: Western Digital

Of course, the significance of an NVMe drive is more than its shape. An NVMe connects to the M.2 header on a motherboard, giving it direct access to the board’s fast PCI express lanes (PCIe is the same high-speed connection needed by powerful GPUs).

Here’s a comparison of typical sequential read/write speeds for different drive technologies:

Storage TypeInterfaceRead/Write Speed
Micro SD CardSD card reader80 MB/s – 200 MB/s
SSD (2.5″)SATA III400 MB/s – 550 MB/s
NVMe SSD (PCIe 3.0)M.21,500 MB/s – 3,500 MB/s
NVMe SSD (PCIe 4.0)M.22,000 MB/s – 6,500 MB/s
NVMe SSD (PCIe 5.0)M.27,000 MB/s – 12,000 MB/s

The estimates above are what you might get on a desktop PC—not the real-world speeds you’ll see on a Raspberry Pi, which can’t hit max speeds. But I think it paints a clear picture of relative capability.

NVMe SSDs are now the fastest storage retail consumers can buy. It is superior technology that’s become the new standard.

Wait, I have some recommendations for you!

Before you go any further, I want you to take a look at some of the recommendations I’ve handpicked for you. I think these are essential items you should have for your Raspberry Pi. You can check them out and buy them directly from Amazon.

How to Connect an NVMe Drive to Raspberry Pi?

Unfortunately, you can’t directly connect an NVMe SSD to a Raspberry Pi. Additional hardware is required.

I’ll review the options available so you can pick the one that’s best for you.

Raspberry Pi Cases with NVMe Support

The easiest way to connect an NVMe is to use a Raspberry Pi case that comes with NVMe support. I can slot an NVMe drive in the way I would when building a desktop PC.

Here are popular cases I recommend that have built-in NVMe support:

I like that these cases provide heat sinks for an NVMe drive, which is helpful since it has a habit of overheating. It’s helpful that these vendors provide a list of compatible NVMe drives, making it easier to know whether my choice will work.

Read/Write Speeds: 500 MB/s to 800 MB/s

Supported Models: Raspberry Pi 5

Some cases support M.2 SATA drives for Raspberry Pi 4, but they do NOT support M.2 NVMe drives.

M.2 HAT or Expansion Boards with NVMe Support

If you don’t want or can’t use a full case for your Pi, the next best way to connect NVMe is to add a HAT or expansion board. These peripherals stack on top of your Pi—like a sandwich—and hold the NVMe drive in place.

Here are a few of my recommendations:

Note: Before purchasing, make sure your NVMe will fit. NVMe drives come in different physical form factors, which were covered in the previous section.

Read/Write Speeds: 400 MB/s – 800 MB/s

The Pi 5 options will be closer to the high end of the speed estimate above since they connect directly to a PCIe header. The Pi 4 expansion board connects via USB, so it will be on the lower end of the speed range (it can go a little faster if your NVMe drive supports UASP).

Supported Models: Raspberry Pi 5 / Pi 4

There are expansion boards that support M.2 SATA drives for Raspberry Pi 3B+ / 3B, but they do NOT support M.2 NVMe drives.

USB 3.0 Enclosure for NVMe Drives

usb 3.0 enclosure for nvme drive
Credit: Plugable

Sometimes, I like being able to move my NVMe drive between different devices to use as an external drive. In this case, I find that using a USB NVMe enclosure is the most flexible option.

Here are a couple of my picks for USB 3.0+ enclosures for NVMe drives:

Read/Write Speeds: 300 MB/s – 500 MB/s

To get these speeds, you’ll need to connect your enclosure to USB 3.0 ports, which are blue on your Raspberry Pi.

You won’t reach as high a speed as the options above because the USB interface is not as fast as PCIe. Regardless, it’ll still feel like blazing speeds compared to a traditional micro SD card.

Supported Models: Raspberry Pi 5 / Pi 4 / Pi 400.

Technically, older models like the Pi 3 can still utilize an NVMe enclosure. But its USB 2.0 ports will significantly limit your drive’s potential.

How to Boot to an NVMe Drive on Raspberry Pi?

To boot from an NVMe drive on a Raspberry Pi, you need to update the bootloader to support USB boot and configure the Raspberry Pi to boot from the USB-connected drive.

Now that you have the hardware hooked up, you’re ready to start using your new NVMe. In this section, I’ll show you step by step.

Note: This guide assumes you already have a running Raspberry Pi system that you can work from.

nvme ssd connected to Pi inside case

Here are the steps to boot to your NVMe drive on Raspberry Pi:

  • Enable PCIe so that your Pi detects your NVMe drive:
    • Connect the NVMe SSD to your Pi.
    • Edit the Pi’s ”BIOS” configuration file:
      sudo nano /boot/firmware/config.txt
    • Add this line at the bottom:
      dtparam=nvme
      Note: if you have a Pi 5 and want to force it to use faster PCIe3 speeds, add this additional line: dtparam=pciex1_gen=3
      (If this additional line makes your system unstable, remove it.)
    • Reboot:
      sudo reboot now
  • Flash an operating system onto your NVMe drive:
    • To start fresh: Flash Raspberry Pi OS—or another operating system—onto your NVMe using Raspberry Pi Imager.
      Your drive will appear as an option under “Storage” if you did the previous step correctly.
      If you need more help, read our full guide to Imager hereraspberry pi imager
    • If you want to preserve your existing operating system: Clone your SD card onto your NVMe with the SD Card Copier tool.
      If you need more help, read our full guide to cloning your Pi here.
      sd card copier raspbian
  • Change the Pi’s boot order to prioritize your NVMe drive:
    • Load raspi-config from the command line:
      sudo raspi-config
    • Go to Advanced Options > Boot Order
    • Select NVMe/USB Boot. Hit Enter to Save. Then hit Finish.
      raspi-config boot from USB
    • Shut down and remove your SD card:
      sudo shutdown now

When you turn your Pi on again, Raspberry Pi OS should boot from your new NVMe drive. Nice!

FAQ

Is an NVMe upgrade worth it for Raspberry Pi?

Yes, if you have a Raspberry Pi 5 or Pi 4 especially if you’re still using an SD card. Like replacing an HDD with an SSD on an old PC/laptop, adding an NVMe drive to your Pi is the biggest performance boost you’ll directly feel.

However, if you’re already using a regular SSD on your Pi, then the gains from an NVMe SSD might not be as noticeable.

Does it matter if the NVMe SSD is PCIe Gen 3, 4, or 5?

No, any NVMe with PCIe3 or newer will perform similarly on the Pi. Newer PCIe generations are backward compatible, meaning even if you have a PCIe5 drive, it will still work on a board or USB enclosure that only supports PCIe3.

Either way, you’ll be limited by the Pi’s connection bandwidth before you reach NVMe max speeds. If costs are similar, I’d opt for a newer-gen drive.

Although you don’t have to worry about PCIe compatibility, you do have to think about the drive’s physical dimensions. Check whether your NVMe’s form factor physically fits into your case/HAT/enclosure. See our table above.

Do I have to worry about wearing out an NVMe drive?

Probably not, since the write endurance of an NVMe drive is 2x – 10x higher than that of a micro SD card. With normal use, you’ll probably never run into these limits. Nevertheless, I still recommend installing Log2Ram on your Pi to maximize your drive’s lifespan.

More Tips & Tricks

DistroSea.com site image
Check out different Linux distros in your web browser with nothing to download at DistroSea.com
Quick Ref Site image
Here are some cheatsheets and quick references from QuickRef.ME.
edX Site image
Learn Linux from MIT for FREE edX.
Linux Basics YouTube Series Site image
Linux Basics YouTube Series
Watch the Series.
“Linux Command Line Tutorial For Beginners" will teach you everything you need to know about Linux Command Line in easy-to-understand language.
Watch the Series.