Raspberry Pi 5 with PiMoroni NVME drive, switch to boot from NVME
Also see: https://learn.pimoroni.com/article/getting-started-with-nvme-base
Summary:
You should have a Pi 5, the PiMoroni NVME drive adapter, and an NVME drive installed.
Next, we create an SD card to boot from.
Next, we clone the entire SD card onto the NVME drive.
Then, we change the SD card boot to be from NVME.
Then we remove the SD card from the Pi, and boot, it should boot from NVME.
Warning:
The risks:
If you edit the boot order to be NVME, but the NVME is not set up and working, you'll lock yourself out of the system.
In that case, you can recover: you unplug the NVME bus cable, and boot off a regular memory card. It'll reboot about 2 times, it'll see that the NVME drive is not available (even though the boot order is stored and says NVME), and then it'll eventually boot from the memory card. At that point, you have access to your Pi again, you can shell in, use raspi-config, and fix the boot order to be from memory card again. You also need to go to Advanced Options, Bootloader Version, Use latest bootloader image. Then reboot. It'll no longer try to boot from NVME.
Start here:
# Create the OS drive to be the memory card
#
# Use Raspberry Pi Imager (v1.8.5 or newer) and create a new SD card with the OS on it.
# Use Other -> Raspberry Pi OS Lite 64 bit
# Edit settings
# Set a username and password
# Set up Wifi if needed, enable SSH, set Timezone
# Begin SD card install
# Insert the SD card into the pi, and boot
# Always run an update first, because the rapi-eeprom needs to be updated as well.
sudo apt-get update
sudo apt-get upgrade
# if the NVME drive is not attached physically, shut down, attach it, and power on again.
# log in and ensure that the NVME drive is visible
lsblk
# Example:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk0 179:0 0 29.7G 0 disk
├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware
└─mmcblk0p2 179:2 0 29.2G 0 part /
nvme0n1 259:0 0 476.9G 0 disk
# or if you already messed with it a couple times and created a partition by cloning the memory card, it can look something like this:
lblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk0 179:0 0 29.7G 0 disk
├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware
└─mmcblk0p2 179:2 0 29.2G 0 part /
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part
└─nvme0n1p2 259:2 0 476.4G 0 part
# Either way, you'll want to clone the mmc* card onto the nvme0n1 disk.
# If the NVME drive is visible, continue.
lsblk
# If it's not visible, enable the NVME drive:
sudo nano /boot/firmware/config.txt
# add at the bottom of the file under [all], the following:
dtparam=pciex1
dtparam=nvme
dtparam=pciex1_gen=3
# then sudo reboot, and check again if lsblk shows the nvme0n1 drive.
# Only continue if the nvme drive is visible.
lsblk
# per https://learn.pimoroni.com/article/getting-started-with-nvme-base, there are 4 ways to install the OS:
# Install a new OS using Raspberry Pi OS Desktop
# Install a new OS using using Network Install
# Clone a current microSD card with Raspberry Pi OS Desktop
# Clone a current microSD card with Raspberry Pi OS Lite
# We'll execute the 4th option, clone the sd card onto the nvme drive.
sudo dd if=/dev/mmcblk0 of=/dev/nvme0n1 status=progress
# Go to raspi-config and change the boot order to be from NVME now.
sudo raspi-config
# Advanced Options, Boot Order, NVME
# reboot
# if it boots fine, you can shut down again, then physically remove the memory card, then boot again
# you should be on the NVME drive now.
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/firmware
└─nvme0n1p2 259:2 0 29.2G 0 part /
The next challenge – expand the partition to match the NVME drive size
# We are going to expand the 29.2G partition.
sudo apt update
sudo apt install parted -y
sudo parted /dev/nvme0n1
print
resizepart 2 100%
Yes
quit
Last step, resize the file system
sudo resize2fs /dev/nvme0n1p2
lblk
df -h
We now have 448 gigs available.
df -h /