Introduction: Booting Raspberry Pi 3 B With a USB Drive
The Raspberry Pi 3 B can be booted with a compatible thumb drive without spending any money!
Note: The Raspberry Pi 3 B+ can be USB booted out-of-the-box.
Step 1: Boot Your Pi on the SD!
The Raspberry Pi 3 B+ is able to boot from USB without any changes, but the Raspberry Pi 3 requires the USB boot bit to be set in the OTP (one-time programmmble).
To enable the USB boot bit, the Raspberry Pi 3 needs to be booted from an SD card with a config option to enable USB boot mode. Once this bit has been set, 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 any SD card running Raspbian or Raspbian Lite to program the OTP bit. First, prepare the /boot directory with up to date boot files:-
sudo apt update && sudo apt upgrade && sudo reboot
Then enable USB boot mode with this 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:-
Then check that the OTP has been programmed with:-
vcgencmd otp_dump | grep 17:
Check that the output 17:3020000a is shown. If it is not, then the OTP bit has not been successfully programmed. In this case, go through the programming procedure again. If the bit is still not set, this may indicate a fault in the Pi hardware itself.
If you wish, 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. Make sure there is no blank line at the end of config.txt. You can edit config.txt using the nano editor using the command:-
sudo nano /boot/config.txt # then scroll all the way to the bottom
Step 2: After Reboot...
Now we need get a compatible USB drive that can be used to boot the Pi!
I am using a Buffalo RUF3-KS Drive because it's fast and cheap....Most of the Verbatim Drives don't work!
We now need to burn an .img to the usb drive(replace 'X' with your Storage):-
sudo dd if=/dev/sdX of="/path/to/image.img"
Do this carefully you can really screw up your computer!
Now you can shutdown your system:-
sudo shutdown now
Step 3: Booting It Up!!
Now you can remove your SD card....
After you have removed your SD card....insert the USB Drive in a USB port and power it up!
4 months ago
"Do this carefully you can really screw up your computer!"Does that mean we have to type very slow?
Reply 3 months ago
they said careful, not slow
7 months ago
I have 2 boards RPI 3B+ (for sure !!). I tried almost every thing I could find on the internet about booting from SSD with USB connection (SSD = Kingston A400).
The SSD itself works just fine. But I never managed to boot from it on both RPI's.
Everyone says booting should work out of the box, but I am probably doing something wrong. I am certainly no expert, just hobbyist trying to learn. This is the software installed on my SD card.
I also tried booting with SD card in SD card reader, that also didn't work.
I tried booting with clean Debian image on both SSD and SD card in reader, but no success there either.
I also tried complex routines that has been published at some sites.
Nothing seems to get the job done.
Can any tell me what I am doing wrong here?
Any hint would be welcome.
Reply 6 months ago
If it's a 3b+, you shouldn't need to do anything special, apart from writing the image to the drive using the raspberry pi imager. Try it with a thumb drive, if that works it's possible the drive isn't detecting when the pi powers up.
10 months ago
Though i have not tried this myself, i understand there is a problem when more than 1 usb drive is attached as the raspi will not know from which device to boot
1 year ago
Wait? What? In the distributed microSD image, file /boot/cmdline.txt points to the PARTUUID of the "/" partition on the target microSD card.
(and every microSD you dd the .img onto has the same PARTUUID, so it just works flawlessly for booting from microSD, right?)
For me, in order to boot to my sda2 partition I had to use # blkid to read the PARTUUID of the disk's sda2 partition and write that value into the PARTUUID value of the microSD's /boot/cmdline.txt file. Further, in the sda2 partition /etc/fstab the PARTUUID valuess of the sda1 and sda2 partitions had to replace the values embedded in the /etc/fstab by dd-ing the .img file for the microSD on to the hard drive.
Right now I need a stepping-stone to boot to the USB disk. The microSD's /boot partition cmdline.txt tells my pi-3+ to actually boot to "/" and "/boot" in /dev/sda USB drive.
If I remove the microSD, and power-up the Pi, it just doesn't boot. No flickering lights.
The fact that the USB boot bit is set made no difference. (btw, the /boot/cmdline.txt PARTUUID value points to /dev/sda2 as it should).
So, what am I missing? I'd love to be able to pop the microSD out, but even if I can't, at least there's no longer any wear-and-tear on it.
2 years ago
I destroyed both of my computers hard drives. Took me a while but the correct command should be:
sudo dd if=/path/to/image.img of=/dev/sdX
Reply 2 years ago
Yes, you are absolutely right that the if and of are backwards.
However, that shouldn't have damaged your drives in any way. All it would have done was filled them up with a *HUGE* image file until it ran out of free space and aborted. Deleting the file would have then restored the free space again.
Reply 2 years ago
It maybe shouldn't but the all files wore corrupt afterwards. Just wanted to point it out so other maybe could see that comment or maybe the Author could change the content.
3 years ago
Reply 3 years ago
I think if (input filter ) and of (output filter) are inverted if you want to put the image on se sd card.
Reply 2 years ago
Yes took me a while to notice this, thnx Lord_vek for destroying my computer (both of them)
Correct command is: sudo dd if=/path/to/image.img of=/dev/sdX
Please update this asap or remove your text "be careful this could damage your computer" text.
4 years ago
OK, thanks for your answer!
Question 4 years ago on Step 3
Yes, but after you program the OTP bit, can you still be able to also boot from an SD card again ?
Answer 4 years ago
Yes, because when you reboot after setting the command it still boots off the SD card. If there is no SD card installed it will boot from an attached USB drive (if bootable). If you want to switch back to an SD card just remove the USB drive and reinstall the SD card.