Raspberry Pi: Set Up USB Boot Using a Stick or SSD Hard Drive
The Raspberry Pi usually needs a micro SD card on which the operating system is located. The disadvantage is, on the one hand, that SD cards break faster and, on the other hand, they usually have less storage space than a hard drive. In this tutorial, we will take a closer look at the Raspberry Pi USB Boot.
Since the Raspberry Pi 4 it is even easier than before to make the SD card obsolete. All we need is a USB stick or an (external) hard drive.
Required Hardware Parts
- Raspberry Pi 4
- 2-5 External hard disk / SSD (alternatively: a large USB stick)
- 5V power supply with at least 3A
Of course, we could still use an SD card and an external device, but in many cases, we need a larger root directory. Therefore, a sufficiently large hard disk makes sense in any case – not to mention the failure rates of the SD cards.
In my first test, my power supply had too little power, which is why the Pi could not boot properly. After that I used a stronger power supply, and it worked.
Method 1: Update the existing Raspberry Pi OS and transfer it to the SSD
If you have already set up your operating system and now want to transfer it completely, there is an easy way to do this. But first, we have to update the package sources and the kernel:
sudo apt-get update sudo apt-get full-upgrade sudo rpi-update sudo rpi-eeprom-update
Then we connect the USB stick or the hard drive to the Raspberry (before we do a backup if necessary). When flashing, all data is overwritten, so data backup is important! I used the USB Image Tool (for Windows), which creates a complete backup as an .img file. The only drawback is that the image file is as large as the entire volume, not just as large as the sum of all the files. You can then write the backup to the stick again.
The Win32DiskImager tool has a similar function
Before we transfer the operating system, let’s take a look at the file below
This should look like this (it is important that there is no absolute path).
console=serial0,115200 console=tty1 root=PARTUUID=c29633fc-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
On the Raspberry Pi we now click the start menu> “Accessories” and select the “SD Card Copier“. Here we choose our root partition and the hard drive to which the image should be transferred.
After everything has been successfully transferred, we can shut down the Pi and remove the SD card.
Method 2: Flash a Fresh Raspberry Pi OS and Activate USB Boot
Another method is that we download a current image of the Raspberry Pi OS (formerly called Raspbian OS). Updates are no longer necessary here.
If necessary, make a backup of your hard drive / USB stick first, as this method will also overwrite all data.
Then we need Balena Etcher. With this, we can write the Raspberry Pi OS image to the USB stick or hard drive. The process is described in more detail here. You can already pre-configure SSH and the Wi-Fi connection.
Again, you should check the cmdline.txt (see above).
Before we start, we remove the SD card from the Raspberry Pi (if still present) and connect the SSD / USB stick. It takes a while to start up, but then the Raspberry Pi should have started normally.
Conclusion on the USB Boot on the Raspberry Pi:
In principle, I really like the possibility of finally using permanent hard drives as a system memory. Especially in continuous operation (OpenHAB sends its regards), SD cards break after not too much usage. Unless you have regularly backed up all important files, this is a disaster. In such projects, I will certainly use a hard drive instead of an SD card in the future (not even an SSD), since flash memory is too fragile in my opinion.
Nevertheless, you have to look carefully which hard drive has what kind of performance because you don’t want too great of a speed loss through USB. Even if the USB 3.0 interface allows at least higher data transfer rates.
PS: Experience values are welcome to be posted as a comment!