The Raspberry Pi 4 is now capable of booting from a USB Flash drive without requiring an SD card to kick-start the process. Here’s how you set it up.
If you’ve read my post on booting from a USB stick, you’ll know that this is a big step forward. While you could previously use a USB disk as your primary Pi storage, you still needed to have an SD card fitted too.
No longer. Changes made to Raspberry Pi OS back in August and to the bootloader code stored in the Pi’s EEPRom mean that you can boot a Pi 4 straight from the USB stick, though you’ll need to start out with an SD card because that’s the default.
Here’s what I did to try it out. I’ve included all the steps I took, but you may want to modify the procedure slightly if, for example, you want to copy your existing storage to the stick. You can find out how to do that in my previous post.
- Write Raspberry Pi OS to your USB disk. I used the steps below; you might want to try Raspberry Pi OS Imager.
- Plug the USB disk into your computer.
- Determine the USB’s file name, eg.
disktuil liston a Mac.
- Download the OS and unzip it to get the
.imgfile. I usually rename it to
pi.imgto make the next step easier.
- Write the
.imgto the stick, eg.
sudo dd if=pi.img of=/dev/rdisk2 bs=1m
- When it’s done, eject the drive.
- Boot your Pi as normal.
- Plug in the USB disk.
- Do the usual
sudo apt update && sudo apt upgrade -yto make sure your OS is up to date.
rpi-eeprom-config. If this fails, your OS is not up date.
- Look for the line beginning with
BOOT_ORDER. This setting controls how the bootloader moves through devices in search of a usable OS. It will probably say
0x01is the code for ‘attempt to boot from the SD card’. We need to change this to include the USB disk code,
sudo -E rpi-eeprom-config --editto open the settings file in your text editor.
- Change the
0x41— ie. so that the line reads
BOOT_ORDER=0x41— in order to add USB booting to SD. I suggest keeping SD boot in case you need to switch back at any time.
- Quit your text editor and save the changes.
- I did a reboot and then shutdown the Pi before I removed my SD card, but you should be able to just shut down, remove the card and restart.
- The Pi will now boot from the USB drive and go through the usual disk resizing and desktop setup wizard.
- You can re-insert your SD card and copy data files from the newly inserted removable drive to the USB disk. Look in the
rootfsfolder for your previous home folder, eg.
- Eject the SD card safe as a back-up.
At this point you have a new OS install, so you’ll need to reinstall any apps that you want to use, Git repos that you have cloned and so forth. For me, it’s easier to start from scratch, but you might prefer to mass-copy across content from your SD card or a previous USB disk.
If you do, there are some potential gotchas. Here’s one: my previous UBS storage lacks a
/boot directory because that’s on the SD card, but the new stick does have it. And don’t forget that it’s a separate, FAT32 partition, not a simple directory. You’ll need to add this partition if you want to start the boot process from the USB disk.
It’s easy when copying large volumes of files using a tool like rsync to get overwrite files that you shouldn’t. Be very careful.
Don’t forget though that once you have the files you want on your USB disk, you can take an image of it using dd as a back-up, just as you may have done with your SD card.