TheKox25
Posts: 1
Joined: Wed Nov 22, 2017 5:18 pm

Booting from USB

Wed Nov 22, 2017 5:40 pm

Hi, I have thought of enabling "Mass Storage booting" on my Raspberry Pi 3. From what I've read that process is irreversible. Does that mean that I will be able to boot from USB and no more from SD card? Or I'll be able to boot from USB or SD card?

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

Re: Booting from USB

Wed Nov 22, 2017 6:52 pm

TheKox25 wrote:
Wed Nov 22, 2017 5:40 pm
Hi, I have thought of enabling "Mass Storage booting" on my Raspberry Pi 3. From what I've read that process is irreversible. Does that mean that I will be able to boot from USB and no more from SD card? Or I'll be able to boot from USB or SD card?

Boot Flow

https://www.raspberrypi.org/documentati ... bootmodes/
Retired disgracefully.....
This at present is my daily "computer" https://www.asus.com/us/Chrome-Devices/Chromebit-CS10/

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

Re: Booting from USB

Wed Nov 22, 2017 7:56 pm

You will still be able to boot from an SD card.

The Pi3 will check for a boot SD card first, before booting from a USB device. If no boot SD card is found in 5 seconds, then it looks for a boot USB device. So even if the boot USB device is still connected, inserting an SD card will override it.

Also note that not all USB devices are compatible with the simple Pi3 bootloader. Of the various devices I tried, none worked reliably for me, so I have gone back to the older method of having it boot from an SD card, then load and run the OS from an SSD drive. I am still able to do that, even after setting the OTP bit that enabled USB booting. I can also insert a stand alone boot SD card and my SSD will not be used at all.
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?

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

Re: Booting from USB

Wed Nov 22, 2017 8:07 pm

HawaiianPi wrote:
Wed Nov 22, 2017 7:56 pm
You will still be able to boot from an SD card.

The Pi3 will check for a boot SD card first, before booting from a USB device. If no boot SD card is found in 5 seconds, then it looks for a boot USB device. So even if the boot USB device is still connected, inserting an SD card will override it.

Also note that not all USB devices are compatible with the simple Pi3 bootloader. Of the various devices I tried, none worked reliably for me, so I have gone back to the older method of having it boot from an SD card, then load and run the OS from an SSD drive. I am still able to do that, even after setting the OTP bit that enabled USB booting. I can also insert a stand alone boot SD card and my SSD will not be used at all.
I've using a WD 314GB PiDrive with no issues, as well and a CM3L (the "guts" of a Pi3B in a small form factor) in a WD SATA adapter booting from an SSD. Both have been reliable.

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

Re: Booting from USB

Thu Nov 23, 2017 4:17 am

W. H. Heydt wrote:
Wed Nov 22, 2017 8:07 pm
I've using a WD 314GB PiDrive with no issues, as well and a CM3L (the "guts" of a Pi3B in a small form factor) in a WD SATA adapter booting from an SSD. Both have been reliable.
Yup, some devices work fine. Just none that I have tried. There is a small list of compatible devices in the documentation. In my case I tried an SSD on an mSATA-USB adapter, a couple of different flash drives and a USB HDD. Most of them booted fine but had problems with restart and/or shutdown. I've seen others post about similar problems, so my experience is not unique.

I'm sure if i tried every USB MSD in my rather extensive collection I could find something that worked, but I'm fine with leaving /boot on the SD card and running the OS from SSD. It's 100% reliable (boot, restart and shutdown all function as expected), and the boot time is actually quicker since there is no 5 second SD card timeout.

Supposedly there is a way to set another OTP bit and skip the SD check with some GPIO pins, which I may look into eventually, but for now it works and I have other things with higher priorities at the moment.
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?

willirl
Posts: 2
Joined: Fri Feb 16, 2018 9:07 pm

Re: Booting from USB

Mon Mar 05, 2018 6:28 pm

Can you please tell me how to set up everything to do the boot from the sd and get the OS from an ssd?

RonR
Posts: 746
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Booting from USB

Mon Mar 05, 2018 8:32 pm

willirl wrote:
Mon Mar 05, 2018 6:28 pm
Can you please tell me how to set up everything to do the boot from the sd and get the OS from an ssd?
viewtopic.php?f=29&t=196778

stuartiannaylor

Re: Booting from USB

Thu Apr 11, 2019 6:17 pm

Just been having a look at https://ubuntu-mate.org/raspberry-pi/ub ... xt4.img.xz and seems to be fine on a USB stick.

Just wondering is there a way to force USB even when a SD card with OS is in place?

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

Re: Booting from USB

Fri Apr 12, 2019 2:22 am

stuartiannaylor wrote:
Thu Apr 11, 2019 6:17 pm
Just wondering is there a way to force USB even when a SD card with OS is in place?
The default is to boot from SD card first. You can only change that by setting an additional OPT bit, and then your system will not boot at all unless you pull certain GPIO pins high or low to tell it to boot from either USB or SD card.

https://www.raspberrypi.org/documentati ... ootflow.md
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?

stuartiannaylor

Re: Booting from USB

Sun Apr 14, 2019 2:13 am

