Pinterest Stumbleupon Whatsapp

The Raspberry Pi (CA, UK) is a great, versatile piece of kit, capable of projects as diverse as running a media center to use as a broadcast radio. But it has one glaring flaw: the inability to boot from USB.

Well, until now, that is.

Raspberry Pi 3 Shot by MakeUseOf

If you’re using a Raspberry Pi 3 The Raspberry Pi 3: Faster, Better, with Wi-Fi and Bluetooth The Raspberry Pi 3: Faster, Better, with Wi-Fi and Bluetooth Today, the Raspberry Pi foundation announced the release of the Raspberry Pi 3. It's the most significant update to the popular line of low-cost computers yet. Read More , it is now possible to forego booting from microSD and instead boot the computer from a USB device. This might be a flash stick, an SSD with a USB adaptor, or even a full sized USB hard disk drive. This is a significant development, so let’s take a look at how you can setup your Raspberry Pi 3 to boot from USB.

Get Started: Install Raspbian and Add New Files

It’s best to start this project with a fresh copy of Raspbian, so download the latest version (we’re using Raspbian Jessie 5 Ways New Raspbian Jessie Makes Raspberry Pi Even Easier to Use 5 Ways New Raspbian Jessie Makes Raspberry Pi Even Easier to Use Following the release of Debian Jessie in July, the Raspberry Pi community has been blessed with a new release of the Raspbian variant, based on the "parent" distro. Read More ) and install it in the usual way How To Install An Operating System To Your Raspberry Pi How To Install An Operating System To Your Raspberry Pi Here's how to get a new OS installed and running on your Pi – and how to clone your perfect setup for quick disaster recovery. Read More . As soon as this is done, safely remove the card from your PC, insert it into the powered-down Raspberry Pi and boot, remote connecting over SSH Setting Up Your Raspberry Pi For Headless Use With SSH Setting Up Your Raspberry Pi For Headless Use With SSH The Raspberry Pi can accept SSH commands when connected to a local network (either by Ethernet or Wi-Fi), enabling you to easily set it up. The benefits of SSH go beyond upsetting the daily screening... Read More as soon as it loads up.

Sign in (unless you’ve changed your default credentials Securing Your Raspberry Pi: From Passwords to Firewalls Securing Your Raspberry Pi: From Passwords to Firewalls Anyone can use Google to find the default username and password of your Raspberry Pi. Don’t give intruders that chance! Read More ) then run the following commands, which will replace the default start.elf and bootcode.bin files with freshly downloaded alternatives:

sudo apt-get update

sudo BRANCH=next rpi-update

This update delivers the two files into the /boot directory. With the files downloaded, proceed to enable the USB boot mode with:

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

This command adds the program_usb_boot_mode=1 instruction to the end of the config.txt file.

Linux Terminal Boot Raspberry Pi 3 With USB

You’ll need to reboot the Pi once this is done.

Next step is to check that the OTP — one-time programmable memory — has been changed. Check this with:

vcgencmd otp_dump | grep 17:

If the result is representative of the address 0x3020000a (such as 17:3020000a) then all is good so far. At this stage, should you wish to remove the program_usb_boot_mode=1 line from the config.txt file, you can. The Pi is now USB boot-enabled, and you might wish to use the same microSD card in another Raspberry Pi 3, with the same image, so removing the line is a good idea.

Linux Terminal Boot Raspberry Pi 3 With USB Nano Edit

This is easily done by editing config.txt in nano:

sudo nano /boot/config.txt

