M1dn1ghtN1nj4
Posts: 12
Joined: Sat Dec 16, 2017 4:22 am
Contact: YouTube

Possible to boot from USB AND SDCARD?

Wed Jan 02, 2019 5:45 am

I have the RPi 3 B+, mounted inside a custom 3D printed case. Getting to the microSD card isn't easy.

I read that you can change the Pi to boot from USB using the OTP bit. But I'm left with a lingering question.

Once that bit is set to allow booting from USB, will it continue to boot from the microSD card if no USB bootable media is found? Just like a laptop? Does that render the microSD card slot useless forever?

I want to continue to use the microSD card, but boot from USB as a recovery option, or to boot a different system instead of the one on the microSD card.

It kinda sounds like the OTP bit sets it to boot from USB "OR" MICROSD, but not both.

Reference:
https://www.raspberrypi.org/documentati ... des/msd.md

W. H. Heydt
Posts: 10569
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Possible to boot from USB AND SDCARD?

Wed Jan 02, 2019 6:09 am

M1dn1ghtN1nj4 wrote:
Wed Jan 02, 2019 5:45 am
I have the RPi 3 B+, mounted inside a custom 3D printed case. Getting to the microSD card isn't easy.

I read that you can change the Pi to boot from USB using the OTP bit. But I'm left with a lingering question.
On the Pi3B+, that bit is set at the factory.
Once that bit is set to allow booting from USB, will it continue to boot from the microSD card if no USB bootable media is found? Just like a laptop? Does that render the microSD card slot useless forever?
It's the other way around. It will first check for a bootable SD card. If one is found, it boots from that. If one isn't found (or isn't bootable), then it starts looking through the available USB devices for one it can boot from.
I want to continue to use the microSD card, but boot from USB as a recovery option, or to boot a different system instead of the one on the microSD card.
That will work mostly as you've stated it. So long as there is a bootable image on the SD card, that will be your boot device. If the SD card fails or isn't a bootable image, then it will boot from the USB device (assuming it has a bootable image).
It kinda sounds like the OTP bit sets it to boot from USB "OR" MICROSD, but not both.

Reference:
https://www.raspberrypi.org/documentati ... des/msd.md
It's a *sequence*. First check the SD card. Can it boot? Then do so. It can't boot? Check for a USB boot device.

And note that since you're using a Pi3B+, it's already set up to do this. Take out your SD card and connect a bootable USB device and watch your Pi boot right up.

M1dn1ghtN1nj4
Posts: 12
Joined: Sat Dec 16, 2017 4:22 am
Contact: YouTube

Re: Possible to boot from USB AND SDCARD?

Wed Jan 02, 2019 5:09 pm

Perfect. I just wanted to be sure I didn't do something I couldn't fix. I know these aren't $2500 computers (like my laptop), but still, I'd prefer to be careful. I'm going to try that out this afternoon, and I'll let you know what happens. Thanks for the clarification. :D

W. H. Heydt
Posts: 10569
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Possible to boot from USB AND SDCARD?

Wed Jan 02, 2019 6:24 pm

M1dn1ghtN1nj4 wrote:
Wed Jan 02, 2019 5:09 pm
Perfect. I just wanted to be sure I didn't do something I couldn't fix. I know these aren't $2500 computers (like my laptop), but still, I'd prefer to be careful. I'm going to try that out this afternoon, and I'll let you know what happens. Thanks for the clarification. :D
You're welcome. It's a point that causes some confusion, so you're not alone in that.

To give a concrete example... I had a Pi3B with the bit set booting from a USB device (a PiDrive, a 314GB HDD). When I got my first Pi3B+, I updated the system and swapped the Pi3B+ for the Pi3B and it booted right up.

M1dn1ghtN1nj4
Posts: 12
Joined: Sat Dec 16, 2017 4:22 am
Contact: YouTube

Re: Possible to boot from USB AND SDCARD?

Sat Jan 05, 2019 5:35 am

Is there some way to change the boot order? I'd like it to look at the USB devices first, THEN if nothing is found to be bootable, proceed to the sdcard.

I want to be able to boot from USB to do some offline maintenance every so often, and not have to disassemble my tower to remove the sdcard (you'll understand when I get my video edited next week).

fruitoftheloom
Posts: 20123
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Possible to boot from USB AND SDCARD?

Sat Jan 05, 2019 9:53 am

M1dn1ghtN1nj4 wrote:
Sat Jan 05, 2019 5:35 am
Is there some way to change the boot order? I'd like it to look at the USB devices first, THEN if nothing is found to be bootable, proceed to the sdcard.

I want to be able to boot from USB to do some offline maintenance every so often, and not have to disassemble my tower to remove the sdcard (you'll understand when I get my video edited next week).

https://www.raspberrypi.org/documentati ... ootflow.md
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

M1dn1ghtN1nj4
Posts: 12
Joined: Sat Dec 16, 2017 4:22 am
Contact: YouTube

Re: Possible to boot from USB AND SDCARD?

Sat Jan 05, 2019 6:16 pm

fruitoftheloom wrote:
Sat Jan 05, 2019 9:53 am
M1dn1ghtN1nj4 wrote:
Sat Jan 05, 2019 5:35 am
Is there some way to change the boot order? I'd like it to look at the USB devices first, THEN if nothing is found to be bootable, proceed to the sdcard.

I want to be able to boot from USB to do some offline maintenance every so often, and not have to disassemble my tower to remove the sdcard (you'll understand when I get my video edited next week).

https://www.raspberrypi.org/documentati ... ootflow.md
While I've been a PC tech for pretty much my whole life, there are aspects of certain components I still have trouble with. After reading this through, at least 3 times, it sounds like you can't actually change the boot "order". So in order to actually boot off of a USB drive on my Pi (not using USB host booting), I'd still have to remove the sdcard from the system.

That basically renders my hopeful setup useless. I can boot off of USB, but only if the sdcard is removed. But that also means that I can't access the sdcard once booted off of USB, as it isn't in the Pi anymore. And for all that work, I might as well just plug the sdcard into my laptop directly, and work on it there.

User avatar
HawaiianPi
Posts: 4445
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Possible to boot from USB AND SDCARD?

Sat Jan 05, 2019 6:59 pm

M1dn1ghtN1nj4 wrote:
Sat Jan 05, 2019 6:16 pm
While I've been a PC tech for pretty much my whole life, there are aspects of certain components I still have trouble with. After reading this through, at least 3 times, it sounds like you can't actually change the boot "order". So in order to actually boot off of a USB drive on my Pi (not using USB host booting), I'd still have to remove the sdcard from the system.
Nope, that's not correct. While you can't truly change the boot order, you can tell it to boot from either USB or SD, regardless of card state.

If you use the GPIO option you can control the boot device with a switch. Once that option is set the Pi will check the GPIO and boot from either SD or USB, depending on what it finds on certain GPIO pins. By pulling the relevant pins high or low you tell the Pi which to boot from.

In simple terms, flip a switch one way and it boots from SD card. Flip it the other way and it boots from USB.

The down side is that some of the GPIO is used, which may complicate the use of some HATs or other GPIO projects.

The relevant section is this:
The GPIO boot mode OTP bits can be programmed by adding program_gpio_bootmode=n to config.txt, where n is 1 to select the low bank (22-26) or 2 to select the high bank (39-43). Once added, boot the device, then power-cycle it (rebooting is not sufficient). You should expect it to no longer boot (all boot modes will be disabled by default). Apply a pull-up to the required pin to enable the required boot mode. After programming, the config.txt setting can be removed.

Note that this is a permanent change that cannot be undone once it has been enabled. That means your Pi3B/3B+ will always need a pull-up on the GPIO to boot (without it the Pi will not boot at all). Also be careful not to set the wrong GPIO range, as that could brick your Pi. I believe the correct range is low for the consumer Pi3B/3B+, but double-check that before programming the OTP bit (other range is only for CM).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
DarkPlatinum
Posts: 839
Joined: Thu Nov 02, 2017 2:30 pm
Location: Unknown
Contact: Website YouTube

Re: Possible to boot from USB AND SDCARD?

Sat Jan 05, 2019 7:26 pm

Yes you can! You can use PINN! The SD card holds the boot partition, the USB drive holds the root partition. Here is a tutorial: https://html.dynu.net/index.php/installing-pinn/
1 * Raspberry Pi Zero W, 1 * Raspberry Pi 2, 1 * Raspberry Pi 3 1 * Raspberry Pi 3B + :mrgreen:

Check Out My Raspberry Site (Run on a Raspberry Pi 3B :) ): https://html.dynu.net

Return to “Beginners”