In this blog, we will learn how to boot Raspberry Pi from USB. We will be showing how to change configurations in Raspberry Pi to boot from the flash drive or USB hard disk.
We will go step by step to activate the USB boot mode and this will work with Raspberry Pi 4B/3B/3B+/3A+ and 2B only. The Raspberry Pi USB boot mode is sometimes required when you don’t want to microSD cards and this can be used in your projects where you need more space or memory.
What you need:
- Raspberry Pi
- MicroSD card
- Power supply
- USB storage device
- Raspberry Pi Case
- Keyboard and Mouse
Raspberry Pi USB boot mode settings
1. First of all, you will need a MicroSD card preloaded with Raspbian.
2. Power on the Raspberry Pi and the Pi will start to boot in the Raspbian operating system.
Now we have to update the Raspberry Pi using the following commands:
sudo apt-get update
sudo apt-get upgrade
echo program_usb_boot_mode
=1
| sudo tee
-a
/boot
/config
.txt
This will add program_usb_boot_mode=1 to the end of the config.txt file.
4. Reboot the Raspberry Pi using the command:
sudo reboot
5. After rebooting, we have to check that the OTP has been written successfully by using the following command:
vcgencmd otp_dump | grep 17:
if everything was done properly, you will see the output:
17:3020000a
If it is not, then the OTP bit has not been successfully programmed. In this case, repeat the same process again. If still bit is not set, then may there is a fault in the Raspberry Pi hardware.
Note: If you wish to remove the program_usb_boot_mode line from the ‘config.txt’ file, so that if you put the SD card in another Raspberry Pi, it won’t program other Raspberry Pi in USB boot mode.