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

Re: Running Raspbian on USB Devices : Made Easy

Wed Apr 04, 2018 5:06 pm

Direct USB boot of a Pi3B or Pi3B+ works for me, even with another non-boot USB storage device connected. But RonR is correct that the bootcode.bin only method may fail with more than one USB storage device connected (bootcode.bin will only attempt to boot the first USB drive it finds, and there is no way to ensure that will always be your intended boot device).

However, there are problems associated with keeping /boot on the SD card as well. The script that automatically resizes the root partition will work on your USB boot device when booted directly, or using bootcode.bin only, but it will fail if /boot and / (root) are on different devices. And mucking about with partitions can be a daunting task for those not familiar with such things.

There is no one-answer-fits-all solution.
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: 274
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Wed Apr 04, 2018 6:48 pm

HawaiianPi wrote:
Wed Apr 04, 2018 5:06 pm
However, there are problems associated with keeping /boot on the SD card as well. The script that automatically resizes the root partition will work on your USB boot device when booted directly, or using bootcode.bin only, but it will fail if /boot and / (root) are on different devices. And mucking about with partitions can be a daunting task for those not familiar with such things.
What "mucking about with partitions" is needed? You simply run raspi-config-usb (download/file.php?id=19959) and select "Expand Filesystem". No knowledge of partitions is needed.

n67
Posts: 800
Joined: Mon Oct 30, 2017 4:55 pm

Re: Running Raspbian on USB Devices : Made Easy

Wed Apr 04, 2018 8:25 pm

What "mucking about with partitions" is needed?
Your script is not standard. It requires downloading some script from some website over the Internet, and it requires trusting some entity that posts to a forum as "RonR".

You can assume that when regulars talk about what can and can't be done, they mean using only standard, approved tools.

Note: I'm not necessarily saying that is a good thing or a bad thing, but it is the facts as they are.
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

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

Re: Running Raspbian on USB Devices : Made Easy

Wed Apr 04, 2018 9:49 pm

n67 wrote:
Wed Apr 04, 2018 8:25 pm
Your script is not standard. It requires downloading some script from some website over the Internet, and it requires trusting some entity that posts to a forum as "RonR".

You can assume that when regulars talk about what can and can't be done, they mean using only standard, approved tools.

