Booting Raspberry Pi from USB

This is documented elsewhere but here’s a cheatsheet. Note that you still need an SD card. I used instructions I found here and here.

Prepare the SD Card & USB Stick/Drive

First install Raspbian on to both the SD Card and the USB stick as you normally would.

Boot Raspberry Pi

Insert both the SD Card and your USB stick into the Raspberry Pi and boot.

Configure SD Card for USB Boot

ssh into your Pi and execute the command dmesg and look for identifying information associated with your USB stick. In most cases, you should find that your USB stick is at /dev/sda with the text Attached SCSI removable disk next to it.

Also, do the df -k command and you should see your USB stick at filesystem /dev/sda1 & /dev/sda2 with sda1 mounted at /media/pi/boot.

Expand USB File System

Let’s expand the USB stick filesystem. First unmount the two volumes associated with the USB drive:

sudo umount /dev/sda1
sudo umount /dev/sda2

First update the file system table with fdisk:

sudo fdisk /dev/sda
Command: p  # note start of /dev/sda2
Command: d  # delete
2  # partition 2
Command: n # new
p # primary
2 # partition 2
131072 # start of /dev/sda2 from above
Command: w # write changes

Now reboot:

sudo reboot

Now resize:

sudo resize2fs /dev/sda2

Modify SD Files & Reboot

Open the /boot/cmdline.txt file and change mmcblk0p2 to sda2.

Open the /etc/fstab file and change mmcblk0p1 to sda1 and mmcblk0p2 to sda2.

sudo reboot

 Results

After reboot enter df -h and you should see your partition sizes with the expanded disk.

The time to boot into the GUI off of my USB stick was 20 seconds versus 33 seconds from the SD card!

I also updated my SD Card performance test with the results.

Leave a Reply

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