Raspberry Pi USB Booting
The Raspberry Pi 3 can be programmed to boot from USB by making a change to its One Time Programmable bit. I’m not a massive fan of this, since it walls off options, but also because I still have Raspberry Pi 1’s and Raspberry Pi 2’s that see use within my network, so I’m writing this to layout the process of provisioning a Raspberry Pi and WDLabs PiDrive bundle (but it should work with other external devices/USB sticks).
For starters, install Raspbian Lite using the normal method: Download it from the Raspberry Pi Downloads page, and flash it to a USB device using Etcher or Image Writer. Boot it up, do any setup, especially for WiFi/Networking, and then we’re golden to continue.
To set up the hard drive, get into superuser mode and run
cfdisk, and wipe out any partitions on it. We’ll create two new ones, one for linux and one for swap (82). Run
mkfs.ext4 on the first partition, and
mkswap on the second one. After that, we’ll copy over the Raspbian root using the next string of commands:
mount /dev/sda1 /mnt/hdd_sda1 might not be the right one. Change if needed.
rsync -avxS / /mnt/hdd
After that, the final step is to switch the booting partition. It’s important that we use a UUID or a PARTUUID for this step. Get the UUID or the PARTUUID of the device using
# blkid /dev/sda1 > /boot/tmpscratch.txt. Take the SD card to a more convenient computer, and copy and paste the UUID or PARTUUID to the
cmdline.txt file in the root partition. Follow the existing structure, either root=UUID= or root=PARTUUID=.
Note: This is much less of an actual post, and more of a self-note or self-reference. I might tidy this up later and make it more presentable. Maybe.
Second Note: These instructions are relevant to the version of Raspbian that was available as of 3-24-2018, possibly with an