Booting from USB
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?
-
- Posts: 25196
- Joined: Tue Mar 25, 2014 12:40 pm
- Location: Delightful Dorset
Re: Booting from USB
The information is out there....you just have to let it in.
- HawaiianPi
- Posts: 6129
- Joined: Mon Apr 08, 2013 4:53 am
- Location: Aloha, Oregon USA
Re: Booting from USB
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.
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?
lots of pop-ups...and where is that annoying music coming from?
-
- Posts: 13972
- Joined: Fri Mar 09, 2012 7:36 pm
- Location: Vallejo, CA (US)
Re: Booting from USB
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.HawaiianPi wrote: ↑Wed Nov 22, 2017 7:56 pmYou 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.
- HawaiianPi
- Posts: 6129
- Joined: Mon Apr 08, 2013 4:53 am
- Location: Aloha, Oregon USA
Re: Booting from USB
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.W. H. Heydt wrote: ↑Wed Nov 22, 2017 8:07 pmI'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.
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?
lots of pop-ups...and where is that annoying music coming from?
Re: Booting from USB
Can you please tell me how to set up everything to do the boot from the sd and get the OS from an ssd?
Re: Booting from USB
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?
Just wondering is there a way to force USB even when a SD card with OS is in place?
- HawaiianPi
- Posts: 6129
- Joined: Mon Apr 08, 2013 4:53 am
- Location: Aloha, Oregon USA
Re: Booting from USB
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.stuartiannaylor wrote: ↑Thu Apr 11, 2019 6:17 pmJust wondering is there a way to force USB even when a SD card with OS is in place?
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?
lots of pop-ups...and where is that annoying music coming from?
Re: Booting from USB
Thanks.HawaiianPi wrote: ↑Fri Apr 12, 2019 2:22 amThe 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.stuartiannaylor wrote: ↑Thu Apr 11, 2019 6:17 pmJust wondering is there a way to force USB even when a SD card with OS is in place?
https://www.raspberrypi.org/documentati ... ootflow.md
Re: Booting from USB
Will I get better performance when booted via the USB stick or sd card?
Re: Booting from USB
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
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
Re: Booting from USB
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.
- HawaiianPi
- Posts: 6129
- Joined: Mon Apr 08, 2013 4:53 am
- Location: Aloha, Oregon USA
Re: Booting from USB
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?
lots of pop-ups...and where is that annoying music coming from?
Re: Booting from USB
That's why I stated "a fast USB 3 flash drive or SSD".HawaiianPi wrote: ↑Wed Jul 31, 2019 10:14 pmThat'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).
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.
- HawaiianPi
- Posts: 6129
- Joined: Mon Apr 08, 2013 4:53 am
- Location: Aloha, Oregon USA
Re: Booting from USB
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.
Thanks for letting us know what you are getting good results with now. Looks interesting. I may give one a try.
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.
That has not been my experience. Some were faster, some were slower, and A1 performance rated cards beat most of them.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.
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?
lots of pop-ups...and where is that annoying music coming from?
Re: Booting from USB
My observations are based on real-world experiences, not some IOPS benchmark test.HawaiianPi wrote: ↑Thu Aug 01, 2019 12:47 amAs I said, you can't just imply that any "fast" USB flash drive will be faster.
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.
Re: Booting from USB
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?
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?