Brad Q
Posts: 105
Joined: Mon Aug 12, 2019 12:10 am

Re: Running Raspbian from USB Devices : Made Easy

Thu Nov 07, 2019 10:41 pm

I suspect that this is something you have done that is not (at least directly) related to usb-boot. As I stated above my system behaves "normally". Everything is auto mounted that same as it was before the use of usb-boot.

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

Re: Running Raspbian from USB Devices : Made Easy

Fri Nov 08, 2019 4:38 am

LTolledo wrote:
Thu Nov 07, 2019 10:19 pm
Just to clarify:

The condition stated was observed on an RPi4B-4G with Raspbian Buster Full Desktop system after it was successfully transferred from microSD to USB-SSD using usb-boot. The system is running fine with the rootfs located on the USB-SSD.

prior to the change (still on native microSD boot), any USB device hot-plugged to RPi4B's vacant USB port is auto-mounted in /media/pi

after using usb-boot to transfer the system to USB-SSD, any USB drive hot-plugged to any USB port is not auto-mounted

however, any USB drive plugged to RPi4B's USB before bootup, the USB drive is always auto-mounted.


so...when running the usb-boot script, was there modification in the system setting that prevents a successfully transferred system from auto-mounting any hot-plugged drives?
if there is... would like to undo that setting myself, to re-enable hot-plugging on a successfully transferred system.
if none... will look at something else....

As previously stated, usb-boot isn't involved with auto-mounting in any way.

I just installed Raspbian Buster Full Desktop on an RPi4B-4G and verified that auto-mounting works perfectly running from the SD card. I then ran usb-boot to replicate the SD card to a USB device and rebooted. The USB device booted as expected and any USB drive hot-plugged to any USB port is auto-mounted as expected. Ejecting the USB drive and reinserting it auto-mounts it again.

I don't see a problem.

iznobe
Posts: 646
Joined: Sun Feb 05, 2017 4:14 pm
Location: Avignon , FRANCE

Re: Running Raspbian from USB Devices : Made Easy

Fri Nov 08, 2019 9:24 am

Hello ,

i notice that there is a minor error in your code , about line 101 :

Code: Select all

if [ -b /dev/mmcblk0 ]; then
  USESDC=TRUE
else
  USESDC=[b]FLASE[/b]
fi
i haven't read all :roll:

just one question , the reserved blocks on SSD drives does not all have same size , i'm right ?
so it is dangerous to do this like this ?
is it possible to install raspbian buster directly on the hard drive ?

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

Re: Running Raspbian from USB Devices : Made Easy

Fri Nov 08, 2019 6:43 pm

iznobe wrote:
Fri Nov 08, 2019 9:24 am
i notice that there is a minor error in your code , about line 101 :

Code: Select all

if [ -b /dev/mmcblk0 ]; then
  USESDC=TRUE
else
  USESDC=[b]FLASE[/b]
fi

That's definitely a typo, but it's of virtually no consequence. The only place USESDC is tested for being FALSE is to warn if the user has removed the SD card prior to running usb-boot on a non-RPi-3B+. I'll fix the typo, but it's nothing to be concerned about. Thanks for alerting me.
iznobe wrote:
Fri Nov 08, 2019 9:24 am
just one question , the reserved blocks on SSD drives does not all have same size , i'm right ?
so it is dangerous to do this like this ?
is it possible to install raspbian buster directly on the hard drive ?

I'm not sure what you're referring to, but no problems have been reported with SSD drives in the two years that usb-boot has been posted here. Any version of Raspbian can be written directly to any USB device and used with usb-boot.

LTolledo
Posts: 5154
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Running Raspbian from USB Devices : Made Easy

Wed Nov 13, 2019 9:53 am

RonR wrote:
Fri Nov 08, 2019 4:38 am
The USB device booted as expected and any USB drive hot-plugged to any USB port is auto-mounted as expected. Ejecting the USB drive and reinserting it auto-mounts it again.