The "some website over the Internet" where the "some script" is posted is this forum (https://www.raspberrypi.org/forums/). I'm confident the moderators here would have removed the script and/or posted a warning if there was anything remotely nefarious contained in it.

I have to wonder why posting to this forum as "RonR" requires more trust than that of someone who posts as "n67".

Does someone actually have to approve and declare something to be 'standard' before it can be used (and who is that someone)? Where is the list of standard, approved tools that users should limit themselves to using?

asoltesz
Posts: 1
Joined: Sat Jun 02, 2018 8:50 pm

Re: Running Raspbian on USB Devices : Made Easy

Sat Jun 02, 2018 8:57 pm

@RonR

Thanks for the script, it helped me moving to the external drive.

One thing I had to correct manually is that the /boot mount entry remained as referencing the mmcblk1 device in /etc/fstab.

Is the script supposed to modify that?

It may be worth posting this script to Github into a repo so that it can be found more easily.

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

Re: Running Raspbian on USB Devices : Made Easy

Sat Jun 02, 2018 10:06 pm

asoltesz wrote:
Sat Jun 02, 2018 8:57 pm
One thing I had to correct manually is that the /boot mount entry remained as referencing the mmcblk1 device in /etc/fstab.

Is the script supposed to modify that?
It's best that the /boot mount entry in /etc/fstab references /dev/mmcblk0p1. That's where booting is actually originating from and things like raspi-config need to make changes to /dev/mmcblk0p1. The boot partition of the USB device is not used. usb-boot is setting things up correctly.

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

Re: Running Raspbian on USB Devices : Made Easy

Mon Jun 04, 2018 12:10 am

asoltesz wrote:
Sat Jun 02, 2018 8:57 pm
One thing I had to correct manually is that the /boot mount entry remained as referencing the mmcblk1 device in /etc/fstab.

Is the script supposed to modify that?
RonR's assumption is that we all want to have more than one bootable USB drive attached to our systems, and starting the boot process from SD is required to ensure that the correct boot device is chosen, and you'll want the SD card mounted as /boot for kernel and firmware updates to be properly applied (in which case the boot partition on the USB drive is just wasted space and not needed).

For pure, no-SD-card USB boot you are correct to mount the USB drive boot partition to /boot (and, of course, you'll only want a single USB boot drive connected to your system).
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?

Vwpfong
Posts: 1
Joined: Mon Jul 09, 2018 8:51 am

Re: Running Raspbian on USB Devices : Made Easy

Mon Jul 09, 2018 8:55 am

Does raspberry pi 3 b+ still need sdcard first to modify the boot sequence in order to boot from USB drive?

User avatar
DougieLawson
Posts: 33815
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Running Raspbian on USB Devices : Made Easy

Mon Jul 09, 2018 9:08 am

Vwpfong wrote:
Mon Jul 09, 2018 8:55 am
Does raspberry pi 3 b+ still need sdcard first to modify the boot sequence in order to boot from USB drive?
No. The USB boot bit is set in the factory.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

MidGe48
Posts: 14
Joined: Sun Dec 27, 2015 4:37 am

Re: Running Raspbian on USB Devices : Made Easy

Fri Jul 13, 2018 5:41 am

What format is needed on the usb device prior to executing the script?

Thanks for any info.

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

Re: Running Raspbian on USB Devices : Made Easy

Fri Jul 13, 2018 5:46 am

MidGe48 wrote:
Fri Jul 13, 2018 5:41 am
What format is needed on the usb device prior to executing the script?
The USB device need not be formatted. The usb-boot script will partition and format the USB device for you.

MidGe48
Posts: 14
Joined: Sun Dec 27, 2015 4:37 am

Re: Running Raspbian on USB Devices : Made Easy

Fri Jul 13, 2018 5:58 am

Thank you for your extremely prompt reply and interest. :)

My device is brand new, out of the box, and I get the following when plugging it in the pi (but not on any other machine where it shows as exfat formatted):

Error mounting /dev/sda1 at /media/pi/Extreme 500: Command-line `mount -t "exfat" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,iocharset=utf8,namecase=0,errors=remount-ro" "/dev/sda1" "/media/pi/Extreme 500"' exited with non-zero exit status 32: mount: unknown filesystem type 'exfat'

Thus it is not mounted. I can easily format it any way using gparted on one of my debian machines without any problems, but I am not certain as to which formatting would be the best for the script run.

Thanks again

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

Re: Running Raspbian on USB Devices : Made Easy

Fri Jul 13, 2018 6:09 am

I suspect the problem is your system is trying to auto-mount the device as soon as you plug it and and exfat isn't supported.

The device doesn't need to be (and shouldn't be) mounted prior to running usb-boot.

usb-boot will present you with a list of /dev/sdX devices it finds and ask you to select the one to work on (be careful to pick the correct one!).

If you must format the device in order to get past some anomaly, use ext4.

MidGe48
Posts: 14
Joined: Sun Dec 27, 2015 4:37 am

Re: Running Raspbian on USB Devices : Made Easy

Fri Jul 13, 2018 6:22 am

Yes that was the problem and the solution was as simple as deleting the existing partition and starting again with no partition. Of course, ext4 would have worked as well. It is now copying the BOOT/ROOT.

Thanks very much for your help.

LTolledo
Posts: 637
Joined: Sat Mar 17, 2018 7:29 am

Re: Running Raspbian on USB Devices : Made Easy

Fri Jul 13, 2018 10:12 am

I encountered problem with RPi1B+' s Silicon Power microSD card (a brand that has failed me repeatedly), it became corrupted even after doing proper shutdown sequence.

So I decided to run Raspbian via USB Flash memory/stick,drive/key (USB Flash)

As it is a Raspberry Pi Model B+ v1.2 native USB boot (microSD card-less boot) is out of the question
Just for kicks I tried setting the OTP bit 17, and as expected it never changed.

Tried some of the video tutorials in the 'net to boot from USB, but all failed. I tried doing my own version but that failed too.

Then as a last resort I tried the bootcode.bin method, that is copying the bootcode.bin file to a FAT32 freshly formatted 512MB microSD card.
I also flashed 2018--06-27-raspbian-stretch image to a 16GB USB Flash .

inserted the microUSB with bootcode.bin in the microSD slot.
plugged the 16GB USB flash with raspbian stretch image in one of the vacant USB ports
powered up the setup (using 5v2.0A PSU)

RPi booted and proceeded with the installation
even after several reboots no problems encountered.

As am using it as a sort of NAS I need to plug in a 256GB USB Flash in one of the remaining vacant USB ports.
plugged the darn thing anyway and hoped for the best.

After several reboots during samba setup, no problems were encountered at boot up.
the cmdline.txt and fstab files were never edited during the course of the setup.

And it still boots normally as of now. Booting from USB using bootcode.bin method made it easy. for me
...and will never use Silicon Power again....
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

tassau
Posts: 2
Joined: Wed Jul 18, 2018 10:54 pm

Re: Running Raspbian on USB Devices : Made Easy

Wed Jul 18, 2018 11:07 pm

The 'usb-boot' script works perfectly. Thanks to RonR!

What do I need to change to go back to booting and run on my SD card (if I don't want to use the USB flash drive anymore)?
How do I return to the original configuration?

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

Re: Running Raspbian on USB Devices : Made Easy

Thu Jul 19, 2018 2:41 am

tassau wrote:
Wed Jul 18, 2018 11:07 pm
What do I need to change to go back to booting and run on my SD card (if I don't want to use the USB flash drive anymore)?
How do I return to the original configuration?
Simply edit /boot/cmdline.txt and change:

root=PARTUUID=????????-02

to

root=/dev/mmcblk0p2

I keep two lines in /boot/cmdline.txt and comment out the one I don't want (no blank lines allowed!):

Code: Select all

# dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=????????-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

tassau
Posts: 2
Joined: Wed Jul 18, 2018 10:54 pm

Re: Running Raspbian on USB Devices : Made Easy

Thu Jul 19, 2018 6:27 pm

Thanks for your quick response!

fbe
Posts: 340
Joined: Thu Aug 17, 2017 9:08 pm

Re: Running Raspbian on USB Devices : Made Easy

Sat Jul 21, 2018 11:03 am

RonR wrote:
Thu Jul 19, 2018 2:41 am
Simply edit /boot/cmdline.txt and change:

root=PARTUUID=????????-02

to

root=/dev/mmcblk0p2
...
This may work, but it will fail if there were kernal updates meanwhile. Maybe the old boot partition contents is still available on your USB drive.

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 14 guests