Table of Contents
  • Home
  • /
  • Blog
  • /
  • Three Different Ways to Boot a Raspberry Pi From a USB Drive:
February 27, 2024

Three Different Ways to Boot a Raspberry Pi From a USB Drive:

Three Different Ways To Boot A Raspberry Pi From A Usb Drive

Most of the time you might have seen a Raspberry Pi booting from an SD card. Don’t be in the presumption that an SD card is the only option to boot a Pi. Raspberry Pi can be booted from any type of USB storage, no matter whether it’s a thumb drive or a superfast PCI SSDs. We are pleased to show you how to boot Raspberry Pi from a USB drive in this tutorial. In this tutorial we are going to cover why you should boot a Raspberry Pi from a USB drive, what difference you may see when booting a Raspberry Pi from a USB drive, and three ways to boot a Raspberry Pi from a USB drive. First, it is necessary to know why you want to use USB drives to boot Raspberry Pi. The answer to this question lies in the following section.

Prerequisites for booting a Raspberry Pi from a USB drive:

  • A Raspberry Pi (model depending on method used)

  • A microSD card (needed for some methods)

  • A USB drive such as a flash drive, hard drive, or SSD

  • Basic familiarity with the Linux command line interface

  • Administrative access to the Raspberry Pi

  • Backup of any important data on the SD card or USB drive

  • Understanding of device naming conventions in Linux (sda, sdb, etc.)

  • Patience and time to complete the procedures which can take 30+ minutes

  • For method 3 specifically:

    • Raspberry Pi 4 or 4B model

    • Knowledge of whether your Pi 4B needs its EEPROM updated

    • Caution when updating EEPROM as it can “brick” the Pi if done incorrectly

The key prerequisites are having the appropriate Raspberry Pi model and OS version to use your desired method, a USB drive to boot from, Linux command line knowledge, backups of data, and time/patience. The method of updating EEPROM has additional warnings to research compatibility and follow instructions carefully. Let me know if you would like me to elaborate on or modify the prerequisites.

Booting From USB Drive Is Right for You?

You may see using an SD card to boot a Raspberry Pi in most of the tutorials. Even official Raspberry Pi documentation is no exception. But there is a reason for that. SD cards are portable to use. You need not maintain a separate unit for storage. It’s been seen that there is a dramatic reduction in performance when flash drives have been used against SD cards. You may ask how the Pi would perform if you use HDDs/SSDs. They have a track record of an impressive performance against SD cards. Well, yes, you may yield better performance if you use hard drives. But, you may need to bear with additional components like a USB cable for the data transfer hard drive itself with a case for protection. Additionally, an extra power unit if the power drowns from the Pi is not sufficient to run the hard drive. All these requirements make this option inconvenient. If you are ready to compromise with all these inconveniences, then you will get a stable, durable, and performance-oriented Pi for your project. Both ways are better in their way, and both of them have their own pros and cons in practical. See this table which tells the difference in a simple way. We feel this table would help you to decide what is right for you.

Booting from SD cardBooting from Hard Drive
More convenientFaster than SD cards which increase performance
PortableHard drives must remain attached
Finite lifespanLonger lifespan
Simple BackupsMore complicated Backups

Which Method Is to Use to Boot From USB?

If you are made up your mind to try booting your Pi from a USB hard drive. Then you are in the right place. We always encourage you to try exploring different options. We can tell you what we have experienced. But it may not be true in your case. You should try this practically. You are not going to learn until you get your hands dirty. All right, let’s hop on to the actual topic. There are multiple different methods to boot a Raspberry Pi from USB hard drives. Ultimately, it all depends on which model of Pi you are using. We are going to show you three different methods of booting a Pi in this tutorial. It is important to know each one of them before getting started. Each method is better in some terms than others. Let’s have some knowledge of all three methods one after another.

Method #1: Raspberry Pi Imager.

This method is very simple and straight as Raspberry Pi Org starts supporting the USB boot option on the new upcoming models. There is no need to tweak bootloader settings and flashing of EEPROM in the latest model. Booting from a USB drive is as same as booting a Pi from an SD card using the Raspberry Pi imager tool. You just need to select the hard drive instead of the SD card in the imager application while writing the boot image. Bear in mind that this method will work only on Raspberry Pi OS 2020–08–20 or newer and Raspberry Pi 400 and later models. Please check out our post “How easy to set up a Raspberry Pi ” to know more about booting a Raspberry Pi from an SD card.

