After owning a RPi 3 for almost a year now, I wanted to do a complete clean installation. I had installed Raspbian on a USB-stick, which was really easy at that time. I just had to write the disk image on the USB stick using "Win32DiskImager" and then I had to move the root partition to an sd card. Finally I had to change the root path in the cmdline.txt.

But however when I tried to do the same yesterday, the Pi didn't boot up.

After some research I found this. I followed the steps and almost everything worked fine. Instead of using /dev/sda2 in the cmdline.txt I had to use the partuuid of my dev partition. After rebooting and removing the sd card, I just got a black screen.

Then I found this pull request which updated the manual. After following the updated steps, I got the same result as before. The pi wasn't booting, and the green led on the board remained off.

How can I get my RPi to boot from the USB stick?


The way to boot from USB has changed. The latest raspbian image 2017-04-10 supports direct boot from USB and you just have to copy the downloaded image via dd or windisk32imager to your USB device. In the past you used an SD card to boot and then switched the root device in cmdline.txt to /dev/sda2. That's the way for Raspi1, Raspi2 and Raspi3 to boot from SD card but run everything else from USB stick. Raspi3 doesn't need the SD card any more.

There is one important step you don't have to forget when you want to use Raspi3 to directly boot from USB: You have to enable boot from USB only once in your Raspi3. It sounds you didn't do this.

You wrote you want to setup a clean system. So I suggest to execute following steps:

  1. Download the 2017-04-10 raspbian image, copy the image via dd or windisk32imager on your SD card and modify the cmdline.txt (see your first link)

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

  2. Boot the image from SD card which will enable the USB boot mode on your Raspi3 forever. Check with

    vcgencmd otp_dump | grep 17:


  3. Copy the 2017-04-10 raspbian image via dd or windisk32imager on your USB stick

  4. Plug in your USB stick,remove the SD card and reboot. Your Raspi3 should now boot from the USB stick successfully :-)

Addendum: It's also new for me the new raspian image supports direct boot from USB. I have already some Raspi3 enabled for USB boot. I was keen to know whether the new raspbian image boots from USB and I just downloaded the new raspbian image, copied it on an USB stick, plugged it in and I was able to boot from the new image via USB immediately :-)

  • FYI: before I did this operation the output of vcgencmd was 17:1020000a on my Raspi3. Apr 19 '17 at 15:54
  • I had to update cmdline.txt and fstab with the new PARTUUID as @bstipe described in his answer. Apr 19 '17 at 17:30
  • I also noticed that booting without the SD card inserted takes about 5-10 secs extra compared to using the SD for boot which then points to the USB. I guess that extra time is spent detecting the USB... Apr 20 '17 at 5:32
  • Yea. It takes some additional time to detect the USB. Is this an issue for you?
    – framp
    Apr 20 '17 at 20:17
  • Not an issue, only an inconvenience as it's nice to have the system we are building boot up as fast as possible. So I think we'll go with using SD cards for now. Apr 21 '17 at 10:50

I have not booted from a stick, but I can get you close with the following procedures, if you are running Raspbian Jessie. Get the latest updates.

$ sudo apt-get update
$ sudo apt-get dist-upgrade

$ sudo reboot

If you have not programmed the USB boot mode, now would be the time to do so, also see Program USB Boot Mode https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md for the Raspberry Pi 3.

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

With the stick installed, determine which USB sd? that you will use. In my case it would be sdb.

$ lsblk

sdb           8:16   1  14.9G  0 disk
└─sdb1        8:17   1  14.9G  0 part /media/pi/USB30FD
sda           8:0    0 931.5G  0 disk
├─sda2        8:2    0 931.4G  0 part /
└─sda1        8:1    0   100M  0 part /media/pi/boot
mmcblk0     179:0    0  29.7G  0 disk
├─mmcblk0p2 179:2    0  29.7G  0 part /media/pi/root
└─mmcblk0p1 179:1    0    41M  0 part /boot

If sdb? is mounted, unmount it. Format partitions.

$ sudo umount /dev/sdb?
$ sudo fdisk -l /dev/sdb

Disk /dev/sdb: 14.9 GiB, 16000221184 bytes, 31250432 sectors
Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1          48 31250431 31250384 14.9G  c W95 FAT32 (LBA)

$ sudo fdisk /dev/sdb

Changes will remain in memory only, until you decide to write them.

Command (m for help): o
Created a new DOS disklabel with disk identifier 0x553f5f69.

Command (m for help): n
Partition type
Select (default p): [Enter]
Partition number (1-4, default 1): [Enter]
First sector (2048-31250431, default 2048): [Enter]
Last sector (2048-31250431, default 31250431): +100M
Command (m for help): t
Hex code (type L to list all codes): c

Command (m for help): n
Select (default p): [Enter]
Partition number (2-4, default 2): [Enter]
First sector (206848-31250431, default 206848): [Enter]
Last sector (206848-31250431, default 31250431): [Enter]

Command (m for help): w
Syncing disks.

Make filesystems, directors, and mount the filesystems.

$ sudo mkfs.vfat -n boot /dev/sdb1
$ sudo mkfs.ext4 -L root /dev/sdb2

$ sudo mkdir /mnt/d1 /mnt/d2

$ sudo mount /dev/sdb1 /mnt/d1
$ sudo mount /dev/sdb2 /mnt/d2

Copy your running system to the new filesystems on the USB stick. In my case, I do not wish to copy any of the data in the Project directory. Check it when it finishes with the df command.

