SSDs on the Raspberry Pi are not new. For many years now people have been enjoying NVME speeds on Raspberry Pis through the use of NVMe-to-USB adapters. The Pi 5 brought a long-awaited PCIE slot, opening up the possibilities of connecting M.2 devices directly to the board through the use of an M.2 HAT (Hardware Attached on Top).


In this video, we'll be taking a look at the official M.2 HAT for the Raspberry Pi 5, and how to use one of these to get your Pi 5 booting off of an SSD to unlock some blazingly fast speeds. Oh boy is it quick! The Pi 5 brought us a goody bag of new features, and arguably the most exciting of them all is that PCIe slot. This kind of provides us with a super fast highway for Dardo to travel between the CPU and memory and the device that we plug into this slot. And this M.2 HAT just plugs into that board and provides us with a very common M.2 connector that we can use. And there are quite a few things that we could plug into this M.2 slot, AI accelerators, network adapters, even graphics cards with maybe another adapter on top.

Now working with all of those is a little technical in nature, but something a lot easier that we will probably more often use it for is to connect an SSD to it, which is going to be a far better storage method than a microSD card. Not only is it going to be much faster than an SD card, but it's also going to have a better lifespan, as NVMe drives can typically go through 10 times more read and write cycles than an SD card can. To use one though, we're going to need a few things. Obviously we're going to need the M.2 HAT, you're also going to need a Pi 5, any sized gigabyte model will work, and we're also going to need an NVMe SSD. And for the M.2 HAT, you'll either need a 2230 or a 2242-sized NVMe drive. This is just the dimensions of the drive, it's 22mm by 30mm or 42mm.

Now it does seem like there are some SSD compatibility issues. It looks like 95% of NVMe SSDs will work, but we have seen reports from the community of people running into issues with a few select NVMe drives. If you need a hand selecting one, we have links in the article below to SSDs that we know will work, as well as some community resources to help investigate if your specific one will. And if you have an SSD that works with the HAT, let us know so we can add it to the list. And just remember, it needs to be an M.2 NVMe SSD, not an M.2 SATA SSD, those are very different things. And finally, you're going to need a microSD card, but only temporarily. Long story short, we need to install the Pi's operating system onto the NVMe drive, and to do that we're going to need a microSD card, just as a step of getting to there. Any microSD card will do, it doesn't need to have a high-speed rating, as long as it's 16GB or bigger. You can find links to all of these in our written guide, there's a link below in the description, as well as links to anything else we mention in this video.

Let's start by installing the HAT and SSD onto the Pi 5, and spoiler alert, it can fit with the active cooler. We found it was easy to install the standoffs on the Pi 5 board first, then attach the PCIe HAT with the flat ribbon cable. You just need to lift up the tab on the PCIe slot, and the cable should very easily fit in. Then press the tab back down, and it should be locked into place. Just be very careful with this ribbon cable, don't make any sharp bends with it, and just be aware that they can be a little fragile. Then screw the M.2 HAT onto the standoffs, and insert the NVMe drive. Instead of inserting it, come in at a little bit of an angle like this, press it in, and then screw it down flat to the board. And that's it! Super easy installation, and now we can access our SSD from our Pi. It's all nice and compact on there. People have been running Pis off NVMe drives for a while now, but that's usually done with a USB to NVMe adapter, which takes up a USB port, and is not very compact with that dangly adapter hanging around.

Now let's take a look at how to get Pi OS installed onto our SSD, so that we can boot off of it. If you happen to have a USB to NVMe adapter lying around, this process is super easy. Just plug it into your computer, and you can directly install Pi OS onto it like we would with a microSD card. But in the more likely chance you don't have an adapter, we're going to need to do a little workaround by installing Pi OS onto a microSD card first, then booting off the microSD card, which we will use to install it onto the NVMe. If you don't already have that, it's super easy to set up. Just download the Raspberry Pi imager, link in the article, and we're going to insert our microSD card. We're going to choose Pi 5 as our device, the latest 64-bit of Pi OS, and then we're going to choose our microSD card. Be aware that when you install Pi OS onto the SD card, you will wipe any data that is already on it. And then we're just going to let it do its thing. Yes, we want to erase all data on it. Sweet. And once that's finished installing, we can whack it back in and start booting up our Pi. And we just need to go through the setup phase, and we can basically just race through these because we're not using this SD card version of Pi OS. Just make sure you do connect it to the internet.

