Raspberry Pi 4 SSD Boot
Well first off the title is wrong, you can’t boot from an SSD yet on R Pi 4. However this will help you put the root partition on a USB 3 drive. So I have my R Pi 4 docker swarm cluster that has been running since December and I am starting to get concerned about MicroSD card failure. I haven’t had may problems and only have had to reboot 2 of them since they came online. I have used multiple tutorials on how to get this to work with no success. They wanted you to start by re-imaging and then change partitions but that will not work for me. I don’t want to lose the hours of work I have already put into the cluster. I finally go it to work using steps from multiple solution. The USB adapter I used is a Vantec USB 3.0 case that cost $8. I am running Ubuntu 20.04 and of course a R Pi 4.
First thing is boot the Pi and once it is up and running plug in the USB adapter. Use fdisk to setup the partition and mkfs to to format. Below is the syntax.
sudo fdisk -l
sudo fdisk /dev/sda
sudo mkfs.ext4 /dev/sda1
Now you can mount the drive to /mnt or a directory that you created. Then rsync the contents of the root partition to the drive. Syntax is below.
sudo mkdir /mnt/newdir
sudo mount /dev/sda1 /mnt/newdir
sudo rsync -avx / /mnt/newdir
Now I had issue with the first boot taking an hour to come up and most of the time is failed on reboot. I found you have to add a usb storage statement to the cmdline.txt file. First use lsusb to get the USB adapter ID and copy the eight digit alpha numeric string. Then goto /boot/firmware/ and edit the cmdline.txt. At this time you can also add the string that will tell Ubuntu to mount the USB partition to the as the root partition of the system.Syntax is below.
sudo vi /boot/firmware/cmdline.txt
Add usb-storage.quirks=XXXX:XXXX:u to front of string
change boot device to root=/dev/sda1
This will mount the USB as the root partition and make your file system more reliable. I know this is short but this is all I had to do to get it to work. Now I have to do this to my Swarm cluster. The initial boot still may take awhile the first boot with the USB adapter so give it some time. This will speed up the actions of the Pi as well. I didn’t run any bench marking but you can see the speed difference in the terminal response and just processing or at least I could. I hope this helps and I made it as simple as possible.