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.
First install Raspbian on to both the SD Card and the USB stick as you normally would.
Insert both the SD Card and your USB stick into the Raspberry Pi and 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
.
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
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
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.