Now that we're in our desktop environment, we're going to head over to the Pi OS imager, and we can check here that our hardware is all plugged in correctly because we should be able to see our device under storage. If you can't see your NVMe drive here, double-check your ribbon cable connections and ensure that you're running the latest version of Pi OS, which can be done by opening up the terminal and punching in sudo apt update, hit enter, let it do its thing, and followed by sudo apt upgrade. You might need to punch in Y. If all is well, though, we're just going to repeat the exact same process that we did installing it on the micro SD, ensuring that we choose the Pi 5, 64-bit and selecting our drive, hit next. And we might need to also punch in our password that we created. Sweet. And just let that do its thing. And once that's finished installing, we only have one step left, and that is to set the boot order. Right now, the Pi is going to try and boot from the SD card first. Then the NVMe. Now, changing this is really easy. All we need to do is open a terminal window, punch in sudo raspi-config, and then using the arrow keys, we can navigate to advanced options, boot order and select NVMe or USB boot. It's going to do its little thing. And once that's finished, we're all done. We can now restart our Raspberry Pi and it should boot from the NVMe on the hat.

Now, when trying to change the boot order, you might run into this EEPROM error, and this is easily fixed by going into advanced options, bootloader version, and then select latest bootloader. Use the latest bootloader. And then just let that do its thing. And once it's done, reboot and go do the steps we just did. Once the boot order is selected, we are done. You can now restart your Pi 5, and anytime you turn it on, it should boot from the NVMe on the hat. And we can actually double check we're booted into the NVMe by opening up a new terminal and typing in df slash boot dash h. And you should be able to see that we are currently on an NVMe drive.

Now, Pi 5 by default comes with the PCIe set to Gen 2 speeds, but it is possible to set it to Gen 3 speeds, which should theoretically double the maximum read and write speeds on our SSD. There is a word of warning here. Although it is possible to use Gen 3 speeds, it is not supported and may lead to some stability issues. On top of that, the speeds that we are getting through Gen 2 PCIe are faster than you probably need in most use cases. But for those of you that really need it, it's a super simple process. Ensure that you have booted from the NVMe, and then you just need to go into the config file with sudo nano slash boot slash firmware slash config dot text hit enter. And then we just need to insert the line dt param equals PCIe x1 underscore Gen 3, just like so. Then just reboot your system. Just remember, not officially supported might run into some stability issues here.

All right, that just leaves one more question. How much faster is the NVMe over an SD card? To answer this, we booted up a HDParm and DD to perform our sequential read and write benchmarks. Then we used Iozone to benchmark our 4K random read and write speeds. And damn, the NVMe is fast. The Pi 5 saw nearly a double in SD card performance over the Pi 4. And even with that, an NVMe SSD blows it out of the water, scoring about five times as much on the sequential tests and nearly 15 times as much on our 4K random tests. And that's just on Gen 2 speeds. And although the Gen 3 PCIe benchmarks are much faster for our sequential tests, the 4K ran tests are a bit more indicative of day to day performance you'll see, and Gen 3, not as much of an increase there. Again, the need for this extra speed in sequential tests is a bit of a niche and overkill for most applications, but it's nice that it is possible. We also fired up the Otii Arc to benchmark boot times and saw that it booted about two seconds faster with an NVMe, which is not astounding or leaps and bounds-y, but that's a nice tidbit.

Well, that about wraps that up. From here, you should be able to continue on with whatever project or application you're using your Pi 5 for, but now booting off of an NVMe SSD through the M.2 hatch. Your projects not only benefit from that greatly improved read and write speeds, but also an increase in storage lifespan over a micro SD card. If you made something cool with this, whether you built a NAS or you got another M.2 peripheral working with the hatch, or you just run into some trouble at any step of the way, let us know in our community forums. We're all makers and we're happy to help. Till next time.



Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.