Have you ever wanted to boot a Raspberry Pi from USB? Well so have we and we learned how in order to teach you. In this quick tutorial we’ll walk through installing your favorite Raspberry Pi operating system on a USB stick and preparing your Pi to boot from it. We will activate USB boot mode and you’ll be on your way in no time!
Boot a Raspberry Pi from USB
Before we get down to it, let’s take just a second to understand why you might want to boot a Raspberry Pi from USB in the first place. You might be surprised, but there are several great reasons to do so.
- USB storage and flash drives are generally cheaper than SD cards at the same performance levels or better
- If you Pi is embedded into a device or build it may be difficult to get to the SD Card on the Pi, but having a remote mount USB port is easy (check out the remote ports on one of our bartop arcade cabinets)
- Using a Raspberry Pi to run a NAS, you can simply boot from the same mass storage device your sharing with your users rather than maintain an SD Card
If you’re new to the RPi, here’s a simple parts list for this project:
- Raspberry Pi Model B+*
- Micro SD Card for provisioning
- USB Thumb Drive
- Raspberry Pi Power Supply
- Raspberry Pi Case
- USB Card Reader
* Note that you can not USB boot from the original Raspberry Pi or the Zero.
Preparing the Raspberry Pi to Boot from USB
Now we will set the One Time Programmable (or OTP) bit on your Raspberry Pi.
(Note for Raspberry Pi Model 3 B+ users: you can skip to the next section of the tutorial! The USB boot bits are already set within the one-time programmable memory for these models! Lucky you!
Step 1: Install Raspbian on a Micro SD Card.The type of card and speed are mostly irrelevant as the card will not be needed after we configure the OTP memory.
Step 2: Boot the Raspberry Pi up and open a terminal window to the command line and make sure Raspbian is up to date. Almost every error we hear about is because Raspbian is not updated correctly.
sudo apt-get update sudo apt-get upgrade
Step 3: Now we can move on to programming the OTP memory to allow booting from USB. We need to make a change to the boot configuration file so that your Pi will boot up and be ready for the OTP changes.
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
Step 4: Issue the reboot command and let your Raspberry Pi restart normally.
Step 5: Verify that the OTP boot settings have been written. Open a new terminal window and enter the the following command:
vcgencmd otp_dump | grep 17:
If you entered everything correctly in step 3 you will see 17:302000a output on your screen. This confirms your Raspberry Pi is now ready to boot from USB on the next boot.
Remember to either remove this command from the /boot/config.txt or reload this Micro SD card with a fresh version of Raspbian, otherwise any Pi you place it into will have its OTP changed to USB boot.
Preparing the USB Drive for Booting your Raspberry Pi
Preparing a USB stick, hard drive, or other device to boot Raspbian is the same basic process you follow to prepare the Micro-SD card for booting. But in case this is your first time, we will walk you through quickly!
Step 1: Download the latest version of Raspbian from from the official Raspbian download page.
Step 2: Download Etcher from Balena Etcher and install it on your PC or Mac. Etcher writes images to SD Cards, and USB memory sticks. Once Etcher is installed, go ahead and launch it.
Step 3: Click select Image and select the Raspbian image you downloaded in Step 1.
Step 4: Select the drive you wish to flash (the USB stick your going to use to boot the Raspberry Pi).
Step 5: Click flash and let Etcher do its thing. This could take anywhere from 30 seconds to a minute or two. Since Etcher is free, it will show you some Raspberry Pi advertisements while its flashing the drive.
Step 6: When Etcher finishes and verifies the drive, eject it from your PC and plug it into any open port on your Raspberry Pi and plug 5v USB power to the Pi’s power input port.
Booting from USB takes about 10 seconds longer than booting from the Micro-SD Card. This is because the Pi will first look for an installed Micro-SD card, and then look for a USB boot device when one is not found. It just takes a few seconds for that process to happen. So don’t get nervous when your Raspberry Pi doesn’t boot immediately like it normally does.
That’s all you have to do to boot a Raspberry Pi from USB! Leave a comment below if you’d like to add anything you think we may have forgotten!