Maze_fr
Posts: 46
Joined: Wed Dec 04, 2019 9:57 pm
Location: France

Re: Running Raspbian from USB Devices : Made Easy

Thu Jan 09, 2020 3:53 am

Here is my little testing...
As I "locked" my Pi with a bad docker bridge command line (I do network access), and I don't know what to modify manually (as an USB drive) to fix that, I decided to reset it, so I tried the modified script, and it worked perfectly. ;)
"Don't believe in forum signature quotations, they may be fakes" - Victor Hugo

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

Re: Running Raspbian from USB Devices : Made Easy

Thu Jan 09, 2020 4:07 am

Maze_fr wrote:
Thu Jan 09, 2020 3:53 am
As I "locked" my Pi with a bad docker bridge command line (I do network access), and I don't know what to modify manually (as an USB drive) to fix that, I decided to reset it, so I tried the modified script, and it worked perfectly. ;)

Thank you very much for the feedback. I'm so pleased we found the source of the problem and now have a solution.

r00t4rd3d
Posts: 5
Joined: Sat Dec 28, 2019 1:05 am

Re: Running Raspbian from USB Devices : Made Easy

Fri Jan 10, 2020 10:49 pm

I have a StarTech USB 3.0 to SATA adapter hooked to a PNY 120gb SSD. I have the drive set up with 1 partition and formatted ext4. Shows up as sda1 under fdisk. When I run usb-boot I get this error:

Code: Select all

[email protected]:~/Desktop/usb-boot $ sudo ./usb-boot 

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
Anyone know how to fix this?

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

Re: Running Raspbian from USB Devices : Made Easy

Sat Jan 11, 2020 12:06 am

r00t4rd3d wrote:
Fri Jan 10, 2020 10:49 pm

Code: Select all

[email protected]:~/Desktop/usb-boot $ sudo ./usb-boot 

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
Anyone know how to fix this?

This issue is discussed a few posts back. It's easily fixed by doing the following:

Edit (nano) usb-boot and change the first occurrence of:

Code: Select all

    fdisk "${USB_DEST}" <<EOF &> /dev/null

to

Code: Select all

    fdisk -c=dos "${USB_DEST}" <<EOF &> /dev/null

Qua294
Posts: 10
Joined: Fri Mar 01, 2019 4:14 pm

Re: Running Raspbian from USB Devices : Made Easy

Fri Jan 17, 2020 3:42 pm

Hi,
Sorry if it was answered already (I read the whole 9 pages but maye missed it) - how much a "while" can be when writing a 30GB USB flash drive?
I'm well over an hour now (buster lite version), with the RPi 3B green led flashing here and there, the USB drive led flashes all the time and the putty cursor is full green under the "Replicating BOOT/ROOT contents from /dev/mmcblk0 to /dev/sda (this will take a while)" line.
Will closing the putty session can damage something?
Is there a way to verify what is going on?
Thanks.

[Edit]
Apparently I needed to post in order to make it finish :D
It is now done and I can tell it takes well over an hour for 30GB :D :D

blazm
Posts: 2
Joined: Wed Nov 07, 2018 11:10 am

Re: Running Raspbian from USB Devices : Made Easy

Tue Jan 21, 2020 8:40 pm

Hi,

Just a short note. I guess it is a good idea to create RAID1 array between boot partition on the SD card and boot partition on the USB HDD/SSD. This way the content of the drives is always in sync. Better than to mount only SD card partition as /boot; since using RAID:
- If SD card fails, you have the latest boot partition on the HDD/SSD.
- If SD card fails, you would probably get notified by the MD adm that syncing of the devices in RAID array failed and you could simple replace SD card with new one - without rebooting RPi and fixing issue offline.
- When USB boot is ready for RPi4, you will probably be able to boot right away from the boot partition on the HDD/SSD.
For now I just did a quick setup without any serious testing (apart from making sure RAID array is in sync - cat /proc/mdstat).

Enjoy,

Blaz

Maze_fr
Posts: 46
Joined: Wed Dec 04, 2019 9:57 pm
Location: France

Re: Running Raspbian from USB Devices : Made Easy

Wed Jan 22, 2020 8:39 am

blazm wrote:
Tue Jan 21, 2020 8:40 pm
Just a short note. I guess it is a good idea to create RAID1 array between boot partition on the SD card and boot partition on the USB HDD/SSD.
That's a brilliant idea !
I was wondering how to do backups for the boot partition and that would solve it perfectly.
"Don't believe in forum signature quotations, they may be fakes" - Victor Hugo

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

