Raspberry Pi 4 - Running Raspbian Buster from an HDD [Updated Guide]
Some time ago I wrote this guide on how to run Raspbian Stretch from an HDD on the Raspberry Pi 3. With the new Buster release, and the new Raspberry Pi 4, the process is a bit different, so here I'm documenting it with an updated guide.
Note: You still need the SD card to boot, but the rest of the system runs from the HDD. I tested this on Raspbian Buster Lite (Headless), Raspbian Buster with desktop should work too.
Raspbian Buster Installation
Grab the official Stretch image and flash it with balenaEtcher to your SD card. Insert the SD card to your Raspberry Pi, plug in your external HDD and power it on.
After loggin in to your Pi, update and make sure you have rsync installed:
$ sudo apt-get update && sudo apt-get upgrade -y $ sudo apt-get install rsync
Running Raspbian from HDD
First unmount your disk:
$ sudo umount /dev/sda1
Then prepare it. This example makes an ext4 partition utilizing all of the disk's space:
$ sudo parted /dev/sda (parted) mktable msdos Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? Yes (parted) mkpart primary ext4 0% 100% (parted) q $ sudo mkfs.ext4 /dev/sda1
Type y if asked by the prompt, then wait for the process to complete.
Mount your sda1 into mnt:
$ sudo mount /dev/sda1 /mnt
Copy the root to the mounted hdd:
$ sudo rsync -axv / /mnt
Now get the list os UUIDs and PARIDS of your disk:
$ sudo blkid | grep sda /dev/sda1: UUID="uuid" TYPE="ext4" PARTUUID="partuuid-01"
You need to add your sda1's PARTUUID to root= and add rootdelay=5 at the end of the /boot/cmdline.txt file and save it:
$ sudo nano /boot/cmdline.txt dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=partuuid-01 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait rootdelay=5
And finally you will need to change HDD's fstab file to auto mount everything:
$ sudo nano /mnt/etc/fstab proc /proc proc defaults 0 0 PARTUUID=####-01 /boot vfat defaults 0 2 PARTUUID=####-02 / ext4 defaults,noatime 0 1
Change the third line to this (change / to none):
PARTUUID=####-02 none ext4 defaults,noatime 0 1
And add a new line with the sda1's UUID you copied earlier:
PARTUUID=partuuid-01 / ext4 defaults,noatime 0 1
Save the file and copy it to /boot. Then reboot the Raspberry:
$ sudo cp /mnt/etc/fstab /boot/fstab_usb $ sudo reboot
That's it! After booting from the SD, your system will be running from the HDD, and should be much faster. 🚀🚀🚀