I was reformating some USB drives to set up a PI cluster and one of the Raspberries wouldn’t boot. I took a look at it and realized that it was a Raspberry PI 3! RPis didn’t always boot from USB! We used to have to format SD cards and boot from them. But SD cards don’t like a lot of writes and will eventually fail. So, the nice people at Raspberry figured out how to get Pis to boot from USB and use them for their storage. If you want to upgrade your old Pis to boot from USB like the rest of your fleet, no worries, it’s easy.
First, you’ll need to install Raspberry Pi OS on an SD card and a USB drive. Then, you’ll make a (permanent) change to the OTP and reboot.
One Time Programmable Memory
Once you get the Pi to boot, enable the Raspberry Pi’s USB boot mode. This is done by setting a bit in the Raspberry Pi’s OTP (One Time Programmable) memory, allowing the device to be booted from a USB mass storage device. After that, we won’t need the SD card anymore. Open Terminal and run the following command:
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
This adds the config option “program_usb_boot_mode=1” to the end of /boot/config.txt. Now, reboot the Pi. After the reboot, check that boot mode has been enabled with this command:
vcgencmd otp_dump | grep 17
The output should contain the value 3020000a.
pi@raspberrypi:~ $ vcgencmd otp_dump | grep 17 17:3020000a pi@raspberrypi:~ $
I really appreciate this, as I don’t have any raspis newer than the 3.
Thanks for the pointers but I’m having difficulty getting this acutally working.
I have this model:
Raspberry Pi 3 Model B Rev 1.2
And have programmed things as you suggest
$ vcgencmd otp_dump | grep 17
17:3020000a
I have copied everything from the flash to my ssd and there are two partitions:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 256M 0 part
└─sda2 8:2 0 1.7G 0 part
mmcblk0 179:0 0 29.8G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 29.6G 0 part /
However when I remove the SD card my machine doesn’t seem to boot at all. The drive does have power but no activity. I can mount both partitions on another machine and everything seems to be fine.
Is this 3B incapable of using the SSD?
Thanks,
Dave.
Hi, Dave,
I can assure you: the 3B Rev1.2 is capable to boot from USB – mine is doing fine.
I guess, you failed in “have copied everything from the flash to my ssd”, since the /etc/fstab still points at the PARTUUIDs from the flash.
Background: a fresh installation on a Pi does a partition-resize of the second partition – and within this process the drive gets a new UUID, a new Partition-Table-UUID (PTUUID) and this way new PARTition-UUID’s (PARTUUID) which are populated in the fstab.
So you’ve got two pills… errr opportunities:
1. fiddle around with the UUIDs to bring your “copied” system up:
– boot the Pi from the flash, connect the ssd and find out its PTUUID and PARTUUIDs:
$ sudo blkid /dev/sda
output: /dev/sda: PTUUID=”1a2b3c4d” PTTYPE=”dos”
$sudo blkid /dev/sda1 /dev/sda2
output will be like:
/dev/sda1: … … PARTUUID=”1a2b3c4d-01″
/dev/sda2: … … PARTUUID=”1a2b3c4d-02″
You see: PARTUUID’s depend on the PTUUID!
Now just alter the PARTUUID’s in the fstab of the SSD, shut down the Pi, remove the SD-card and off you go! 😉
2. opportunity:
Install the OS to your SSD as you would install it to your SD-card, stick it in and boot – and have a little pations: booting from USB takes several seconds to recognize the drive.
I prefere the dd-command for setting up the drives:
Boot up from the SD-card, attach the SSD and then, assuming you’ve got the image in your home_dir,
$ sudo dd bs=4M if=bookworm_arm64.img of=/dev/sda status=progress
bs=4M – “Block-Size” = 4 MiBi… speed up things
status=progress – to calm impatient people 😉
hf and success
Krause