Connect with us

How To

How to Boot Your Raspberry Pi from a USB Mass Storage Device?



Raspberry Pi USB Boot

Raspberry Pi boots from the microSD card by default, But since the release of the Raspberry Pi 3, the new Pis has the ability to boot from the USB mass storage device as well. It is also an easy thing to do, and this article explains to you how to boot the Raspberry Pi from the USB mass storage device such as the flash drive or USB hard disk. Beware that the new boot mode is in its experimental stage, so it might not work with the USB stick or hard drive. This problem happens due to the USB compatibility issue, this only affects some of us, but the next warning that you get may relevant to you: Setting the boot mode is permanent. With that said, this sounds much scarier than it is: Your Pi will still boot preferentially from the microSD card if one is plugged in. Check out below to know how the Raspberry Pi USB Boot can be done.

Raspberry Pi USB Boot
Raspberry Pi USB Boot

Related: How to SSH into the Raspberry Pi?

Raspberry Pi USB Boot

Program USB Boot mode

The Raspberry Pi 3+ has the ability to boot from the USB without any changes. Raspberry Pi 3 needs the USB boot bit to be set in the OTP (one-time programmable) memory. If you are using the Raspberry Pi 3+, Please move on to the next section.

To enable the USB boot bit, the Raspberry Pi 3 requires to be booted from the SD card with the config option to enable USB boot mode.

Once the bit has been set, then the SD card is no longer required. Note that any change you make to the OTP is permanent and cannot be undone.

You can use the SD card running Raspbian or Raspian Lite to program the OTP bit. If you don’t have such SD card then you can install the Raspbian or Raspbian Lite in a regular way.

Raspberry Pi USB Boot
Raspberry Pi USB Boot

Now, prepare the /boot directory with up to date boot files (this step is not needed if you are using the 2017-04-10 release of Raspbian/Raspbian Lite or a later one).

sudo apt-get update

sudo apt-get upgrade

Then enable USB boot mode with the following code:

echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt

This adds program_usb_boot_mode=1 to the end of /boot/config.txt. Reboot the Raspberry Pi with sudo reboot, then check that the OTP has been programmed with:

vcgencmd otp_dump | grep 17

The output contains the value 3020000a.

Just check the output 0x3020000a is shown. If it is not, then the OTP bit has not been successfully programmed. In this case, just go through the programming procedure again. If the bit is still not set, this may indicate the fault in the Pi hardware itself.

If you want, you can remove the program_usb_boot_mode line from config.txt, so that if you put the SD card in another Raspberry Pi, it won’t program USB boot mode. Just make sure that there is no blank line at the end of the config.txt. You can edit the config.txt with the help of nano editor using the command sudo nano /boot/config.txt. for example.

Before Raspberry Pi USB Boot, always ensure to Backup Raspberry Pi.

Preparing the USB mass storage device

Starting with the 2017-04-10 release of the Raspbian OS you can install a working Raspbian system to the USB mass storage device by copying the operating system image directly onto the USB device, in the similar way, that you would for the SD card. To do this step, follow the instruction here, remembering to select the drive which corresponds to the USB mass storage device.

Once you have completed imaging the USB mass storage device, remove it from your system and then insert it into the Raspberry Pi.

Raspberry Pi USB Boot
Raspberry Pi USB Boot

Related: How to watch Netflix on Raspberry Pi?

Boot up the Raspberry Pi from your USB mass storage device
Then attach the USB mass storage device to your Raspberry Pi, and power the Pi up. After five to ten seconds, the Raspberry Pi will begin booting and shows the rainbow splash screen on the attached display.

Note: if the USB boot bit is set, then you don’t need to insert an SD card into the Raspberry Pi for USB boot to work.

This is how Raspberry Pi USB Boot happens. Thank you for reading this post.