The other two methods are a debatable topic. One method says to hijack the complete root file system from the SD card into the USB drive. Other methods say to upgrade the firmware from the official Raspberry Pi org to boot the Pi from USB storage. We would like to compare both of the methods using a table here in this section.

Upgrade FirmwareMoving the root file system
Only works with newer modelsWorks with all models
Requires a change on the Pi itselfPortable from one system to another
Procedure may differ between modelsUniversally applicable to all models
No need of SD cardSD card is mandatory to have

Method #2: Moving the Root File System.

This method is closer to the universe. No matter what model you have, starting from its early release to the present, it works flawlessly. Let’s get into it from scratch. This procedure is divided into Five simple steps.

  1. Backup your SD card

  2. Trigger the file system check

  3. Clone the SD card to a hard drive

  4. Configure the hard drive as a boot partition

  5. Expand the swap

Step 1:.Take a backup of your SD card:

Let’s start the procedure by taking a backup of your SD card. Use a built-in ‘SD card copier’ or any other program of your choice to copy the content of the SD card before processing.

Step 2. Trigger the file system check:

It’s good to start with a file system checkup to ensure everything is correct before moving the file system to the USB drive. Create a file named ‘forcefsck’ in the root directory. This file indicates the system to check the file system in the next reboot. If your Pi is hooked up to a monitor, you can see what is going on on the Pi. If not, just give a little extra time to the Pi to complete the boot process and come up. If you see your Pi booted without any errors, then your pi passed the file system test successfully. The file ‘forcefsck’ will disappear from the root directory. This is only a one-time test. However, you can trigger another test by repeating the process.

$ sudo touch /forcefsck
$ sudo reboot

Step 3. Clone the SD card to a hard drive:

The first step to booting from a hard drive is to copy the content of the SD card to the hard drive partition. All of you know that the Raspberry Pi imager creates two partitions on the SD card. We need to copy the content of the boot partition of the SD card to the hard drive. To do this let’s find out the data to be copied from which SD card’s partition to which hard drive’s partition. Let’s check the boot partitions now and take note of PARTUUID.

$ cat /boot/cmdline.txt

Step 4. List all the storage partitions using blkid command

List all the storage partitions using blkid command. Here we have a hard drive attached and connected to the Pi with three partitions created on it. Please check our post “How to Partition and Format the Hard Drives on Raspberry Pi:” to know how the hard drive has been partitioned..

$ sudo blkid

Step 5. Match the PARTUUID of the boot partition in the result of blkid command

All right, now we know the data to move from which partition to which partition. Let’s break it down for you. Match the PARTUUID of boot partition in the result of blkid command. this gives the information about the data to be copied from /dev/mmcblk0p2 partition to /dev/sda1 partition. Let’s copy the content using ‘dd’ command. dd command will not show any progress information. You need to wait until the backup process gets completed. Time depends on the size of the data. It may take a longer time if you have more data on your SD card. It tests your patience.

$ sudo dd if=/dev/mmcblk0p2 of=/dev/sda1 bs=32M conv=noerror,sync

dd: A command used to copy files or a partition.
if: input file
of: output file
bs: block size
conv: conversion options

Step 6. Check the target partition for errors

After completion of the data transfer, check the target partition for errors using the file system consistency check command.

$ sudo e2fsck -f /dev/sda1

Step 7. Try Remounting the drive for errors

If you see something like Cannot continue. Remount the drive and try the same command.

Step 8. Reboot the Pi

You may see some errors like this, and there is something corrupted on the SD card file system. Try to repeat the process by turning off the Pi without shutdown. Or try taking the previous backup again. The safest way is to do this by copying the contents of the SD card to a place and using that as a source for the dd command, which prevents copying any files on the fly from the SD card. After all, errors go off. Reboot the Pi.

$ sudo reboot

Step 9. Pi will read the partition by itself

Soon after reboot, your Pi will start reading the whole boot partition by itself. You can do this manually, too, by Issuing this command. This shouldn’t take a long time. When you finish this command, the new root system will have access to the full OS partition.

$ sudo resize2fs /dev/sda1

Step 10. Configure the hard drive as a boot partition:

To set up the hard drive as your boot device, you need modification in these two places:1. /boot/cmdline.txt2. /etc/fstab
Substitute the PARTUUID of /dev/sda1 in /boot/cmdline.txt

