People usually boot Raspberry Pi from an SD card. Since you are here, it means you want to boot Raspberry Pi from your USB storage device instead of an SD Card.
Luckily, you can boot Raspberry Pi from USB because it’s a relatively cheaper and easier option. Not only that, it’s certainly easier to manage and handle a USB device than an SD card.
If you wonder how to boot Raspberry Pi from USB, read the following article describing different methods to boot your favorite operating system from the USB storage device.
Why Boot Raspberry Pi OS From USB?
Before we discuss the steps involved to boot Raspberry Pi from a USB device, let’s first evaluate the pros of this particular boot:
- Affordable storage – A USB device is undoubtedly less expensive than a microSD card.
- Fast Performance – You can significantly reduce the Raspberry pi boot time with a USB device compared to a standard microSD card.
- Extended lifespan – All of us know that a USB SSD or HDD has an extended lifespan compared to a microSD card. In other words, there are fewer chances of any hardware failure in a USB than on a microSD card.
- High-Performance – Unlike a microSD card, a USB storage device is capable of handling extensive I/O workloads.
What Do You Need to Boot Raspberry Pi OS From USB?
It’s essential to create a checklist of all the things you require:
- A Raspberry Pi 4 single-board computer.
- USB Type C power supply.
- Stable Ethernet or Wifi Internet connectivity.
- USB storage device.
- MicroSD card with a storage capacity of at least 32GB.
- Laptop or a desktop PC for SSH access or remote desktop access to the Raspberry Pi 4.
Disclaimer
This article focuses on Raspberry Pi 3 and the above models. Earlier models don’t support USB boot. Another essential thing to note here is that Raspberry Pi 4 comes with USB 3.0 ports. We all know that USB 2 ports offer a slower speed of around 60 MB/s.
Steps to Boot Raspberry Pi OS Using a USB
Before enabling USB boot mode on Raspberry Pi, you need to boot Raspbian from a microSD card. You may find it ironic; however, it’s the only way to do it.
Step 1 – Install Updates
After finishing the initial Raspbian installation, you need to update it using the following commands:
- Sudo apt-get update
- Sudo apt-get upgrade
After successfully executing the above commands, you are good to move forward to the next step.
Step 2 – Using SD Card to USB boot mode
As discussed earlier, you must have Raspbian on a microSD card to add a config option to reboot the Pi. This process sets a One Time Programmable (OTP) bit on the Raspberry Pi.
You must be wondering about the functionality of OTP to boot Raspberry Pi from a USB drive.
The OTP essentially allows the Raspberry to be booted from the USB drive. Once you enable USB boot mode, you won’t require the SDcard any longer.
To set the OTP bit on Raspberry Pi, open the terminal window in your laptop to execute the following command lines:
- Echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
The above commands have a config option “prgram_usb_boot_mode=1” at the end of the config.txt file. Next, you must reboot the Pi with the help of the following command:
- Sudo reboot
Once the reboot is complete, you must verify the OTP settings in the configuration file. Then, all you need to do is to open a new terminal window and execute this command:
- Vcgencmd otp_dump | grep 17:
If the above commands give you an output value of 17:302000a, it means you have successfully enabled the OTP bit, and you are now all set to boot the Pi from USB.
Step 3 – Remove USB Boot
You should remove the following command that you added previously to the /boot/config.txt file from the microSD card:
- Program_usb_boot_mode = 1
You can use any of these commands to edit the file:
- Sudo nano /boot/config.txt
- Sudo sed -i ‘s/program_usb_boot_mode-1//g’ /boot/config.txt
Both of the above commands lead to similar results. Furthermore, you should ensure not to leave any lie at the end of the config.txt file.
Alternatively, you can reload the latest Raspbian version. If you don’t do that, any Pi you later place in the microSD will have its OTP modified to USB Boot mode.
Step 4 – Prepare the USB Storage Device To Boot Your Raspberry Pi OS
It’s time to install Raspbian on the USB drive finally. It’s essentially the process that you follow while installing Raspbian on the SD card.
- Go to the official Raspbian website to download the latest Raspbian version.
- Open the URL: balenaEtcher – Flash OS images to SD cards & USB drives.
- Download Etcher and install it on your laptop or computer.
- Ether essentially writes images or USB flash drives and SD cards.
- Launch Etcher after installing it.
- Choose “Select Image” and open the Raspbian image that you previously downloaded.
- Next, you need to choose the USB drive to boot your Raspberry Pi.
- Lastly, click flash and let Etcher do its magic.
The entire process only takes around 30 seconds or a minute. You can enjoy advertisements while Etcher flashes the external USB flash drive.
Once Etcher completes the process by verifying the drive, you can remove the USB mass storage from the computer. Next, plug the USB in any of the spare USB ports of Raspberry Pi. In the end, power up the Raspberry Pi chip using a 5v USB power, and you are good to go.
The first time you boot a Raspberry Pi from a USB flash drive, it takes approximately ten seconds more than an SD card. It’s because Pi first searches for an installed Micro SD card and then a USB storage device if the former card isn’t found.
A pro tip: Remove the previous SD card for the Raspberry else Pi can boot from it.
Configuring Raspberry Pi 400 and Raspberry Pi 4 From USB
If you have any Raspberry Pi 4B or 400, you are fortunate because both of these boards offer USB boot support by default. It means you don’t have to follow any of the instructions written in the above guide.
However, you need to update your Bootloader if you use an older version of the Raspberry Pi 4B board.
How to Update Raspberry Pi Bootloader?
Let’s use both graphical and command-line methods to update the Raspberry Pi Bootloader using Pi 400 Imager.
Using raspi-config
First, you need to update the operating system firmware using the following commands in the same order:
- Sudo apt update
- Sudo apt full-upgrade
- Sudo rpi-update
Next, make sure to reboot Raspberry Pi. After that, you need to update the Pi bootloader EEPROM for Raspberry Pi 4B to enable USB storage boot. If you have an older Raspberry Pi 4B, you can update the bootloader using the following command:
- Sudo rpi-eeprom-update -d -a
After executing the command, you need to reboot Raspberry Pi again. To enable USB boot mode, you need to use the following command to launch raspi-config.
- Sudo raspi-config
Within the raspi-config tool, you need to select “Boot options” and go to “Boot ROM Version.” Next, click on “Update” and press the OK button using the up and down keys.
If you see a message asking you to reset boot ROM to default, you should only select the “No” option. Next, go to “Boot Order” and select “USB Boot.” Finally, click OK to confirm your selection.
Lastly, choose “Finish” and again “No” if it prompts you to reboot at this stage.
Using Image
This method is relatively more straightforward than the one explained earlier. All you need to use the Raspberry Pi Imager to update the Pi bootloader:
- Go to the official Raspberry Pi Imager website to download the latest Raspberry Pi Imager version.
- Once the download is complete, you need to use another micro SD card in the following steps.
- Next, you need to launch the Raspberry Pi Imager.
- Go to the Operating System option and select the Misc utility images.
- Now, select Bootloader and choose USB.
- In the last step, select the storage you prefer to use later and write on it.
Conclusion
Raspberry Pi boot from the USB is an intelligent choice because it’s convenient and faster. Whether you have an old Pi or a newer version, USB storage serves as an efficient boot device.
The above guide elaborates all the steps in great detail, allowing you to boot the Raspberry Pi from your USB SSD drive instead of a micro SD card.