Update
Since first writing this blog, a much better blog has emerged that covers in detail:
1. Continuing to use SD card for boot via /boot
2. Uses an SSD for everything not /boot e.g. root /
Raspberry Pi 4 USB Boot Config Guide for SSD / Flash Drives
I strongly recommend the James A. Chambers blog.
My original blog is shown below, which will shortly be updated with the above instructions, where relevant.
Until then I would use
Raspberry Pi 4 USB Boot Config Guide for SSD / Flash Drives
Introduction
Running the root directory
/ from a USB 3 SSD significantly increases the speed of your Raspberry Pi 4.
You will achieve desktop web performance in Chromium.
It is amazing how much faster the Pi 4 is with the root directory
/ on USB 3 SSD.
The speed increase will be particularly noticeable when you have several Chromium tabs open.
There are two steps:
- Edit the file /boot/cmdline.txt file (microSD)
- Run sudo rsync -avx / /media/pi/ExternalSSD
replacing ExternalSSD with the SSD mount point in /media
Editing the /boot/cmdline.txt file tells the microSD to pass control to the USB 3 SSD by specifying that the root directory / is on the USB 3 SSD (i.e. not on the microSD).
You will still need the microSD for initial boot up but after that the Raspberry Pi 4 runs directly from the root directory / on the USB 3 SSD.
Finally you do the following steps at your own risk.
These instructions have been prepared in good faith and are provided without warranty. Things can and do go wrong.
I suggest making an offline copy of your microSD and using that for this procedure.
In case of any problems you can always access your Raspberry Pi with the original microSD.
Caveat Emptor !
0. Preparation
Before you make any changes to /boot/cmdline.txt it should look similar to:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=4831f5fb-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Begin by finding the UUIDs for ALL available disks on system:
ls -lha /dev/disk/by-uuid
lrwxrwxrwx 1 root root 10 Jan 19 17:43 3122c401-b3c6-4d27-8e0d-6708a7613aed -> ../../
sdb2
lrwxrwxrwx 1 root root 10 Jan 19 17:43 3FFE-CDCA -> ../../
sdb1
lrwxrwxrwx 1 root root 9 Jan 19 17:38 979610b6-2a3f-432e-bc11-5465bcb5253c -> ../../
sda
cat /etc/fstab
PARTUUID=4831f5fb-01 /boot vfat defaults 0 2
PARTUUID=4831f5fb-02 / ext4 defaults,noatime 0 1
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 29G 20G 7.9G 72%
/
/dev/mmcblk0p1 253M 52M 201M 21% /boot
/dev/sda 3.6T 3.4T 14G 100% /media/pi/Samba4TB
/dev/sdb1 253M 40M 213M 16% /media/pi/temp1
/dev/sdb2 29G 18G 11G 62% /media/pi/temp2
sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="3FFE-CDCA" TYPE="vfat" PARTUUID="4831f5fb-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="3122c401-b3c6-4d27-8e0d-6708a7613aed" TYPE="ext4" PARTUUID="4831f5fb-02"
/dev/sda: LABEL="Samba4TB" UUID="979610b6-2a3f-432e-bc11-5465bcb5253c" TYPE="ext4"
/dev/mmcblk0: PTUUID="4831f5fb" PTTYPE="dos"
/dev/sdb1: LABEL_FATBOOT="boot" LABEL="boot" UUID="3FFE-CDCA" TYPE="vfat" PARTUUID="4831f5fb-01"
/dev/sdb2: LABEL="rootfs" UUID="3122c401-b3c6-4d27-8e0d-6708a7613aed" TYPE="ext4" PARTUUID="4831f5fb-02"
1. Edit the /boot/cmdline.txt file
Begin by making a copy in case anything goes wrong:
sudo cp /boot/cmdline.txt /boot/cmdline.bak
sudo nano /boot/cmdline.txt
Change the text from:
root=PARTUUID=a4c81466-02
to
root=/dev/sda1
Note you will have a different
PARTUUID number from
a4c81466-02
So you should change
cmdline.txt from something like:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=a4c81466-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
to :
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
The text to delete is in
blue and the text to add is in
red but you may also have to type the file system if not using
ext4
Optionally, you may also want to delete
quiet splash in order to view Linux's startup messages.
2. sudo rsync -avx / /media/pi/ExternalSSD
You will need an available partition, preferably sda1, on your USB 3 SSD.
I recommend the first partition and that this USB 3 SSD always be plugged in before any other USB storage device.
The USB SSD partition to be used as the root directory
/ would typically be
/dev/sda1
If you really want to use the PARTUUID in place of
/dev/sda1 then run
sudo blkid
Example output (not specific to this tutorial) :
pi@Rasp4-4GB:/ $ sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="016B-16E4" TYPE="vfat" PARTUUID="56b1c1da-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="6ead9b69-967c-4c44-ac59-11075ed8e9a7" TYPE="ext4" PARTUUID="56b1c1da-02"
/dev/sdb1: LABEL_FATBOOT="boot" LABEL="boot" UUID="3FFE-CDCA" TYPE="vfat" PARTUUID="a4c81466-01"
/dev/sda1: LABEL="RaspberryPiBoot" UUID="128f5236-c026-44e5-abf8-69397c1e969f" TYPE="ext4" PARTUUID="002be3a8-01"
/dev/sda2: UUID="c0d9a904-2bda-4c38-87e0-5072cfc6ac4f" TYPE="ext4" PARTUUID="002be3a8-02"
/dev/sdb2: LABEL="rootfs" UUID="3122c401-b3c6-4d27-8e0d-6708a7613aed" TYPE="ext4" PARTUUID="a4c81466-02"
/dev/mmcblk0: PTUUID="56b1c1da" PTTYPE="dos"
/dev/sdd1: UUID="ad488156-5256-4e02-9382-cb2bf9c6bfed" TYPE="ext4" PARTUUID="f0cb35b6-01"
/dev/sdd2: UUID="9a4c2ce6-be96-4c66-8bb6-4ec2fda9f58c" TYPE="ext4" PARTUUID="f0cb35b6-02"
pi@Rasp4-4GB:/ $
In addition to PARTUUID,
blkid will also show the UUID.
If you use
root=/dev/sda1 you will be able to use any suitably prepared USB SSD and not just the paritcular SSD identified by PARTUUID.
I further recommend that the USB SSD partition be formatted using
ext4 .
A good tool for creating the USB SSD partition and formatting under Linux / Raspberry Pi is
GParted.
GParted can be installed via:
sudo apt-get install gparted
The next step is to run :
sudo rsync -avx / /media/pi/ExternalSSD
Replace
ExternalSSD with the exact USB SSD mount point name shown when mounting in /media/pi/....
Enjoy !
:-)
Further Help
How to Run Raspberry Pi 4 or 3 Off an SSD or Flash Drive
Raspberry Pi 4 With an SSD: Dramatic Speed Improvements, Higher Price
YouTube : How to boot Raspberry PI4 from USB