3 min read

Retired MicroSD: Do your Raspberry Pi a favor

Your MicroSD card is a ticking time bomb! In this post, I explain why switching to a USB-SSD is a game-changer for performance and reliability. I cover updating the bootloader, configuring USB boot, cloning your MicroSD, and the impressive speed boost. Give your Raspberry Pi the upgrade it deserves!
A chain is only as strong as its weakest link.

There are several reasons to replace your Raspberry Pi's MicroSD with an alternative such as a USB-SSD. Besides the fact that your MicroSD card is a ticking self-destruction bomb, don't underestimate the importance of read/write speed. As of today, I can count up to three MicroSD cards that have stopped working from one moment to the next. Most of the time, it wasn't a problem because my Raspberry Pi setups were always for development purposes or projects like MagicMirror. Now that I'm addicted to Home Assistant, I need to give it a little boost!


Components


Update Bootloader

First of all, it's important to update the Raspberry Pi's packages and bootloader. This can easily be done with a couple of commands. I'm using the official Raspberry Pi OS, which is a Debian port and follows its release cycles. The following commands have only been tested on Raspberry Pi 4 Model B.

sudo apt update
sudo apt upgrade
sudo reboot

Before updating the bootloader, I recommend to set the release channel to at least "stable" or if you want "latest".

sudo nano /etc/default/rpi-eeprom-update
< FIRMWARE_RELEASE_STATUS="default"
---
> FIRMWARE_RELEASE_STATUS="stable"

💡 This can also be done with sudo raspi-config command (Advanced Options -> Bootloader Version).


Check your bootloader version with the following command. It is important to have a version installed that is at least from 2020-09-03 or newer, because USB boot was released then.

vcgencmd bootloader_version

If the bootloader version is incompatible (before 2020-09-03) or just outdated, it can be upateded with the following command.

sudo rpi-eeprom-update
*** UPDATE AVAILABLE ***
BOOTLOADER: update available
   CURRENT: Fri 5. Jan 15:57:40 UTC 2024 (1704470260)
    LATEST: Sa 7. Dez 12:39:28 UTC 2024 (1733575168)
   RELEASE: stable (/lib/firmware/raspberrypi/bootloader-2711/stable)
            Use raspi-config to change the release.
...

Apply the available update and reboot your system.

sudo rpi-eeprom-update -a
sudo reboot

Configure USB Boot

For some reason, the boot order of my Raspberry Pi was set to boot only from the MicroSD card. No wonder booting from USB does not work. This can be configured with a couple of commands.

Check the boot order with the following command.

sudo rpi-eeprom-config

The variable BOOT_ORDER, obviously, reflects the boot configuration. A full list of possible values can be found here, some of these are model specific.

1 - SD Card
4 - USB
6 - NVME (CM4 & RPI5 only)
f - RESTART
sudo -E rpi-eeprom-config --edit
BOOT_ORDER=0xf41

💡 This can also be done with sudo raspi-config command (Advanced Options -> Boot Order).

Clone MicroSD to SSD

There is a fabulous tool named billw2/rpi-clone, which has been outdated for several years, but was forked from, of course, geerlingguy/rpi-clone.

rpi-clone is a shell script for cloning a running Raspberry Pi booted source disk (SD card or USB disk) to a destination disk which will be bootable.

The installation of rpi-clone is simply done by an install script, which will download two files and place them under /usr/local/sbin/.

curl https://raw.githubusercontent.com/geerlingguy/rpi-clone/master/install | sudo bash

Connect the SSD to one of the Raspberry Pi's USB-3 ports (blue-colored). Now it should appear in the list of the block devices. In my case it's sdb.

lsblk

While the Raspberry Pi is running, the cloning process can be started with the following command.

sudo rpi-clone sdb
Booted disk: mmcblk0 32,0GB                Destination disk: sdb 128,0GB
---------------------------------------------------------------------------
Part               Size  FS  Label           Part     Size  FS    Label
1 /boot/firmware   512   0M  fat32           --      1       512  0M     fat32  --
2 root              29   3G  ext4            rootfs  2       118  7G     ext4   --
---------------------------------------------------------------------------
== SYNC mmcblk0 file systems to sdb ==
/boot/firmware        (65,5M used)   : SYNC to sdb1 (512,0M size)
/                     (9,3G used)    : SYNC to sdb2 (118,7G size)
---------------------------------------------------------------------------
Run setup script       : no.
Verbose mode           : no.
-----------------------:

Ok to proceed with the clone?  (yes/no): yes

Syncing file systems (can take a long time)
Syncing mounted partitions:
  Mounting /dev/sdb2 on /mnt/clone
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
  => rsync // /mnt/clone with-root-excludes ...
  Mounting /dev/sdb1 on /mnt/clone/boot/firmware
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
  => rsync /boot/firmware/ /mnt/clone/boot/firmware  ...

Editing /mnt/clone/boot/firmware/cmdline.txt PARTUUID to use d8d73f24
Editing /mnt/clone/etc/fstab PARTUUID to use d8d73f24
===============================
Done with clone to /dev/sdb
   Start - 17:45:00    End - 17:47:10    Elapsed Time - 2:10

Cloned partitions are mounted on /mnt/clone for inspection or customizing.

Hit Enter when ready to unmount the /dev/sdb partitions ...
  unmounting /mnt/clone/boot/firmware
  unmounting /mnt/clone
===============================

🏁 Shutdown your Raspberry Pi, remove the MicroSD, and boot again. Your Raspberry Pi should now boot from your USB device.


Speedtest

dd if=/dev/zero of=/tmp/speedtest1.img bs=20M count=5 oflag=direct

Before

104857600 Bytes (105 MB, 100 MiB) kopiert, 17,665498 s, 6 MB/s

After

104857600 Bytes (105 MB, 100 MiB) kopiert, 0,370654 s, 283 MB/s