In this Raspberry Pi boot from USB guide, we will be showing you how it is possible to boot your chosen operating system from a USB storage device instead of the standard SD card.
We will walk you through the steps required to activate the USB boot mode in the one-time programmable (OTP) memory. You will need a newer Raspberry Pi to complete this tutorial correctly (see below).
There are various reasons why you might want to utilize a USB storage device to boot from instead of an SD Card. One of these reasons is just how much cheaper USB storage tends to be SD Cards. The other is that they tend to be easier to deal with when needing to swap out storage devices often.
Please note that this guide will only work with the Raspberry Pi 2B v1.2 and the Raspberry Pi 3B, 3B+, 3A+. Older Raspberry Pi’s sadly lack the ability to boot from the USB.
You will need the following equipment for this guide on booting your Raspberry Pi from a USB storage device.
Micro SD Card if you’re using a Raspberry Pi 2, 3 or B+
Setting up the Raspberry Pi for USB Booting
Before you begin, make sure that you are following this tutorial on aRaspberry Pi 3B, 3B+, 3A+ or aRaspberry Pi 2B v1.2. Other models of the Raspberry Pi do not properly support USB boot.
If you have a Raspberry Pi 3B+, you can skip to the next section of the tutorial as the USB boot bits are already set within the one-time programmable (OTP) memory on the device.
1. To begin this part of the guide, you will need to start off with an SD card with Raspbian installed.
For the purposes of this guide, you can just use Raspbian Lite as we only need the command line.
2. Once you have your Raspberry Pi booted up into the Raspbian operating system go ahead and enter the following command into the terminal.
These commands will ensure that the Raspberry Pi is entirely up to date and has all the features that we require.
sudo apt-get update sudo apt-get upgrade
3. With Raspbian up to date, we can now enter the following command into the terminal.
This command writes the text program_usb_boot_mode=1 to the boot configuration file so that when the Raspberry Pi boots up, it knows that it needs to write data to the OTP for USB boot mode.
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
4. With the correct data added to the /boot/config.txt file we need to restart the Raspberry Pi by running the following command.
5. Once the Raspberry Pi has finished rebooting, we can verify that the OTP has been written to by running the following command.
We utilize the Raspberry Pi’s vgencmd tool to provide a dump of the OTP, and from the result of this, we use grep to see if the text 17: can be found within the returned data.
vcgencmd otp_dump | grep 17:
6. If everything has worked correctly, you should see the following text appear in your command line from the previous command.
7. Now before we go and move onto setting up our USB with Raspbian, we will remove the line that we added earlier to the config file by running the following command.
sudo sed -i 's/program_usb_boot_mode=1//g' /boot/config.txt
Booting the Raspberry Pi from a USB
1. Setting up a USB for your Raspberry Pi is extremely simple to do, and it’s just like installing Raspbian to an SD Card, instead of selecting your SD Card reader you will choose the USB storage device that you want to format.
Below we will do a quick run through of using Etcher to write to your USB device.
2. Start off by grabbing the version of Raspbian that you want your Raspberry Pi to boot from your USB device.
You can find all three versions of the operating system by going to the Raspbian download page. Download the version that best suits your needs.
3. Now that you have the image that you want, you will need to grab Etcher to be able to write the image to your USB device.
You can find the download for the Etcher tool by going to Etchers websitse.
4. Once you have Etcher downloaded and installed to your computer, launch it and press the Select Image button.
Within this menu browse to where you downloaded your copy of Raspbian and select it.
5. Next, click the Select Drive button. In the prompt that appears find your USB storage device that you want to use as your boot drive for the Raspberry Pi and click the “CONTINUE” button.
6. Finally, click the Flash! button to begin the flashing process. This process can take some time.
Once completed, take out your USB Drive and place it into a USB port on your Raspberry Pi.
7. You should now be able to start up your Raspberry Pi without having an SD card placed in it. The Raspberry Pi should automatically utilize your USB as the boot device.
Please note that it can take the Raspberry Pi ten to twenty seconds for it to pick up the USB device and begin the process of booting from it, so don’t be alarmed if you have longer boot times.
I hope this Raspberry Pi boot from USB tutorial has shown you how easy it is to set up your Raspberry Pi so that it can boot the operating system from a USB storage device instead of the Micro SD Card.
If you have any feedback on this guide on booting from a USB device, then feel free to post a comment below.