Re: Running Raspbian from USB Devices : Made Easy

Thu Jan 23, 2020 5:32 am

Maze_fr wrote:
Wed Jan 22, 2020 8:39 am
blazm wrote:
Tue Jan 21, 2020 8:40 pm
Just a short note. I guess it is a good idea to create RAID1 array between boot partition on the SD card and boot partition on the USB HDD/SSD.
That's a brilliant idea !
I was wondering how to do backups for the boot partition and that would solve it perfectly.

While it's a trivial task to create and dissolve mirroring between the SD card's boot partition and SSD's boot partition, if you shutdown or reboot while mirroring is in effect, you're dead. When mirrored using mdadm, each partition by itself appears as filesystem type 'linux_raid_member' which neither Raspbian nor the Raspberry Pi bootloader can decipher.

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

Re: Running Raspbian from USB Devices : Made Easy

Thu Jan 23, 2020 11:16 pm

usb-boot.zip in the first post of this topic has been updated to accommodate an issue with USB SSD/HDD adapters which use an ASMedia Technology Inc. controller. See recent posts to this topic for additional information.

Jeepsterjc
Posts: 5
Joined: Sat Jan 25, 2020 2:58 am

Re: Running Raspbian from USB Devices : Made Easy

Sat Jan 25, 2020 3:08 am

Thanks for the script and updates. I've just run it on my pi4 using the Star Tech USB cable to a 1tb wd ssd. It ran without a hitch. How do I know it's actually running off of the SSD and not off the sdcard?

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

Re: Running Raspbian from USB Devices : Made Easy

Sat Jan 25, 2020 5:19 am

Jeepsterjc wrote:
Sat Jan 25, 2020 3:08 am
How do I know it's actually running off of the SSD and not off the sdcard?

Run 'lsblk' and take note of the MOUNTPOINT column:

Code: Select all

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk
├─sda1        8:1    0   256M  0 part
└─sda2        8:2    0 465.5G  0 part /
mmcblk0     179:0    0  14.9G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  14.6G  0 part

Jeepsterjc
Posts: 5
Joined: Sat Jan 25, 2020 2:58 am

Re: Running Raspbian from USB Devices : Made Easy

Sat Jan 25, 2020 6:18 pm

RonR wrote:
Sat Jan 25, 2020 5:19 am
Jeepsterjc wrote:
Sat Jan 25, 2020 3:08 am
How do I know it's actually running off of the SSD and not off the sdcard?

Run 'lsblk' and take note of the MOUNTPOINT column:

Code: Select all

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk
├─sda1        8:1    0   256M  0 part
└─sda2        8:2    0 465.5G  0 part /
mmcblk0     179:0    0  14.9G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  14.6G  0 part
Thank you.

carver1
Posts: 6
Joined: Sun Feb 09, 2020 11:23 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Feb 10, 2020 12:02 pm

RonR,
Just wanted to let you know that it there's now a potential bug in the commands

Code: Select all

sudo shutdown -r now
that you happen to use in your sdc-boot script (run as root) since the latest updates installed via apt update/full-upgrade or the newest 2020-02-05 Raspbian Buster with Desktop image on a RPI4.

I commented suddenly recently experiencing the same as the op on the same hardware, and that if I just change
"shutdown -r now"
to
"reboot"
and run "sudo src-boot <args>" it consistently reboots with no hard shutdowns as usual.

https://www.raspberrypi.org/forums/view ... 6&t=264518

And thanks for sharing usb-boot!

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

Re: Running Raspbian from USB Devices : Made Easy

Mon Feb 10, 2020 7:06 pm

carver1 wrote:
Mon Feb 10, 2020 12:02 pm
Just wanted to let you know that it there's now a potential bug in the commands

Code: Select all

sudo shutdown -r now
that you happen to use in your sdc-boot script (run as root) since the latest updates installed via apt update/full-upgrade or the newest 2020-02-05 Raspbian Buster with Desktop image on a RPI4.

It appears there are several problems with the 2020-02-05 Raspbian Buster images (and the updates issued just prior to these images).

Until the Raspberry Pi folks sort it all out, the solution is to simply run:

Code: Select all

sudo rpi-update 993f475

See also:

https://www.raspberrypi.org/forums/view ... 6&t=264374

https://www.raspberrypi.org/forums/view ... 5#p1608966

Return to “Advanced users”