Open main menu

Changes

NVMe SSD boot with the Raspberry Pi 5

2,202 bytes added, 19 April
no edit summary
{{GD Template Impl}}
<!--
==<span class="tb_red">READ ME before Starting</span>==
1. '''Enable PCIe''': Must make sure to '''enable PCIe in the OS on the NVME SSD you are booting''', instead of the OS on SD card. Too people just enable PCIe in the OS on the SD CARD.
Most of the content of this tutorial comes from Jeff2. '''Update eeprom firmware'''s blog: [https://www.jeffgeerling.com/blog/2023/nvme-ssd-boot-raspberry-pi-5 NVMe SSD boot with Check and upgrade the bootloader firmware to the Raspberry Pi 5], Thanks fo Jeff'''latest version''';
3. '''Set NVME boot order'''; 4. DON'T enable PCIe 3.0, '''ONLY PCIe 2.0 is supported''' by Raspberry Pi fundation. 5. If your SSD is '''OLD''' and has a '''DOS partition''', delete the DOS partition and repartition the SSD (feedback from buyer) 6. Please visit the guide below for specific operations.  '''[PS]''': The official Raspberry Pi firmware is frequently upgraded and the OS is not stable enough. It is also a challenge for us.--> This tutorial<ref>Refer to [https://www.jeffgeerling.com/blog/2023/nvme-ssd-boot-raspberry-pi-5 NVM NVMe SSD boot with the Raspberry Pi 5]</ref> describes how to configure the Raspberry Pi OS on PI 5 to get pcie pip working ==Enabling Important Notes=={{NVMe SSD Incompatibility List}} ==Enable PCIe==
By default the PCIe connector is not enabled. To enable it you should add the following option into <span class="tb_blue">/boot/firmware/config.txt</span> and <span class="tb_blue">reboot</span>:
sudo nano /boot/firmware/config.txt
Then add the following comment;
# Enable the PCIe External connector.
dtparam=nvme
Press '''Ctrl-O''', then enter, to write the change to the file.
Press '''Ctrl-X ''' to exit nano (the editor).
dtparam=pciex1_gen=3
You also can refer to official documentatio:[https<span class="tb_red_bold">WARNING:<//wwwspan><span class="tb_red">The Raspberry Pi 5 is not certified for Gen 3.raspberrypi0 speeds, and connections to PCIe devices at these speeds may be unstable.com</documentation/computers/raspberry-pi-5.html#enabling-pcie Enabling PCIe]span>
Then DON'T forgot to reboot
sudo reboot
You also can refer to official documentatio:[https://www.raspberrypi.com/documentation/computers/raspberry-pi-5.html#enabling-pcie Enabling PCIe] After reboot,use the lspci command to display your PCIe devices sudo lspciThe output is as follows, note that the content of the third line depends on the NVME control you are using. <span style="color:green;">pi@raspberrypi:</span> <span style="color:#50BEFF;">~ $</span> sudo lspci 0000:00:00.0 PCI bridge: Broadcom Inc. and subsidiaries Device 2712 (rev 21) <span class=Set "tb_red">0000:01:00.0 Non-Volatile memory controller: Silicon Motion, Inc. SM2263EN/SM2263XT SSD Controller (rev 03)</span> 0001:00:00.0 PCI bridge: Broadcom Inc. and subsidiaries Device 2712 (rev 21) 0001:01:00.0 Ethernet controller: Device 1de4:0001<span class="tb_red">If your NVMe early in SSD is not recognized, updating the boot orderbootloader firmware is essential!</span>Refer to [[How to update eeprom firmware]] to update firmware or [[#FAQ]] Q1 to know more details. ==Flash OS onto NVME SSD==The PCIe connection should work after a reboot, but To get the NVMe SSD to boot your Pi won't try booting off , it needs to have an NVMe SSD yet. For thatOS, you need so the Raspberry Pi OS needs to change the be flashed onto NVME SSDs, this is very important!  '''BOOT_ORDEROnly''' in the support Raspberry PiOS ('''Bookworm'''s bootloader configuration) version, Raspberry Pi OS bullseye or Ubuntu or Home Assistant OS is NOT supported, refer to https://www.raspberrypi.com/software/operating-systems/<pre># Edit Here are a few ways to flash the EEPROM on the Raspberry Pi 5.OS to an NVME SSD:sudo rpi-eeprom-config --edit
# Change the BOOT_ORDER line to the following:BOOT_ORDER'''1. Use <span class=0xf416"tb_red">SD Card Copier</prespan>tool to flash OS onto the NVME SSD On Raspberry Pi OS(recommended)'''
- Press Ctrl-O, then enter, to write : ''This method works if you have an SD card and have booted the change to the file.device successfully''
- Press Ctrl-X Cick '''Applications''' =>'''Accessories''' =>'''SD Card Copier''' on the main screen, run the '''SD Card Copier''' program, and copy the OS to exit nano (the editor)NVME ssd as shown in the figure below.
Read [https[File://wwwPI5-sd-copier.raspberrypi.com/documentation/computers/raspberrypng|800px]]<!--[[File:Sd-copoer-piscrot.html#BOOT_ORDER Raspberry Pi's documentation on BOOT_ORDERpng] 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 Click '''Start''' to make run. Then shut down, unplug the change take effectSD card, and restart the device.
<span class="tb_red">This is a visual operation and we highly recommend it!</span>
NVMe boot won't work unless you have the external PCI Express port enabled, and there's a working NVMe drive with a valid boot partition! If you don't have that (e.g. you used Raspberry Pi Imager with an external USB NVMe adapter to flash Pi OS to an NVMe drive from another computer), then follow the steps in the next section to clone your existing Pi OS install to an NVMe SSD.
'''2. Flash the SSD with Raspberry Pi Imager'''
To get You can also directly use the NVMe SSD to boot your Pi, it needs to have an OS. One option would be to clone an existing installation to it using ''rpi-clone'' or some other tool (see below), but my preferred option is to flash a fresh Pi OS install using [https://www.raspberrypi.com/software/ 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 the drive (connected through your adapter) to flash
# Click write (and set any options you'd like)
# Once you have finished flashing is completethe OS, pull DON'T remove the NVMe drive, attach it nvme SSD. You need to your Pi 5, and it should boot off it (with or without a microSD card inserted)—assuming you have change the config.txt in the root directory of the bootloader up NVME SSD drive to date and set the '''BOOT_ORDERenable pcie'''(<span class="tb_blue">edit config.txt and add ' appropriately!dtparam=pciex1'</span> on the end of file), this is very important and too many people forget this.
Then 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 '''Clone your microSD boot volume to an NVMe SSDBOOT_ORDER'''appropriately!
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:<prespan class="tb_red"># Install rpi-clone.git clone -b 123-nvme https'''NOTE:'''<//github.com/geerlingguy/rpi-clone.gitcd rpi-clonesudo cp rpi-clone rpi-clone-setup /usr/local/sbinspan>
If you are flashing a fresh Pi OS to NVME ssd, you must [[# Clone Enable PCIe]]; if you are COPY or CLONE an old Pi OS from SD card to NVME ssd, and you have already enabled pcie in the NVMe drive (usually nvme0n1old Pi OS in advance, but check with `lsblk`).sudo rpi-clone nvme0n1</pre>then you don't need to do enable pcie again!
==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 '''NoteBOOT_ORDER'''in the Raspberry Pi's bootloader configuration: You may want to wipe all disk partitions before cloning:<pre>sudo umount /dev/nvme0n1p?sudo wipefs --all --force /dev/nvme0n1p?sudo wipefs --all --force /dev/nvme0n1sudo dd if=/dev/zero of=/dev/nvme0n1 bs=1024 count=1</pre>
* Use tool '''raspi-config''' to set boot order
sudo raspi-config
Then select '''6 Advanced Opitions''' => '''A4 Boot Order''' => '''B2 NVMe/USB Boot''' answer '''Yes''', then <code>sudo reboot</code>
* Run the following command to set boot order.
sudo rpi-eeprom-config --edit
Then change the BOOT_ORDER line to the following:
BOOT_ORDER=0xf416
==Upgrade eeprom- Press Ctrl-O, solve NO wifi issue==After modifying the '''BOOT_ORDER''' for NVME SSDthen enter, 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 write the OS to solve this kind of problem, please pay attention change to the update of Raspberry Pi OS, if the OS upgrade can solve this problem, you can ignore this step)file.
Run the following command to wget https://github.com/timg236/rpi-eeprom/raw/pieepromPress Ctrl-2023-10-30-2712/firmware-2712/default/pieeprom-2023-10-30.bin sudo rpi-eeprom-config --edit pieeprom-2023-10-30X to exit nano (the editor).bin
It is recommended to use the latest version of the pieeprom-xxxx-xx-xx.bin file, please visit Read [https://githubwww.raspberrypi.com/timg236/rpi-eepromdocumentation/treecomputers/master/firmwareraspberry-2712/default this linkpi.html#BOOT_ORDER Raspberry Pi's documentation on BOOT_ORDER] to get for all the details. For now, the pertinent bit is the '''6''' at the latest versionend: that is what tells the Pi to attempt NVMe boot first!
'''Reboot''' your Raspberry Pi 5 to make the change take effect.
[[File:Update==Decrease wattage when turned off==By default, the Raspberry Pi 5 consumes around 1W to 1.4W of power when turned off. This can be decreased by manually editing the EEPROM configuration with <mark>'''''sudo rpi-eeprom-config -e'''''</mark>.png]]Change the settings to the following: BOOT_UART=1 POWER_OFF_ON_HALT=1 BOOT_ORDER=0xf416Then reboot: the device with <mark>'''''sudo reboot'''''</mark>, this should drop the power consumption when powered down to around 0.01W.==References==<references />==FAQ=={{X100x-FAQ}}
Return to [[X1000]] / [[X1001]] / [[X1002]] / [[X1003]]
<!--Add review function! -->