I don't see a problem.
Just an update...
I've determined the cause of the auto-mount problem.... it seemed the "source" microSD installation prior to using usb-boot was the culprit. it too was not auto-mounting any drive hot-plugged to any USB port.
sorry for the mis-conception on my part :oops:

am rebuilding the setup, and confident will get same result as yours. :D

Thanks 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!"

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

Re: Running Raspbian from USB Devices : Made Easy

Thu Nov 14, 2019 6:54 am

I've attached a companion script named sdc-boot to the first post in this topic.

sdc-boot provides a convenient way to select which attached device will be booted.

Usage syntax is:

sdc-boot [ /dev/mmcblk0 | /dev/sdX | ptuuid=hhhhhhhh ]

/dev/mmcblk0 is the SD card

/dev/sdX is a USB device

ptuuid=hhhhhhhh is a USB device identified by its PTUUID

If no device is specified, the currently selected boot device will be displayed.

User avatar
kanitelka
Posts: 1
Joined: Thu Nov 14, 2019 11:05 am
Contact: Website

Re: Running Raspbian from USB Devices : Made Easy

Thu Nov 14, 2019 11:17 am

RonR thanks for the script. May be add in script? => NOTE: Do NOT use usb-boot on NOOBS

I did not understand about the directory /home the HankB wrote.

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

Re: Running Raspbian from USB Devices : Made Easy

Thu Nov 14, 2019 5:45 pm

kanitelka wrote:
Thu Nov 14, 2019 11:17 am
May be add in script? => NOTE: Do NOT use usb-boot on NOOBS

usb-boot originally did not support NOOBS. usb-boot was later enhanced to support NOOBS.
kanitelka wrote:
Thu Nov 14, 2019 11:17 am
I did not understand about the directory /home the HankB wrote.

HankB had a very non-standard environment where he had moved his /home directory to another drive.

arasuk
Posts: 3
Joined: Sat Nov 16, 2019 10:56 am
Location: Sydney, Australia

Re: Running Raspbian on USB Devices : Made Easy

