User Tools

Site Tools


raspberry_pi_3_boot_to_usb

This is an old revision of the document!


Raspberry Pi 3 Boot to USB



This is taken from the following URL: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md

I have documented it here as I use this guide a lot, and I don't want to lose it :)

  This tutorial explains how to boot your Raspberry Pi 3 from a USB mass storage device such as a 
  flash drive or USB hard disk. Be warned that this feature is experimental and may not work with
  all USB mass storage devices. 
  
  <color red>USB Hard Drives seem particularly fussy.</color>


Program USB Boot Mode


Before a Pi will network boot, it needs to be booted with a config option to enable USB boot mode. Enabling this config option requires special start.elf and bootcode.bin files. These can be installed by using the “next” branch on rpi-update.

Go to the Downloads page and install Raspbian onto an SD card using Win32DiskImager if you are on Windows, or dd if you are on Linux/Mac. Boot the Pi.

First, prepare the /boot directory with experimental boot files

If on raspbian lite you need to install rpi-update before you can use it:

sudo apt-get update; sudo apt-get install rpi-update
sudo BRANCH=next rpi-update


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 Pi with sudo reboot, then check that the OTP has been programmed with:

  vcgencmd otp_dump | grep 17:
  17:3020000a


Ensure the output 0x3020000a is correct.

If you wish, you can remove the program_usb_boot_mode line from config.txt (make sure there is no blank line at the end) so that if you put the SD card in another Pi, it won't program USB boot mode. You can do this with sudo nano /boot/config.txt, for example.

NOTE - If you use the SAME boot SD Card each time to make a bootable disk, you only need to perform the steps above ONCE

Prepare the USB storage device




sudo mkdir /mnt/target sudo mount /dev/sda2 /mnt/target/ sudo mkdir /mnt/target/boot sudo mount /dev/sda1 /mnt/target/boot/ sudo apt-get update; sudo apt-get install rsync sudo rsync -ax –progress / /boot /mnt/target

cd /mnt/target sudo mount –bind /dev dev sudo mount –bind /sys sys sudo mount –bind /proc proc sudo chroot /mnt/target rm /etc/ssh/ssh_host* dpkg-reconfigure openssh-server exit sudo umount dev sudo umount sys sudo umount proc

sudo sed -i “s,root=/dev/mmcblk0p2,root=/dev/sda2,” /mnt/target/boot/cmdline.txt sudo sed -i “s,/dev/mmcblk0p,/dev/sda,” /mnt/target/etc/fstab

cd ~ sudo umount /mnt/target/boot sudo umount /mnt/target # sudo poweroff



raspberry_pi_3_boot_to_usb.1481733137.txt.gz · Last modified: 2023/03/09 22:35 (external edit)