Update
RPi4 now supports booting directly from USB. First update to get an eeprom which supports USB Boot, then configure the bootloader to boot from USB.
Original guide
-
Download Raspbian from the official site
-
Flash it to the USB drive following the procedure detailed here
-
Fomat an SD Card 2/4 GB as
FAT32
,label "boot"
,flag "lba"
. Generate a UUID. You can use GParted for this task. -
Get the UUID of the USB drive and the SD Card partitions using
sudo blkid
. -
Copy the files from the
/boot/
partition of the USB drive to the SD Card usingrsync -rt <source> <dest>
-
Modify the file
cmdline.txt
on the SD Card ensuring:
6.1. root=PARTUUID=<UUID of the USB drive rootfs partition>
is present
6.2. rootdelay=5
to give more time to the Kernel to wait for the USB device
6.3. If you're using this USB drive adapter (use lsusb
):
Bus 002 Device 002: ID 152d:0578 JMicron Technology Corp. / JMicron USA Technology Corp. JMS567 SATA 6Gb/s bridge
The disk is slow and reports errors in dmesg
like the following:
[ 543.071702] sd 0:0:0:0: [sda] tag#16 uas_eh_abort_handler 0 uas-tag 7 inflight: CMD IN
[ 543.071719] sd 0:0:0:0: [sda] tag#16 CDB: opcode=0x28 28 00 00 42 80 88 00 00 08 00
[ 543.111634] scsi host0: uas_eh_device_reset_handler start
[ 543.262296] usb 2-1: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[ 543.297294] scsi host0: uas_eh_device_reset_handler success
[ 573.776061] sd 0:0:0:0: [sda] tag#25 uas_eh_abort_handler 0 uas-tag 11 inflight: CMD IN
[ 573.776079] sd 0:0:0:0: [sda] tag#25 CDB: opcode=0x28 28 00 00 09 d4 40 00 00 08 00
Add usb-storage.quirks=152d:0578:u
(link to Github, redhat bug report).
It must be disabled via kernel flags as it is built-in (sudo modprobe configs && zcat /proc/config.gz | grep USB_UAS
).
6.4. Remove the init
script to resize the drive. It doesn't work as the /boot
and /
do not belong to the same drive.
- On the USB drive, edit
/etc/fstab
:
7.1. Comment out the /boot
partition of the USB drive
7.2. Add:
PARTUUID=<UUID of the SD Card boot partition> /boot vfat defaults 0 2
Useful links:
I'll test with
iozone
to see if under stress the errors show up again. If it is the case, then it's underpowering.