Sun Nov 17, 2019 4:19 pm

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 (https://www.raspberrypi.org/forums/down ... p?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.
What to do with the files to boot. That is the mail problem.
If you can kindly elaborate, that would be fine.. My Raspbian is not booting.

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

Re: Running Raspbian on USB Devices : Made Easy

Sun Nov 17, 2019 7:45 pm

arasuk wrote:
Sun Nov 17, 2019 4:19 pm
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 (https://www.raspberrypi.org/forums/down ... p?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.
What to do with the files to boot. That is the mail problem.
If you can kindly elaborate, that would be fine.. My Raspbian is not booting.

The two-year old post you quoted has nothing to do with Raspbian not booting.

If you are having a problem with usb-boot, please describe the steps you are taking and what is occurring along the way.

If your problem is not related to usb-boot, please start a new topic.

folaht
Posts: 2
Joined: Wed Dec 18, 2019 10:53 am

Re: Running Raspbian from USB Devices : Made Easy

Fri Dec 20, 2019 5:24 pm

Two stupid question:

1. Do I run sdc-boot first and then usb-boot?
Or do I only need to run usb-boot?

2. Do I need to run sdc/usb-boot on my rapberry Pi or on a seperate computer?
If so, my computer does not have an SD card slot, so it recognizes my SD card
as /dev/sdX and not as /dev/mmcblk0.

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

Re: Running Raspbian from USB Devices : Made Easy

Fri Dec 20, 2019 8:19 pm

folaht wrote:
Fri Dec 20, 2019 5:24 pm
1. Do I run sdc-boot first and then usb-boot?
Or do I only need to run usb-boot?

usb-boot is used to set up bootable USB devices and would be run first.
folaht wrote:
Fri Dec 20, 2019 5:24 pm
2. Do I need to run sdc/usb-boot on my rapberry Pi or on a seperate computer?
If so, my computer does not have an SD card slot, so it recognizes my SD card
as /dev/sdX and not as /dev/mmcblk0.

sdc-boot is a companion script to allow you to select which of multiple boot devices will be booted following a reboot. sdc-boot is run on the Raspberry Pi and can be used to switch back and forth between booting the SD card and one or more bootable USB devices.

munklefish
Posts: 92
Joined: Tue Oct 02, 2012 5:35 pm
Location: Neumarkt in der Oberpfalz
Contact: Website

Re: Running Raspbian from USB Devices : Made Easy

Wed Dec 25, 2019 11:38 am

Does this work for Pi 4b ?
http://www.codeclinic.de

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

Re: Running Raspbian from USB Devices : Made Easy

Wed Dec 25, 2019 7:21 pm

munklefish wrote:
Wed Dec 25, 2019 11:38 am
Does this work for Pi 4b ?

Yes.

Raspberry Pi 1, 2, 3, and 4.

echmain
Posts: 327
Joined: Fri Mar 04, 2016 8:26 pm

Re: Running Raspbian from USB Devices : Made Easy

Wed Dec 25, 2019 8:48 pm

Yes, I ran this script this morning on my Pi 4 (4gb).

Worked perfectly.

One question I have though...

All the old files are still there on the SD card...somewhere, right? (Or do they get deleted during the script?) And they don’t get updated when doing apt update/upgrade (also right?)

If I were to go back to booting from the SD card (possibly months later) would those files be out of sync? And would doing and apt update/upgrade work ok?

Thanks!

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

Re: Running Raspbian from USB Devices : Made Easy

Wed Dec 25, 2019 9:06 pm

echmain wrote:
Wed Dec 25, 2019 8:48 pm
If I were to go back to booting from the SD card (possibly months later) would those files be out of sync? And would doing and apt update/upgrade work ok?

Thanks!
Yes it should work if you are able to enter these commands. I had some issues with a wireless keyboard that needed kernel modules. Kernel modules don't get loaded if kernel (boot partition) and modules (root partition) are out of sync. In this case you may have access to your raspberry pi via ssh, if it's enabled, or you can use the files on the boot-partition of your USB-drive, that should still match with the root-partition of your SD-card, except for the cmdline.txt file.

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

Re: Running Raspbian from USB Devices : Made Easy

Wed Dec 25, 2019 9:08 pm

echmain wrote:
Wed Dec 25, 2019 8:48 pm
All the old files are still there on the SD card...somewhere, right? (Or do they get deleted during the script?) And they don’t get updated when doing apt update/upgrade (also right?)

If I were to go back to booting from the SD card (possibly months later) would those files be out of sync? And would doing and apt update/upgrade work ok?

The only file changed on the SD card by usb-boot is /boot/cmdline.txt. When running from a USB device, the SD card's boot partition is still mounted on /boot, allowing boot files to be updated. Files on the root partition of the SD card do not get updated when running from a USB device.

sdc-boot will allow you to switch between booting the SD card and one or more USB devices. If you've updated any USB device(s) since the last time you booted the SD card, apt update/upgrade should be your first operation in order to bring the SD card up to date.

I make a point of temporarily switching back to the SD card with sdc-boot and updating it too right after doing any updates to my USB devices.

jarirpi
Posts: 2
Joined: Tue Dec 31, 2019 10:10 am

Re: Running Raspbian from USB Devices : Made Easy

Tue Dec 31, 2019 10:29 am

I have setup Pi1 to boot from ssd with usb-boot, it is now running Pi-hole. Should I upgrade to Pi4, can I just swap the card and ssd to it and it will also boot from ssd?

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

Re: Running Raspbian from USB Devices : Made Easy

Tue Dec 31, 2019 6:40 pm

If you started with Raspbian Buster and your card is a micro SD card - yes, you could simlpy plug your card and SSD into a Raspberry Pi4.

There is a thread related to issues with USB 3.0 SSD, just in case you are affected https://www.raspberrypi.org/forums/view ... 8&t=245931

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

Re: Running Raspbian from USB Devices : Made Easy

Tue Dec 31, 2019 6:46 pm

jarirpi wrote:
Tue Dec 31, 2019 10:29 am
I have setup Pi1 to boot from ssd with usb-boot, it is now running Pi-hole. Should I upgrade to Pi4, can I just swap the card and ssd to it and it will also boot from ssd?

As long as you used Buster, I believe the answer is yes. If all you're running is Pi-hole, a Raspberry Pi 1 may be all you need.

jarirpi
Posts: 2
Joined: Tue Dec 31, 2019 10:10 am

Re: Running Raspbian from USB Devices : Made Easy

Tue Dec 31, 2019 7:32 pm

Thank you fbe and RonR, yes I started with Buster. Pi-hole has been running just fine on Pi1, but eventually something always goes wrong with the micro SD card, so I hope this setup will be more durable.

munklefish
Posts: 92
Joined: Tue Oct 02, 2012 5:35 pm
Location: Neumarkt in der Oberpfalz
Contact: Website

Re: Running Raspbian from USB Devices : Made Easy

Wed Jan 01, 2020 8:32 pm

I'm trying to use this on a Pi 4b but not having any success. Am I right in running this as

Code: Select all

sudo bash usb-boot
? That's the only way I can get any sort of activity from the script. If I do that I get the menu system and select the ssd/usb drive. But, once I've gone through the options the script ends with the following output:

Code: Select all

Replicating BOOT/ROOT contents from /dev/mmcblk0 to /dev/sda (this will take a while)
The file /dev/sda2 does not exist and no size was specified.

Unable to create ROOT filesystem
Any ideas what I'm doing wrong / what I need to do to get the script doing its thing?
http://www.codeclinic.de

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

Re: Running Raspbian from USB Devices : Made Easy

Wed Jan 01, 2020 8:54 pm

munklefish wrote:
Wed Jan 01, 2020 8:32 pm
I'm trying to use this on a Pi 4b but not having any success. Am I right in running this as

Code: Select all

sudo bash usb-boot
? That's the only way I can get any sort of activity from the script. If I do that I get the menu system and select the ssd/usb drive. But, once I've gone through the options the script ends with the following output:

Code: Select all

Replicating BOOT/ROOT contents from /dev/mmcblk0 to /dev/sda (this will take a while)
The file /dev/sda2 does not exist and no size was specified.

Unable to create ROOT filesystem
Any ideas what I'm doing wrong / what I need to do to get the script doing its thing?

You shouldn't need to use another bash shell, but it shouldn't hurt. I normally just run 'sudo ./usb-boot'. I just tried your command here on my Raspberry Pii 4B and it works fine:

Code: Select all

pi@raspberrypi:~ $ sudo bash usb-boot

Replicating BOOT/ROOT contents from /dev/mmcblk0 to /dev/sda (this will take a while)

BOOT/ROOT contents replicated from /dev/mmcblk0 to /dev/sda

SD card must remain in place to boot the USB device

pi@raspberrypi:~ $

Is your SD card running Raspbian?

munklefish
Posts: 92
Joined: Tue Oct 02, 2012 5:35 pm
Location: Neumarkt in der Oberpfalz
Contact: Website

Re: Running Raspbian from USB Devices : Made Easy

Wed Jan 01, 2020 9:15 pm

Yup, on the latest fully updated raspbian.

If I just run

Code: Select all

sudo ./usb-boot
I just get
sudo: ./usb-boot: command not found
http://www.codeclinic.de

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

Re: Running Raspbian from USB Devices : Made Easy

Wed Jan 01, 2020 9:50 pm

munklefish wrote:
Wed Jan 01, 2020 9:15 pm
Yup, on the latest fully updated raspbian.

If I just run

Code: Select all

sudo ./usb-boot
I just get
sudo: ./usb-boot: command not found

'sudo ./usb-boot' assumes that usb-boot is in your current directory. If it's not, you either have to cd to the directory where it's located or give the correct path (for example, 'sudo /home/pi/usb-boot' if usb-boot is located in /home/pi). Also, don't forget to make usb-boot executable ('chmod +x usb-boot').

Are you sure the USB device (/dev/sda) is a working device? The error message (Unable to create ROOT filesystem) can occur if usb-boot cannot partition or create an ext4 filesystem on the USB device. You might want to try a different USB device.

Return to “Advanced users”