Posted under » Raspberry Pi on 30 Apr 2022
As of Rasbian Bookworm circa 2023, it is no longer necessary to do the below shenanigans. You just create an SSD bootdisk and plug to your USB. If no microSD card is detected, then it will boot from USB just like a normal PC.
Your Pi doesn't have a hardisk and soon your SD card will run out space. Adding a thumbdrive or a USB drive is a solution. However I prefer the latter because thumbdrives tend to corrupt after a while especially under heavy usage. Now that we have SSD, it will improve the performance significantly and it is faster too.
Note that the Raspberry Pi is a low power device. From my experience, not all unpowered USB SSD can be used reliably.
Normally, the hardisk is mounted on /mnt or /media but you may want to add the USB disk automatically using fstab under a folder that you specify, eg. /usbdrive. Use 'df -H' in conjunction with 'lsblk -f' to know the name of your USB drive
You will see the hard disk name and his location. Something like /dev/sda before it. Now you can add to your fstab at /etc/fstab.
proc /proc proc defaults 0 0 /dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 defaults,noatime 0 1 /dev/sda /usbdrive ext2 defaults 0 0
Instead of the device name, you can use the UUID. Note there are 6 fields (max) altogether.
UUID=80b496fa-ce2d /usbdrive ext4 defaults 0 2
Now make a new folder "/usbdrive" on your pi. Restart and your done. However, mounting a disk is not enough. The objective is to boot from USB that has been cloned (having the same partition) from a SD card.
But first, you need to update the firmware and you can only do this from Raspberry OS.
As SUDO run terminal or connect through SSH
$ apt update $ sudo apt full-upgrade $ vim /etc/default/rpi-eeprom-update
The default value of the FIRMWARE_RELEASE_STATUS parameter is “critical,” if pi3 which must be changed to “stable”. In Pi4 it is "default".
$ rpi-eeprom-update *** UPDATE AVAILABLE *** BOOTLOADER: update available CURRENT: Tue 16 Feb 13:23:36 UTC 2021 (1613481816) LATEST: Thu 29 Apr 16:11:25 UTC 2021 (1619712685) RELEASE: default (/lib/firmware/raspberrypi/bootloader/default) Use raspi-config to change the release. VL805_FW: Using bootloader EEPROM VL805: up to date CURRENT: 000138a1 LATEST: 000138a1
Force update if update is available.
$ rpi-eeprom-update -a
Verify whether the update was successful by typing the following command in the terminal.
$ vcgencmd bootloader_version $ vcgencmd bootloader_config
You can configure that your USB drive will boot first or boot if there is no SD card. It is under `Advanced Options'. Once you do this, go to
$ vcgencmd bootloader_config [all] BOOT_UART=0 WAKE_ON_GPIO=1 POWER_OFF_ON_HALT=0 [all] BOOT_ORDER=0xf41
It will show the boot order. Look for the last row of the result which should be 'BOOT_ORDER=0xf41'. This is important! Trivia, 0xf21 is the SD card.
You then have to prepare your USB SSD with the OS of your choice.. eg. mine is Ubuntu Server or good ol Raspberry OS.
If you are running Raspberry Pi OS, Ubuntu, Windows, use the 'Raspberry imager'. You can use Balena Etcher too. You can try Win32Diskimager which may work but I have not tried it. You need to make sure the target SSD drive is not mounted or in use.
The source image could be from your SD card that is working very well and configured to the way you want. I recommend you use the 'SD card copier' that is under the 'accessories' menu on Raspberry Pi OS or Balena Etcher.
If your SD card is 32GB and your SSD drive is 300GB, you can raspi config to the largest partition that is available on the SSD after boot if you wish. You can use Gparted to expand it too.
The thing about Raspberry Pi (4) is that it will boot only according to the format of their image, ie. one FAT32 partition containing the system-boot. You can't just use an ISO to boot. It won't work.
It will make the exact partition including the boot partition. So your SSD drive 'lsblk -f' has been transformed into something like below, assuming the drive repartioned to 100 GB.
sda ├─sda1 vfat FAT32 system-boot D7A9-3EE6 110.4M 56% /boot/firmware ├─sda2 ext4 1.0 writable 09799e9f-8009 81.3G 11% /
Once the OS image is flashed to your SSD, plug the SSD/USB to your Raspberry Pi 4.
Only after you have done all the above especially the BOOT_ORDER=0xf41 bit, remove your SDcard and reboot.
You will now be able to boot your Raspberry Pi 4 from your USB with the OS of your choice.