Boot Raspberry PI (2 or 3) from a USB Stick

Update: Works with the Raspberry PI 2

I have a tendency to get busy on stuff when I'm under pressure for some completely different stuff, in this case I'm fiddling with my Raspberry PI instead of writing my exam report.

As it is the sixth of December, I received a little traditionally dependent gift from my mother. In Germany we celebrate Dec. 6th with a little present for kids. As of me being 23, that hasn't changed I guess. The gift was greatly timed, since it's a 32GB USB drive, which I directly plugged into my Raspberry PI to make the USB drive the root partition.

Make Raspberry PI with Raspbian boot from USB

You can't do that. Well, you can make the operating system reside on any USB medium, but the actual /boot partition needs to stay on the SD card.

Luckily Linux and the Raspberry have a great community, so there are multiple guides how to do this. What I did was:

  1. Copy the debian image to the USB stick (guide)
  2. Change the cmdline.txt to load the OS from the USB stick (stackexchange thread)
  3. Grow the root filesystem to fill the USB drive (stackexchange thread)

The code in my cmdline.txt now:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 rootwait text 
You have to adjust some steps in the third guide, so it matches your setup and shift out some device names, also since the included script in the rasp-config tries to grow the sd card partition, even though the root partition is on a USB drive. At least that's what I think it does, because it couldn't grow my root file system, when it was on the USB drive already.

Since you're deleting and re-applying a partition table while actually running the OS from it, I recommend that you backup any data on your Raspberry PI, if you have any. It's quite a crazy thing to do, but it worked perfectly for me.

I hope this helped and it's useful to somebody, because I just hacked my solution together from the three guides above. Let me know if it works for you too.

Tagged with: #debian #Linux #Raspberry PI #Raspbian

Thank you for reading! If you have any comments, additions or questions, please tweet or toot them at me!