Page 2 of 7

Re: Running Raspbian on USB Devices : Made Easy

Posted: Wed Apr 04, 2018 5:06 pm
by HawaiianPi
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Wed Apr 04, 2018 6:48 pm
by RonR
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Wed Apr 04, 2018 8:25 pm
by n67
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Wed Apr 04, 2018 9:49 pm
by RonR
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?

Re: Running Raspbian on USB Devices : Made Easy

Posted: Sat Jun 02, 2018 8:57 pm
by asoltesz
@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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Sat Jun 02, 2018 10:06 pm
by RonR
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Mon Jun 04, 2018 12:10 am
by HawaiianPi
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).

Re: Running Raspbian on USB Devices : Made Easy

Posted: Mon Jul 09, 2018 8:55 am
by Vwpfong
Does raspberry pi 3 b+ still need sdcard first to modify the boot sequence in order to boot from USB drive?

Re: Running Raspbian on USB Devices : Made Easy

Posted: Mon Jul 09, 2018 9:08 am
by DougieLawson
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Fri Jul 13, 2018 5:41 am
by MidGe48
What format is needed on the usb device prior to executing the script?

Thanks for any info.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Fri Jul 13, 2018 5:46 am
by RonR
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Fri Jul 13, 2018 5:58 am
by MidGe48
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

Re: Running Raspbian on USB Devices : Made Easy

Posted: Fri Jul 13, 2018 6:09 am
by RonR
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Fri Jul 13, 2018 6:22 am
by MidGe48
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Fri Jul 13, 2018 10:12 am
by LTolledo
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....

Re: Running Raspbian on USB Devices : Made Easy

Posted: Wed Jul 18, 2018 11:07 pm
by tassau
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?

Re: Running Raspbian on USB Devices : Made Easy

Posted: Thu Jul 19, 2018 2:41 am
by RonR
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

Re: Running Raspbian on USB Devices : Made Easy

Posted: Thu Jul 19, 2018 6:27 pm
by tassau
Thanks for your quick response!

Re: Running Raspbian on USB Devices : Made Easy

Posted: Sat Jul 21, 2018 11:03 am
by fbe
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.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Wed Nov 21, 2018 10:28 pm
by tassau
Everything works fine until the kernel update. How to solve this problem? How to solve the kernel update problem in this configuration?

Re: Running Raspbian on USB Devices : Made Easy

Posted: Wed Nov 21, 2018 10:40 pm
by RonR
tassau wrote:
Wed Nov 21, 2018 10:28 pm
Everything works fine until the kernel update. How to solve this problem? How to solve the kernel update problem in this configuration?
I've been through countless kernel updates and have never experienced any problems.

I've been running Raspbian only on USB flash drives for years now (with an SD card used only for booting).

Re: Running Raspbian on USB Devices : Made Easy

Posted: Thu Nov 22, 2018 2:41 pm
by tassau
I tried to update the Raspbian once again on the USB flash drive and now it works.

I only need to update the Raspbian on the USB flash drive, and this one on the SD card can remain without an update?

Re: Running Raspbian on USB Devices : Made Easy

Posted: Thu Nov 22, 2018 6:25 pm
by RonR
tassau wrote:
Thu Nov 22, 2018 2:41 pm
I tried to update the Raspbian once again on the USB flash drive and now it works.

I only need to update the Raspbian on the USB flash drive, and this one on the SD card can remain without an update?
The boot partition of the SD card is being updated whenever you update the flash drive because the boot partition of the SD card is mounted on /boot when the flash drive is running. The root partition of the SD card is not being used.

Re: Running Raspbian on USB Devices : Made Easy

Posted: Thu Nov 22, 2018 8:57 pm
by tassau
Thank you for explaining!

Re: Running Raspbian on USB Devices : Made Easy

Posted: Fri Dec 21, 2018 3:41 pm
by leptoid
RonR wrote:
Sat Dec 09, 2017 9:15 pm
GGEZ wrote:
Sat Dec 09, 2017 9:00 pm
This method screws up raspi-config. I had to take out the SD card and edit config.txt on my computer. Still not sure how to use raspi-config.
Your problem is not related to the usb-boot script provided in this topic.

raspi-config does not know how to resize Raspbian when it's running from a USB drive, regardess of the method used to put Raspbian on a USB drive.

The attached fix-rc archive (download/file.php?id=19959) contains two solutions to this problem:

1. raspi-config-usb makes a temporary copy of raspi-config, patches it to work, runs the temporary copy, then deletes the temporary copy.

2. patch-rc copies raspi-config to raspi-config-original and patches raspi-config to work.
Ron,

This is like a year late, but I wanted to say thanks. Your script, [raspi-config-original] solved the external HDD issue I was having. Sure enough, you can't expand the FS if the software doesn't know how to on external devices.

Thanks for your contribution.