$ sudo blkid

Step 11. Edit the cmfline.txt

Copy the PARTUUID of /dev/sda1. Edit the /boot/cmdline.txt file using any text editor and replace the PARTUUID of the boot partition with the PARTUUID of /dev/sda1.

$ sudo nano /boot/cmfline.txt

Step 12. Delete the PARTUUID of /dev/mmcblk0p2 and write the PARTUUID of /dev/sda1. Save and reboot the Pi.
Step 13.…
Step 14. Edit the /etc/fstab and replace the PARTUUID of /dev/mmcblk0p2 with PARTUUID of /dev/sda1

After the reboot, it starts using the hard drive. For any reason, your Pi didn’t boot with your hard drive, you can connect your hard drive to your desktop computer and edit the /boot/cmdline.txt file. But you should have PARTUUID of /dev/sda1 or /dev/mmcblk0p2 handy to update and boot your Pi with your choice of storage.

Edit the /etc/fstab and replace the PARTUUID of /dev/mmcblk0p2 with PARTUUID of /dev/sda1.

Step 15 Mark the PARTUUID from the fstab table
Step 16. Mark the new PARTUUID from the fstab table
Step 17. Reboot the Pi

Reboot one more time.
$ sudo reboot

Step 18. Expanding the swap:

Now you are booting your Pi from your hard drive. If you are running new PI models which have 4 or 8 GB of RAM on them. You may need to expand the system swap. Raspberry Pi is already using swap partitions but in a very small amount. Use swapon command to see how much space is configured as a swap. It’s just 100 MB.

$ swap -s

Step 19 Increase the swap size

To increase the swap size edit the file ‘/etc/dphys-swapfile’.  And, reboot the Pi.

Step 20. Confirm the increase in SWAP size

Comment the ‘CONF_SWAPSOZE-100’ line and uncomment the CONF_SWAPFACTOR=2. This would automatically pick up the swap size as twice the RAM size. When next time you reboot, your swap size will be 8 GB on a 4 GB model of Pi. Please make sure you have enough space on your boot partition before touching the swap configurations. We recommend doing this when you have a boot disc larger than 32 GB.

Method #3: Updating the Bootloader EEPROM

This method is suitable only for Raspberry Pi 4 and 4B models. Depending on when your Raspberry Pi 4B was manufactured, the bootloader EEPROM may need to be updated to enable booting from USB mass storage devices. If you have older models of Pi with you, you are probably going to break down your Pi if you follow this procedure. The procedure would differ with different models. Please pay attention to your procedure and Pi model before taking any decision. Visit this site to see how to upgrade the EEPROM of Raspberry Pi.


Now, we hope you have some idea of different ways to boot a Raspberry Pi from a USB drive. It’s a debatable topic to decide on SD card vs USB storage. If you have new models of Pi, we recommend using USB storage. If not, just fine to stick with an SD card. Again, we recommend using super-fast SSDs or at least faster HDDs if you decide to go for a USB boot. Because flash drives are never found to be the best performers, you can use them as long as you are okay with their performance.

If you have older models of Pi, we never recommend using USB storage as your default boot device. You may need to flash EEPROM on your Pi. This is a one-time procedure. You can’t undo this once you do the flash. This procedure is quite complex. It’s not for beginners. Moreover, the procedure would differ with different models. There are chances of damaging the Pi if you follow the wrong procedure. It’s better to use an SD card to boot up the Pi and use the USB storage as an extended drive to increase the storage capacity.

Thanks for reading this article. If you find this article interesting, please visit our site to read more such interesting articles.

Arun KL

Arun KL is a cybersecurity professional with 15+ years of experience in IT infrastructure, cloud security, vulnerability management, Penetration Testing, security operations, and incident response. He is adept at designing and implementing robust security solutions to safeguard systems and data. Arun holds multiple industry certifications including CCNA, CCNA Security, RHCE, CEH, and AWS Security.

Recently added

Cloud & OS Platforms

View All

Learn More About Cyber Security Security & Technology

“Knowledge Arsenal: Empowering Your Security Journey through Continuous Learning”

Cybersecurity All-in-One For Dummies - 1st Edition

"Cybersecurity All-in-One For Dummies" offers a comprehensive guide to securing personal and business digital assets from cyber threats, with actionable insights from industry experts.



View All

Learn Something New with Free Email subscription