Boot Pi OS from USB
Raspberry Pi OS boot and install from USB SSD / MSD
This is on a Raspberry Pi 4 (8GB) board. I have a USB enclosure with a NVMe SSD. It would be great to boot from it instead of a small microSD card. I also plan to install multiple OS's on it though only installed Pi OS only right now. Here is how to boot from USB massive storage device (MSD).
Boot from USB SSD / MSD
This is not hard and slightly different with the new Pi 4 board. Just need to follow this <a href="https://www.tomshardware.com/how-to/boot-raspberry-pi-4-usb">excellent guide on Tomshardware</a>, in the exact way to ensure easy success.
First the first, I still need a Pi OS installed and running from NOOBS or even better, the plain image. We need to update the firmware under it. And the plain image is needed anyways.
Once you get the latest plain Pi OS image https://www.raspberrypi.org/downloads/raspberry-pi-os/. You can use <a href="https://www.raspberrypi.org/downloads/">Raspberry Pi Imager</a> to put it on a SD card. Maybe it can write to your USB SSD directly. I didn't try. You can pick either of the plain Pi OS image, just don't get the NOOBS image. Lite image is smallest, desktop image is medium and can still be put on a 4GB SD card (the size doesn't matter if you know how to write it to USB SSD directly), and the full image takes double the time to download. I don't see the Pi Imager saves the image file anywhere. So I prefer to download manually.
Another reason to keep the image file is I already installed the OS on NOOBS microSD card come with the kit I bought. And I found it is more handy to do it on Pi OS than a PC with Windows. wget downloaded the image much faster than web browser on Windows. It is also easy to use command line to burn the image:
lsblk # it shows the device for your USB SSD, such as /dev/sdb sudo dd if=2018-11-13-raspbian-stretch-lite.img of=/dev/sdb bs=4M conv=fsync
After the image is copied, two partitions will be created on the SSD and could be mounted automatically under:
We need to download the .dat and .elf files from <a href="https://github.com/raspberrypi/firmware/tree/a6c9b6b48ce86ef2527586a50760d52f1b33f642">firmware release from May 22</a> and copy them to the
/media/pi/boot directory. Otherwise it will hit error saying newer software is needed when booting up. You can use wget to download from the raw link to the files. Totally 16 files with similar names. It is easy to reuse the wget command line while slightly change the file name.
Then update the firmware to the version dated 2020-05-15 following the Tomshardware guide. Newer firmware normally works too. The 06-15 one is what I am using. It is also the latest stable one.
sudo nano /etc/default/rpi-eeprom-update # Change it to "stable" and save. FIRMWARE_RELEASE_STATUS="stable" sudo rpi-eeprom-update -d -f /lib/firmware/raspberrypi/bootloader/beta/pieeprom-2020-06-15.bin # Reboot and confirm firmware version shutdown -r 0 vcgencmd bootloader_version # Shutdown to remove microSD card halt
Now you can shutdown, power off, remove the microSD card and boot to USB SSD. Once boots up, it will resize the ext4 partition to cover the whole SSD. You then go through the short setup steps and update process of several minutes to get the OS finally running. You can get more applications to make it same as the full Pi OS image.
Use BerryBoot to install multiple OS
BerryBoot V2.0 http://www.berryboot.com/" is a great tool for this. It boots up kernel and a tiny system running the app to let you install multiple OS. Just need one little tweak.
Create a small fat32 partition as the first partition on your USB drive.
Get the current <a href="https://downloads.sourceforge.net/project/berryboot/berryboot-20200612-pi4.zip">berryboot-20200612-pi4.zip</a>
Unzip it onto the fat32 partition you created before.
Now the trick:
~$ blkid /dev/sda1: LABEL_FATBOOT="boot" LABEL="boot" UUID="'''70A2-8001'''" TYPE="vfat" PARTUUID="b9061a63-01"
Modify the cmdline.txt in the boot partition, add bootdev= with the UUID above so it is like:
bootdev=UUID='''70A2-8001''' elevator=deadline quiet bootmenutimeout=10
Flush the latest stable firmware that enables USB boot as above. Once it is done, run
sudo halt, turn off power, take out microSD card, keep USB drive plugged, and power on. It should boot up correctly and start Berryboot tool now.
Use PINN to install multiple OS
PINN https://github.com/procount/pinn">is another great tool, very similar.
PINN shows USB boot support in the changelog. I got the zip file, unzip it to the fat32 partition on SSD, but it can't boot from USB SSD. I only see the rainbow square screen.
From the files in PINN I see it is using recovery style image. BerryBoot is using OS image. Theoretically they should both be able to work if crafted to load kernel and initrd ramdisk image correctly from the boot device. Maybe something is still not right.
I also tried the NOOBS image. The first partition is for recovery and the recovery image failed to load. It complains about missing fixup4rc.dat which doesn't exist. Maybe this is the reason we still need those files dated 05-22 as in the guide from Tomshardware.