Booting from USB external drive on Raspberry Pi 3B

This is a quick entry to explain the steps which I followed to enable to boot from an USB driver on my Raspberry Pi 3B, but let’s start from the beginning, do you know which exact revision you have?

Which Raspberry Pi revision I have

$ rev=$(awk '/^Revision/ { print $3 }' /proc/cpuinfo) && curl -L$rev
Revision : a22082
Model    : 3 Model B
Memory   : 1 GB
Overvolt : No
Released : Q1 2016

Raspbian backup

Before making any modification in Raspbian the best thing to do is just to backup our configuration, this can be done in many different ways, in my case I just dd all the SD card content using my laptop:

# dd of=2020-04-12-raspbian-buster-lite.img if=/dev/mmcblk0 bs=4M

Later we’ll use this last backup image to be written in our new external hard drive, so we keep the same configuration in our RB.

Raspberry Pi 3b specifications

  • Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
  • 1GB RAM
  • BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
  • 100 Base Ethernet
  • 40-pin extended GPIO
  • 4 USB 2 ports
  • 4 Pole stereo output and composite video port
  • Full size HDMI
  • CSI camera port for connecting a Raspberry Pi camera
  • DSI display port for connecting a Raspberry Pi touchscreen display
  • Micro SD port for loading your operating system and storing data
  • Upgraded switched Micro USB power source up to 2.5A

It’s a good recommendation to do that you check your SD card because this entry is assuming that you are using a SD card to run Raspbian, you could check the following link.

SD card I/O performance on Raspberry Pi 3b

It’s important notice that with SD card we’re being limited to the maximum bus speed which is still limited to 20Mb/s (the same happens on Raspberry Pi 2), to further information please check the link below.

Comparing this I/O speed with the USB 2 ports, we also need to consider the hard drive speed, but the improvement is clear.

Setup USB device mode

It’s very important to notice that I had to upgrade my system so this procedure works, but if you do that it’s pretty simple:

# apt update && apt upgrade
# cp /boot/config.txt /boot/config.txt.BACK
# echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
# tail -1 /boot/config.txt
# reboot

Once RB Pi3B is rebooted we should check if our last change has taken effect:

$ vcgencmd otp_dump | grep 17:
# cd /boot && mv config.txt config.txt.USB && mv config.txt

Setup our external drive

Now it’s time to write the backed up image to our external drive, in this case I use etcher tool, you could download and it’s pretty simple to use, just choose your image and the new drive and click on Flash button.

Then it’s time to shutdown our RB:

# shutdown -h now

Connect our external drive and then remove our SD card, as an advice I’d suggest that in this first boot you connect your RB to an external monitor so you could check that the boot process goes well.

Keep enjoying your RB!

That’s all folks!!!

Reference links:

“People think that mathematics is complicated. Mathematics is the simple bit, it’s the stuff we CAN understand. It’s cats that are complicated”
— John Horton Cownway (RIP)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s