$ sudo rsync -axvHAXW /boot/ /mnt/d1/
$ sudo rsync -axvHAXW --exclude 'Projects/*' / /mnt/d2/

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       917G   76G  795G   9% /
devtmpfs        442M     0  442M   0% /dev
tmpfs           446M     0  446M   0% /dev/shm
tmpfs           446M  6.2M  440M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           446M     0  446M   0% /sys/fs/cgroup
/dev/mmcblk0p1   41M   21M   20M  52% /boot
tmpfs            90M     0   90M   0% /run/user/1000
/dev/sda1       100M   21M   79M  22% /media/pi/boot
/dev/mmcblk0p2   30G  3.9G   24G  14% /media/pi/root
/dev/sdb1       100M   21M   79M  22% /mnt/d1
/dev/sdb2        15G  3.9G  9.9G  28% /mnt/d2

These steps will only test that root is running on the stick. The boot will still be from your regular boot SD card (/dev/mmcblk0p1). If this does not run root on the stick, something is wrong and you can recover without much effort. The only change to the boot SD card is putting the USB stick root PARTUUID as the root device. To recover, put the orginal root device back to the boot SD card.

$ sudo cp /boot/cmdline.txt /boot/cmdline.txt.bak

Get the PARTUUID from the stick and put them in the stick boot cmdline.txt, in the stick etc/fstab, and in the Pi /boot/cmdline.txt.

$ sudo blkid /dev/sdb*

/dev/sdb: PTUUID="553f5f69" PTTYPE="dos"
/dev/sdb1: SEC_TYPE="msdos" LABEL="boot" UUID="360A-15E4" TYPE="vfat"   PARTUUID="553f5f69-01"
/dev/sdb2: LABEL="root" UUID="99c067b7-16e9-4afe-a339-0261864e958c" TYPE="ext4" PARTUUID="553f5f69-02"

$ sudo vi /mnt/d1/cmdline.txt

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=553f5f69-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles

$ sudo vi /mnt/d2/etc/fstab

proc                  /proc           proc    defaults          0       0
PARTUUID=553f5f69-01  /boot           vfat    defaults          0       2
PARTUUID=553f5f69-02  /               ext4    defaults          0       1

$ sudo vi /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=553f5f69-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles

A reboot will boot from the Pi boot SD and root will be running on the USB stick.

$ sudo reboot

$ lsblk
sdb           8:16   1  14.9G  0 disk
├─sdb2        8:18   1  14.8G  0 part /
└─sdb1        8:17   1   100M  0 part /boot
sda           8:0    0 931.5G  0 disk
├─sda2        8:2    0 931.4G  0 part /media/pi/root
└─sda1        8:1    0   100M  0 part /media/pi/boot
mmcblk0     179:0    0  29.7G  0 disk
├─mmcblk0p2 179:2    0  29.7G  0 part /media/pi/root1
└─mmcblk0p1 179:1    0    41M  0 part /media/pi/boot1

If this works and you have already added program_usb_boot_mode=1 to the end of /boot/config.txt and rebooted (sudo reboot) previous, then power off (shutdown -h now + uplug power) and remove the Pi SD card and power on should get the USB stick boot.

  • "In normal circumstances there is NEVER a need to run rpi-update as it always gets you to the leading edge firmware and kernel and because that may be a testing version it could leave your RPi unbootable". raspberrypi.org/forums/viewtopic.php?p=916911#p916911 Even the rpi-update documentation now warns "Even on Raspbian you should only use this with a good reason. This gets you the latest bleeding edge kernel/firmware."
    – Milliways
    Apr 15 '17 at 23:30
  • Note that an easier way to handle this if you're using up-to-date software and next branch bootcode.bin: put the bootcode.bin alone on a DOS partition on the SD card and everything else on the USB drive. You can do fresh installs this way, and convert old installs though you may need to tweak a few things if they mention explicit mmcblk devices, such as cmdline.txt you mention above.
    – cjs
    Apr 16 '17 at 19:13

We need to be clear on what partitions you're talking about, what you want to do, and what you might have been doing in the past.

You said that you started booting from your USB drive a year or so ago, but that's before the new boot modes entered beta and we were given a description of how to enable USB boot mode (which is disabled by default). I suspect that you were actually booting from your SD card and had your Raspbian root partition on the USB drive. I further suspect that when you say "I had to move the root partition to an sd card" you were actually moving the boot partition(s) to the SD card. (That would be an installation along the lines of these old instructions.)

Simplistically, partitions are set up in the Master Boot Record on each disk and are numbered from 1 upward. The partitions of interest to us are:

  1. The NOOBS partition (if you're using NOOBS), always partition 1 in MBR. This is a DOS partition that contains the NOOBS startup and recovery code. This is not normally mounted when running Raspbian. This may not exist if you didn't use NOOBS for your setup.

  2. The Linux boot partition. This is DOS (FAT) format partition (typically <100 MB) and contains the Linux kernel, command line options, and so on. This is normally mounted on /boot when running Raspbian.

  3. The Linux root partition. This is a Linux ext2fs format partition and is mounted on / when running Raspbian.

(Much more detailed information can be found at NOOBS partitioning explained.)

From your description of "using /dev/sda2 in the cmdline.txt" you had partition 3 above on your USB drive, but my guess, as per above is that previously you had 1 and 2 above on your SD card. Doing the same would explain why you can't boot without the SD card inserted.

What you want to do is install a system on the SD card and properly follow the steps in the bootmodes documentation to enable USB boot. Start with NOOBS on your SD card and use that to install Raspbian. (If your SD card is smaller than 8 GB the NOOBS Lite installer will save some space and may let you install full Raspbian PIXEL; otherwise install Raspbian Lite and upgrade later.) Once that's installed you can enable USB boot using program_usb_boot_mode and only then can you start setting up your USB drive, copying all the partitions over to it and removing the SD card before booting as per the instructions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.