NVMe SSD boot with the Raspberry Pi 5
Most of the content of this tutorial comes from Jeff's blog: NVMe SSD boot with the Raspberry Pi 5, Thanks fo Jeff
Contents
Enabling PCIe
By default the PCIe connector is not enabled. To enable it you should add the following option into /boot/firmware/config.txt and reboot:
sudo nano /boot/config.txt
Then add the following comment;
# Enable the PCIe External connector. dtparam=pciex1 # This line is an alias for above (you can use either/or to enable the port). dtparam=nvme
Press Ctrl-O, then enter, to write the change to the file.
Press Ctrl-X to exit nano (the editor).
And the connection is certified for Gen 2.0 speed (5 GT/sec), but you can force it to Gen 3.0 (10 GT/sec) if you add the following line after:
dtparam=pciex1_gen=3
However, we DON'T recommend you to use Gen 3.0 as it is not officially supported and may not work stably.
Then DON'T forgot to reboot
sudo reboot
You also can refer to official documentatio:Enabling PCIe
Flash OS onto NVME SSD
To get the NVMe SSD to boot your Pi, it needs to have an OS, so the Raspberry Pi OS needs to be flashed onto NVME SSDs, this is very important!
Here are a few ways to flash the OS to an NVME SSD:
1. Use SD Card Copier tool to flash OS onto the NVME SSD On Raspberry Pi OS(recommended)
- This method works if you have an SD card and have booted the device successfully
Cick Applications =>Accessories =>SD Card Copier on the main screen, run the SD Card Copier program, and copy the OS to the NVME ssd as shown in the figure below.
Click Start to run. Then shut down, unplug the SD card, and restart the device.
This is a visual operation and we highly recommend it!
2. Flash the SSD with Raspberry Pi Imager
You can also directly use the Raspberry Pi Imager tool on a MAC computer or windows computer to flash a fresh Pi OS to NVME SSD, but you will need an additional USB to nvme adapter.
- Install Pi Imager and open it
- Plug your NVMe SSD into your computer using a USB to NVMe adapter
- Choose an OS to install
- Choose the drive (connected through your adapter) to flash
- Click write (and set any options you'd like)
Once flashing is complete, pull the NVMe drive, attach it to your Pi 5, and it should boot off it (with or without a microSD card inserted)—assuming you have the bootloader up to date and set the BOOT_ORDER appropriately!
3. Clone your microSD boot volume to an NVMe SSD
Assuming you already have Raspberry Pi OS on a microSD card that is booting your Raspberry Pi 5 internally, and the NVMe SSD is connected and visible (check if you see a device /dev/nvme0n1 after running lsblk), you can use rpi-clone to clone the internal microSD boot volumes to your NVMe SSD:
# Install rpi-clone. git clone -b 123-nvme https://github.com/geerlingguy/rpi-clone.git cd rpi-clone sudo cp rpi-clone rpi-clone-setup /usr/local/sbin # Clone to the NVMe drive (usually nvme0n1, but check with `lsblk`). sudo rpi-clone nvme0n1
Note: You may want to wipe all disk partitions before cloning:
sudo umount /dev/nvme0n1p? sudo wipefs --all --force /dev/nvme0n1p? sudo wipefs --all --force /dev/nvme0n1 sudo dd if=/dev/zero of=/dev/nvme0n1 bs=1024 count=1
Set NVMe early in the boot order
The PCIe connection should work after a reboot, but your Pi won't try booting off an NVMe SSD yet. For that, you need to change the BOOT_ORDER in the Raspberry Pi's bootloader configuration:
Run the following command to edit the EEPROM on the Raspberry Pi 5.
sudo rpi-eeprom-config --edit
Then change the BOOT_ORDER line to the following:
BOOT_ORDER=0xf416
- Press Ctrl-O, then enter, to write the change to the file.
- Press Ctrl-X to exit nano (the editor).
Read Raspberry Pi's documentation on BOOT_ORDER for all the details. For now, the pertinent bit is the 6 at the end: that is what tells the Pi to attempt NVMe boot first!
Reboot your Raspberry Pi 5 to make the change take effect.
Upgrade eeprom, solve NO wifi issue
NOTE: If you find that there is no WIFI after restarting, you can try this part of the update, otherwise please ignore it.
After modifying the BOOT_ORDER for NVME SSD, reboot the PI5 and you will get the NO WIFI error. We need to upgrade the eeprom to fix it (Raspberry Pi Foundation official may upgrade the OS to solve this kind of problem, please pay attention to the update of Raspberry Pi OS, if the OS upgrade can solve this problem, you can ignore this step).
Run the following command to
wget https://github.com/timg236/rpi-eeprom/raw/pieeprom-2023-10-30-2712/firmware-2712/default/pieeprom-2023-10-30.bin sudo rpi-eeprom-config --edit pieeprom-2023-10-30.bin
It is recommended to use the latest version of the pieeprom-xxxx-xx-xx.bin file, please visit this link to get the latest version:
PS: After our testing, we found that only the firmware piepprom-2023-10-30.bin has solved the NO WIFI problem for the time being.
NOTE:
If you are flashing a fresh Pi OS to NVME ssd, you have to enable pcie after booting the device; if you are COPY or CLONE an old system from SD card to NVME ssd, and you have already enabled pcie in the old OS in advance, then you don't need to do enable pcie operation again!
Enable comment auto-refresher
Anonymous user #13
Permalink |
Anonymous user #12
Permalink |
Anonymous user #11
Permalink |
Anonymous user #8
Permalink |
Anonymous user #6
Permalink |
Anonymous user #9
Anonymous user #10
Anonymous user #5
Permalink |
Anonymous user #7
Anonymous user #4
Permalink |
Anonymous user #4
Anonymous user #3
Permalink |
Anonymous user #2
Permalink |
Harry
Anonymous user #1
Permalink |
Walker