HawaiianPi wrote:
Fri Apr 12, 2019 2:22 am
stuartiannaylor wrote:
Thu Apr 11, 2019 6:17 pm
Just wondering is there a way to force USB even when a SD card with OS is in place?
The default is to boot from SD card first. You can only change that by setting an additional OPT bit, and then your system will not boot at all unless you pull certain GPIO pins high or low to tell it to boot from either USB or SD card.

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

mikev1963
Posts: 6
Joined: Sun Oct 18, 2015 1:23 am

Re: Booting from USB

Wed Jul 31, 2019 12:33 pm

Will I get better performance when booted via the USB stick or sd card?

User avatar
PeterO
Posts: 5318
Joined: Sun Jul 22, 2012 4:14 pm

Re: Booting from USB

Wed Jul 31, 2019 12:40 pm

mikev1963 wrote:
Wed Jul 31, 2019 12:33 pm
Will I get better performance when booted via the USB stick or sd card?
Where you boot from isn't the important thing. It's where the root file system is mounted from that matters.
Pi4s won't currently boot from anything other than SD cards but can easily be made to then mount the root file system from an external USB device.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

RonR
Posts: 746
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Booting from USB

Wed Jul 31, 2019 5:30 pm

mikev1963 wrote:
Wed Jul 31, 2019 12:33 pm
Will I get better performance when booted via the USB stick or sd card?
Running Raspbian from a fast USB 3 flash drive or SSD instead of an SD card will immensely improve performance.

It's a trivial task to accomplish on an PI 1, 2, 3, AND 4 using usb-boot.

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

Re: Booting from USB

Wed Jul 31, 2019 10:14 pm

RonR wrote:
Wed Jul 31, 2019 5:30 pm
Running Raspbian from a fast USB 3 flash drive or SSD instead of an SD card will immensely improve performance.
That's a bit too generalised.

Performance of USB flash drives varies wildly, and some are quite bad (the PNY Attache series drives I've tested were atrocious). The key to better performance from an OS drive is not sequential read and write, which are the performance ratings most often published. What you want from an OS drive is higher read/write IOPS (Input Output operations Per Second). I have tested some USB flash drives with near SSD level sequential read/write, but terrible IOPS.
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?

RonR
Posts: 746
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Booting from USB

Wed Jul 31, 2019 10:37 pm

HawaiianPi wrote:
Wed Jul 31, 2019 10:14 pm
RonR wrote:
Wed Jul 31, 2019 5:30 pm
Running Raspbian from a fast USB 3 flash drive or SSD instead of an SD card will immensely improve performance.
That's a bit too generalised.

Performance of USB flash drives varies wildly, and some are quite bad (the PNY Attache series drives I've tested were atrocious).
That's why I stated "a fast USB 3 flash drive or SSD".

These inexpensive 32 GB USB flash drives write at 25 - 30 MB/s and read at 200 MB/s (reported by Etcher):

Samsung BAR Plus 32GB

I've been using these for months and they have proven to be very reliable as well as quite fast.

I've been running all Pi's (1, 2, 3, and 4) for the past 5+ years on USB flash drives instead of SD cards and the performance improvements are readily obvious compared to using even premium SD cards.

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

Re: Booting from USB

Thu Aug 01, 2019 12:47 am

Sequential read/write is not what's important. What do they get for random IOPS?

I have a very fast USB 3.0 flash drive that reads at over 300MB/s and writes over 200, but has terrible IOPS (and sucks as an OS drive).

As I said, you can't just imply that any "fast" USB flash drive will be faster.

I've been running all Pi's (1, 2, 3, and 4) for the past 5+ years on USB flash drives instead of SD cards and the performance improvements are readily obvious compared to using even premium SD cards.
That has not been my experience. Some were faster, some were slower, and A1 performance rated cards beat most of them.

Thanks for letting us know what you are getting good results with now. Looks interesting. I may give one a try.
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?

RonR
Posts: 746
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Booting from USB

Thu Aug 01, 2019 2:04 am

HawaiianPi wrote:
Thu Aug 01, 2019 12:47 am
As I said, you can't just imply that any "fast" USB flash drive will be faster.
My observations are based on real-world experiences, not some IOPS benchmark test.

For several years now, I've been building PBX systems on Raspberry Pi's several times a week (sometimes a day):

FreePBX-for-the-Raspberry-Pi

This build is now down to about 35 minutes running on a Raspberry Pi 4 using a USB 3 flash drive. Even using average USB flash drives, the process completes in significantly less time than performing it on an premium SD card. Most inexpensive USB 3 flash drives are dramatically faster even when used on USB 2 interfaces and result in performance improvements that can't be ignored on earlier Raspberry Pi's (1/2/3).

The point is, running Raspbian on almost any USB flash drive will get you a system that completes tasks faster than one running on an SD card. USB flash drives are more convenient to work with and typically don't experience the failure rates that SD cards do. It's not clear why anyone wouldn't be in favor of any amount of performance improvement.

waqas786
Posts: 1
Joined: Thu Nov 14, 2019 8:13 am

Re: Booting from USB

Tue Nov 26, 2019 8:07 am

Hi All,

Is it possible to boot from USB whereas the "Corrupt SD Card" is in the slot also? Does anyone practically do this? Are the content of "SD card " visible if the USB boot possible?

Return to “Beginners”