You are on page 1of 4

Raspberri PI 4 boot from SSD

PERSONAL NOTES v.53


Follow-up to my post: https://community.home-assistant.io/t/finally-raspberry-pi-4-boot-from-ssd-
no-microsd-required/197826

DISCLAIMER
The procedure described here worked for me. It may or may not work for you. I’m not responsible
for any damage you get following this guide. You’re on your own. You have been warned.
This guide is not meant as a newbie tool. It does assume you are already familiar with the steps
described and the assumptions made here.
I wrote these notes using my Arch Linux box. I don’t have any Windows box.

CREDITS
Official announcement: https://www.raspberrypi.org/forums/viewtopic.php?
t=274595&p=1663644#p1663644
For more info, see the BOOT_ORDER chapter:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md
Andreas Spiess video: https://www.youtube.com/watch?v=zVhYvvrGhMU
and cheatsheet: https://www.dropbox.com/s/6bjx6nlu5sa7bxt/USB%20Boot%20Commands.docx
This may help in case of problems: https://jamesachambers.com/raspberry-pi-4-usb-boot-config-
guide-for-ssd-flash-drives/

Table of Contents
1 Prepare the RasPI 4...........................................................................................................................1
2 Verify the preparation effects.............................................................................................................2
3 Prepare a Raspbian Lite SSD and test the USB boot........................................................................2
4 Look ‘ma, no SD on my RasPI4 HassOS !!!.....................................................................................4

1 Prepare the RasPI 4


1. Download Raspbian Lite: https://www.raspberrypi.org/downloads/raspbian/
2. At the time of writing the current release is 2020-02-13, verify its SHA256:
12ae6e17bf95b6ba83beca61e7394e7411b45eba7e6a520f434b0748ea7370e8

3. Etch a MicroSD with that Raspbian Lite.


4. Setup /boot/ssh and your network connectivity on the just etched SD and SSD.
5. If you go headless, enable ssh on both the MicroSD and the SSD:
https://www.raspberrypi.org/documentation/remote-access/ssh/
6. Insert the MicroSD on the RasPI 4 and boot it.
7. Drop a shell and execute:
$ sudo apt update && sudo apt full-upgrade && sudo rpi-update
&& sync && sudo reboot
$ sudo nano /etc/default/rpi-eeprom-update
critical --> beta
$ sudo rpi-eeprom-update -d -f
/lib/firmware/raspberrypi/bootloader/beta/pieeprom-2020-05-
15.bin
$ sudo apt clean && sync && sudo reboot

2 Verify the preparation effects


$ uname -a
Linux raspberrypi 5.X.XX ...
$ vcgencmd bootloader_version
May 15 2020 11:05:52
version 23a9f59b85f5a81bb2eec455e064ef9905216322 (release)
timestamp 1589537152
$ vcgencmd bootloader_config
...
BOOT_ORDER=0xf41
4 is for booting from USB and 1 is booting from the SD card.

3 Prepare a Raspbian Lite SSD and test the USB boot


1. Etch an SSD (or an USB thumb drive) with the same Raspbian Lite used for the MicroSD.
2. Align the SSD content to the just updated MicroSD. I did it by mounting both the SD and
the SSD on my PC, then look at lsblk and fdisk -l output.

3. In the following examples, the SD is /dev/mmcblk0 and the SSD is is /dev/sdc

4. If not already mounted, mount the SSD and the SD:


$ mkdir /tmp/microsd_boot
$ mkdir /tmp/microsd_root
$ mkdir /tmp/ssd_boot
$ mkdir /tmp/ssd_root
$ sudo mount /dev/mmcblk0p1 /tmp/microsd_boot/
$ sudo mount /dev/mmcblk0p2 /tmp/microsd_root/
$ sudo mount /dev/sdc1 /tmp/ssd_boot
$ sudo mount /dev/sdc2 /tmp/ssd_root
5. Align the SSD to the MicroSD content (USE YOUR MOUNTPOINTS):
$ sudo rsync -aAXvn
--exclude={"/boot.bak","/lib/modules.bak","/var/swap","/dev/*
","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/
lost+found"} /tmp/microsd_boot/ /tmp/ssd_boot/
$ sudo rsync -aAXvn
--exclude={"/boot.bak","/lib/modules.bak","/var/swap","/dev/*
","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/
lost+found"} /tmp/microsd_root/ /tmp/ssd_root/
If the dry-run looks good, do the real update by removing the parameter “n”:
$ sudo rsync -aAXv --exclude ...
Please note: at this stage, the SD partitions are already resized to the max space available on
the SD, while the SSD partitions aren’t yet resized, so large files must be deleted from the
SD before the rsync. I.E. this may happen with:
/tmp/microsd_root/var/lib/apt/lists/raspbian.raspberrypi.org_
raspbian_dists_buster_main_binary-armhf_Packages
6. Visually verify that the copy has produced the wanted result, on both the boot and root
partitions (mountpoints), by visually comparing them.
7. $ sync && sudo umount /tmp/microsd_boot/ /tmp/microsd_root/ /
tmp/ssd_boot /tmp/ssd_root
8. Attach the SSD to an USB3 port of the RasPI4, do not insert the MicroSD.
9. Power on the RasPI4, both the RasPI and the SSD leds should flash during the boot process.
Shortly, you should see a DHCP lease request on your DHCO server leases list.
10. With a bit of luck ;) you can now drop a ssh shell into the RasPI4 and check the size of the
SSD root partition:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 1.5G 1.3G 32M 98% /
$ sync && reboot
On a Linux box you may use gparted GUI to safely resize the SSD root partition to the
maximum extent. Then reattach the SSD to the RasPI4, boot it and check it’s all OK, i.e.:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 220G 1.4G 208G 1% /
4 Look ‘ma, no SD on my RasPI4 HassOS !!!
As of 2020/05/22 still no clue :(

Meanwhile, this works:


https://community.home-assistant.io/t/hass-io-transfer-from-sd-card-to-ssd-or-usb/97452/243

You might also like