Delete or comment out the corresponding line (with a preceeding #).

Prepare Your USB Boot Device

Next, connect a formatted (or ready-to-be-deleted) USB stick into a spare port on your Raspberry Pi 3. With this inserted, we’ll proceed to copy the OS across.

Begin by identifying your USB stick, with the lsblk command.

Linux Terminal Boot Raspberry Pi 3 With USB LSBLK Command

In this example, the SD card is mmcblk0 while the USB stick is sda (it’s formatted partition is sda1). If you have other USB storage devices connected the USB stick might be sdb, sdc, etc. With the name of your USB stick established, unmount the disk and use the parted tool to create a 100 MB partition (FAT32) and a Linux partition:

sudo umount /dev/sda

sudo parted /dev/sda

At the (parted) prompt, enter:

mktable msdos

You might be informed that the disk is otherwise engaged. If so, select Ignore, then note the warning instructing you that the data on the disk will be destroyed. As explained earlier, this should be a disk that you’re happy to delete or format, so agree to this.

If you run into any problems here, you might need to switch to the desktop (either manually, or over VNC How to Run a Remote Desktop on Raspberry Pi with VNC How to Run a Remote Desktop on Raspberry Pi with VNC What if you need access to the Raspberry Pi desktop from your PC or laptop, without having to plug in a keyboard, mouse and monitor? This is where VNC comes in. Read More ) and confirm the disk is unmounted, before entering the mktable msdos command in a windowed command line.

Proceed in parted with the following:

mkpart primary fat32 0% 100M

mkpart primary ext4 100M 100%


This will output some information concerning disk and the new partitions. Proceed to exit parted with Ctrl + C, before creating the boot filesystem, and the root filesystem:

sudo mkfs.vfat -n BOOT -F 32 /dev/sda1
sudo mkfs.ext4 /dev/sda2

You then need to mount the target filesystems, before copying your current Raspbian OS to the USB 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

That last one is the final command that copies everything over, and so will take a while to complete. Time to make a coffee!

Linux Terminal Boot Raspberry Pi 3 With USB Copying

Next, you need to refresh the SSH host keys, to maintain the connection with the reconfigured Raspberry Pi after an imminent reboot:

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
sudo umount dev
sudo umount sys
sudo umount proc

Linux Terminal Boot Raspberry Pi 3 With USB SSH

Note that after sudo chroot (the fifth command above) you’re switching to root, so the user will change from pi@raspberrypi to root@raspberrypi until you enter exit on line 8.

Prepare for Rebooting From USB!

Just a few more things to sort out before your Raspberry Pi is ready to boot from USB. We need to edit cmdline.txt again from the command line with:

sudo sed -i "s,root=/dev/mmcblk0p2,root=/dev/sda2," /mnt/target/boot/cmdline.txt

Similarly, the following change needs to be made to fstab:

sudo sed -i "s,/dev/mmcblk0p,/dev/sda," /mnt/target/etc/fstab

You’re then ready to unmount the filesystems before shutting down the Pi:

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

Note that this uses the new poweroff command as an alternative to shutdown.

When the Pi has shutdown, disconnect the power supply before removing the SD card. Next, reconnect the power supply — your Raspberry Pi should now be booting from the USB device!

Have you tried this out? Intrigued by the possibilities of a USB boot rather than from SD card? Planning to give it a go? Tell us in the comments!

  1. Oliver
    January 18, 2017 at 9:13 pm

    How ever has done this - Many Thanks - It works great - The first script which worked perfectly. Booting from a 32 GB USB Stick

    • Christian Cawley
      January 22, 2017 at 8:45 am

      Excellent, have fun with it!

  2. Senor CMasMas
    January 13, 2017 at 10:20 pm

    Great instructions!
    First USB boot worked like a charm!

    I am running this on a SanDisk Extreme 3.0! Even though I am only getting 2.0 speeds, the performance is astounding.

    • Christian Cawley
      January 22, 2017 at 8:44 am

      Great to hear!

  3. Ram Sambamurthy
    January 13, 2017 at 9:58 am

    Hi. By setting the OTP to boot from USB, does this mean that booting from the MicroSD will not be an option after that?

    • Christian Cawley
      January 13, 2017 at 11:00 am

      You would think so from the term OTP, BUT I've successfully booted from microSD since.

      • Ram Sambamurthy
        January 14, 2017 at 1:32 am

        christian, thanks for confirming.
        yes you're right, it's easy to assume that it won't be able to, especially from the point of view of why would the Pi guys not enable it by default. the One Time Programming thingy about some capacitor that has to be blown to enable USB boot made me think that it may be an irreversible process that changes the boot process to only USB bootup.
        this article did mention in the boot sequence involving the SD first and then USB, but was not conclusive for me.
        once again, thanks for confirming.

  4. Roy Sieliakus
    January 6, 2017 at 10:15 pm

    Did exactly like you wrote, never got an error, so i thought, no problems piece of cake..
    But it does not boot from usb, and also not from sd card anymore.. :(
    Using a sandisk cruzer 16Gb. added the file 'timeout' to the usb, but nothing..

    How do i get my raspberry up and running again??

    • Roy Sieliakus
      January 7, 2017 at 12:05 am

      Got it,
      apparently it needs a wired lan connection, in stead of just wifi.
      I do not know why, but that is the only thing that has changed.
      For now i have it running on the USB.
      Thank you for the tut..

    • Roy Sieliakus
      January 7, 2017 at 12:08 am

      Got it,
      Apparently it needs a wired lan connection because with wired lan it boots up from usb.
      Why?? i have no idea because wifi is stil working.

      Anyway thanks for the tut!!

  5. geof
    January 4, 2017 at 7:25 pm


    Really nice article.

    I have followed the instructions exactly as stated. Everything is fine until I exit from the chroot command and enter

    sudo umount dev

    and get the following response:

    Umount: /mnt/target/dev: target is busy

    How do I solve this?

    Any help would be appreciated.

  6. Jan Paulussen
    January 1, 2017 at 3:14 pm

    The command to mount the new partitions from the USB start with:
    "sudo mkdir /mnt/target"
    But it should be:
    sudo mkdir -p /mnt/target (the parameter -p is the difference!)
    This is because the parent directory /mnt does not exist at that time yet, and I got an error because of that saying it cannot create the subdirectory.
    By adding the parameter it did work. It then is not necessairy to add it the second time, bacause there the /mnt directory does already exist.
    I hope this helps...
    PS: Thanks for the great instructions!

  7. Pete
    December 29, 2016 at 12:35 pm

    The procedure worked fine for me except the two "sed" steps at the end.

    /mnt/target/boot/cmndline.txt - Instead of "mmcblk0p2", mine was "mmcblk0p7"

    /mnt/target/etc/config - /boot and / had different "mmcblk0p6" & "mmcblk0p7" which I changed to /dev/sda1 & 2

    Hope this helps someone else.

  8. Nidde Nedelius
    December 28, 2016 at 8:01 pm

    I managed to get it working once.
    Excited I started setting up my webserver and such, using this script:
    But afterwards, the Pi won't boot from USB. I can put the SD-card back in and boot from that fine.
    So I tried to run the install-script before setting up the USB-boot, so that everything would already be installed and I wouldn't have to do any apt-get upgrade or similar after duplicating the system, but to no success.
    I even tried switching the firmware back to master, then back to next again, to see if that would overwrite something that got messed up by the script, but still no luck.

    Any advice?

  9. Paul Smith
    December 19, 2016 at 2:37 am

    I have been getting stuck at this point every time.

    pi@Pi-3:/mnt/target $ sudo chroot /mnt/target
    chroot: failed to run command ‘/bin/bash’: No such file or directory
    pi@Pi-3:/mnt/target $

    I have tried many times. Used 2 new USB drives. And same problem every time.
    Everything runs smoothly up until this point.
    Raspian Jessie (Pixel) latest updates. New install on sd card with Alexa installed.Nothing else.

  10. Rolf
    October 26, 2016 at 7:04 am

    I just updated and upgraded the Raspberry PI 3 with USB Boot and the Update reinstalls the original Kernel. The Raspberry will not boot anymore from USB...
    Is there a workaround eventually completing your famous tutorial? Or just avoid any Upgrade!

    • kikret
      December 9, 2016 at 12:36 pm

      very good questions, i will also want to know

  11. Rol
    October 25, 2016 at 1:09 pm

    PI 3 with a 120 GB Stick
    Simply great. Works like a charm.
    Many thanks for this, I guess, the only really working tutorial

    • Christian Cawley
      October 26, 2016 at 6:46 am

      Delighted it worked for you, Rol!

  12. William
    October 16, 2016 at 1:27 pm

    This worked like a charm! At first, I thought things were awry, because it stays on the RaspPi rainbow boot screen. But, after what seemed like forever to us antsy types, it booted without a hitch the first time I tried it! GREAT TUTORIAL!!!

    • Christian Cawley
      October 26, 2016 at 6:46 am

      Thanks for sticking with it, William!

  13. John Douglas
    October 6, 2016 at 11:56 pm

    Great article. I followed the instructions implicitly (I think :) ). When I rebooted the RP1 3 I go these messages:
    [3.437232] USB 1-1.4.4: Unable to get BOS descriptor.
    [4.439885] SD 0:0:0:0: [SDA] Asking for cache data failed
    [4.440070] SD 0:0:0:0: [SDA] Assuming drive cache: write trough

    Can any body help with this please?

    • Christian Cawley
      October 7, 2016 at 9:20 am

      This seems like a problem with the USB device. Have you tried a different flash device?

      I used this:

      • John Douglas
        October 7, 2016 at 9:54 am

        I am using a WD 500 Gb sata drive mounted in an external hdd usb case with it's own power supply. Maybe I'll have to replace the drive?

        Thanks for your reply, kind regards John

        • Christian Cawley
          October 7, 2016 at 11:25 am

          I suspect it's how the drive is being recognized.

          If you can get this to work with a standard USB flash drive, then you know the new feature works. After that, it's a case of finding a USB adaptor for your HDD that offers the right compatibility

  14. Jeff Johnson
    September 21, 2016 at 2:13 am

    Thanks so much much this worked brilliantly. Great work, I had a pi3 and a 1 tb pidrive working on raspbian jessie. Ran flawlessly I had issues installing a touch screen and will have to redo at some point. Can I do this on Openelec Kodi 15.2? I'm trying to make a large capacity stand alone portable music player I would like to boot into Openelec on a the piDrive and use a small lcd to control the who;e thing. I'm piecing the portable power supply after the software and hardware are done. Willing to try anything once all ideas welcome can always format and start over.

    • Christian Cawley
      October 7, 2016 at 9:17 am

      I don't believe it will work beyond Raspbian at this stage, but would expect support for it to be included in future distro updates.

  15. Pierre
    September 17, 2016 at 8:25 pm

    Puneet: Did you remove the SD-card as mentioned above?

  16. john
    September 17, 2016 at 2:36 pm

    works well. but pi 3 is very picky on the USB memory you use.
    does not work with all USB sticks.

  17. Puneet
    September 11, 2016 at 7:39 am


    I tried your step by step process, it's still booting from SD card and not from USB.
    I think Raspberry is programmed to boot from SD card and unless we change the BIOS of raspberry and program it to boot from SD card as well as USB, it's not going to work.


    • Christian Cawley
      September 18, 2016 at 7:10 pm

      That's the whole point of the tutorial, which is based on instructions from the official Pi website. It's not like we've made this up, it actually works, on a Pi 3.

      Please make sure you double check your steps, and remember to run vcgencmd otp_dump | grep 17: - if this gives the correct result, the necessary switch has been made.

      • Bert Shure
        October 11, 2016 at 9:09 am

        Very cool!

        How about mirroring two USB Flash drives?

Leave a Reply

Your email address will not be published. Required fields are marked *