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

Re: Running Raspbian from USB Devices : Made Easy

Sat Oct 12, 2019 3:05 am

Brad Q wrote:
Fri Oct 11, 2019 8:48 pm
You seeing any performance degradation after today's update? It included a bootloader update. It could just me. But it feels a little off? It would not necessarily be due to usb-boot.

I don't believe I'm seeing anything different or unusual here. I'll be doing some FreePBX builds this weekend and will let you know if anything out of the ordinary surfaces.

HypnoToad
Posts: 72
Joined: Thu Dec 11, 2014 6:00 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 14, 2019 1:05 am

Hi, Does this script work OK with the Raspberry Pi 4?

I'm trying to boot from an SSD connected to the USB3 port, I installed the latest Raspbian Lite - 2019-09-26-raspbian-buster-lite.zip to an SD card, and ran the script which copied the files to the SSD.

After the first reboot I got the following screen:

Image

Have I done somthing wrong here?

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

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 14, 2019 1:13 am

HypnoToad wrote:
Mon Oct 14, 2019 1:05 am
Does this script work OK with the Raspberry Pi 4?
...
Have I done somthing wrong here?

Yes, it works fine with the Raspberry Pi 4

It appears you removed the SD card:

[ TIME ] Timed out waiting for device /dev/mmcblk0p1

HypnoToad
Posts: 72
Joined: Thu Dec 11, 2014 6:00 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 14, 2019 2:23 am

RonR wrote:
Mon Oct 14, 2019 1:13 am
HypnoToad wrote:
Mon Oct 14, 2019 1:05 am
Does this script work OK with the Raspberry Pi 4?
...
Have I done somthing wrong here?

Yes, it works fine with the Raspberry Pi 4

It appears you removed the SD card:

[ TIME ] Timed out waiting for device /dev/mmcblk0p1
That's great that it's OK with the Pi 4 :)

I did leave the SD card in while it was rebooting, and left it in - I did not remove it at all.

I'll try another SD card and see if it does the same thing.

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

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 14, 2019 2:55 am

HypnoToad wrote:
Mon Oct 14, 2019 1:05 am
I installed the latest Raspbian Lite - 2019-09-26-raspbian-buster-lite.zip to an SD card, and ran the script which copied the files to the SSD.

I downloaded usb-boot (to make sure I'm using the same one you used) and did the same thing (except I used a USB 3 flash drive as I don't have a spare SSD at the moment). After the copy, I rebooted and it came right up on the USB flash drive:

Code: Select all

pi@raspberrypi:~ $ mount
/dev/sda2 on / type ext4 (rw,noatime)

There are compatibility problems with the Raspberry Pi 4 USB 3 ports and some USB-SATA adapters, so you might want to try your SSD on a USB 2 port or try a USB flash drive if you still have problems.

HypnoToad
Posts: 72
Joined: Thu Dec 11, 2014 6:00 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 14, 2019 3:19 am

RonR wrote:
Mon Oct 14, 2019 2:55 am
HypnoToad wrote:
Mon Oct 14, 2019 1:05 am
I installed the latest Raspbian Lite - 2019-09-26-raspbian-buster-lite.zip to an SD card, and ran the script which copied the files to the SSD.

I downloaded usb-boot (to make sure I'm using the same one you used) and did the same thing (except I used a USB 3 flash drive as I don't have a spare SSD at the moment). After the copy, I rebooted and it came right up on the USB flash drive:

Code: Select all

pi@raspberrypi:~ $ mount
/dev/sda2 on / type ext4 (rw,noatime)

There are compatibility problems with the Raspberry Pi 4 USB 3 ports and some USB-SATA adapters, so you might want to try your SSD on a USB 2 port or try a USB flash drive if you still have problems.
Ok, I tried it on a USB 2 port and it worked straight away, it looks like my USB-to-SATA adaptor is the issue.

After some searching using the 'lsusb' command it turns out that using adding `usb-storage.quirks=0080:a001:u` to the `cmdline.txt` seems to fix things for me. I've now plugged it back up to the USB 3.0 port and it's now working.

Thanks! :)

Phil_C
Posts: 2
Joined: Mon Oct 14, 2019 10:46 am

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 14, 2019 10:48 am

I recently bought an RPi4, so I'm very new to it. I used NOOBS to set it up and I'm running a webserver on it. A few days ago I read that USB memory sticks are better than SD card in terms of longevity, so I decided to make the change.

By doing some dancing back and forth through this thread, I managed to get it all working, so I thought I'd consolidate the steps I needed to take into one place for other NOOBS users. All this information is in this thread, but somewhat scattered. Here are the steps...

1. Download usb-boot (from the first post) and put it into your user's Home folder (e.g. /home/pi).

2. Make it executable with chmod +x usb-boot

3. If the USB stick in already connected, remove it.
3a. Open the File Manager
3b. Click on Edit->Preferences
3c. In the Volume Management tab, uncheck 'Mount removeable media automatically when they are inserted'. This will prevent the USB stick from being automatically mounted when you connect it.
3d. Connect the USB memory stick.

4. Run usb-boot (./usb-boot).
4a. Select the USB device by pressing the space bar.
4b. Use the tab key to navigate to the Yes button and press the space bar.

It will take about 15 minutes to copy everything from the SD card to the USB stick. When it's done, reboot the Pi and it will run from the USB stick.

Leave the SD card in. Apparently it's needed to be there.

Check that the Pi is now running from the USB stick by typing:-
mount | grep " on / "
into the console. It should come back with, "/dev/sda2 on type ext4 (rw, noatime)", which means that it's running on the USB stick. Also two new icons appear on the GUI - '256 MB Volume' and 'root'.

The auto-mount option in Edit->Preferences can be checked again. The Pi continues to run from the USB stick after reboots.

Phil_C
Posts: 2
Joined: Mon Oct 14, 2019 10:46 am

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 14, 2019 4:23 pm

I forgot to include one thing from my previous post, and that is a thank you to RonR, but I can't see a way to edit the post. So...

Thank you, RonR, for the thread, the script, and the time you've put into it since you started the thread.

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

Re: Running Raspbian from USB Devices : Made Easy

Sat Oct 19, 2019 9:17 am

First of all.... THANKS to RonR for the script.

Tried the script for the first time on my RPi4B and a NVMe SATA drive (just have one lying around to play around)
had trouble trying to run the script.... but managed to do it after a few research.

and it did run as advertised... great!

however I did noticed something...
my Raspbian Buster on the microSD was already fully setup, including required mount points for network shares and its symlinks to desktop
after completing the script and rebooting....
the mount points in /mnt were not included... therefore the symlinks were invalid...

if the whole root fs was supposed to be transferred to target USB device.... the mount points were not....
checked the original root fs on the microSD... its indeed there.... but not on the transferred root fs on the USB device

was this by design or do I need to tweak the script to truly transfer the whole entirety of the root fs to the target USB drive.

if, however, the script is ran right after the initial Rasbian install.... then this is not a problem.....
..... and still highly recommended for those who want to have their root fs on a USB drive.... and automating the process to do it.

a progress indicator would be a nice "improvement" on the script... (if it is possible)

once again thanks to RonR!
"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: 520
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian from USB Devices : Made Easy

Sun Oct 20, 2019 7:14 pm

LTolledo wrote:
Sat Oct 19, 2019 9:17 am
my Raspbian Buster on the microSD was already fully setup, including required mount points for network shares and its symlinks to desktop
after completing the script and rebooting....
the mount points in /mnt were not included... therefore the symlinks were invalid...

/media and /mnt are intentionally excluded from the rsync copy. You would need to manually recreate the mount points in those directories.

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

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 21, 2019 10:09 am

RonR wrote: /media and /mnt are intentionally excluded from the rsync copy. You would need to manually recreate the mount points in those directories.
...well, that's already taken care of.... no problem there.... :D

are there any other folders that are intentionally excluded from the rsync process? just for us to know...
"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: 520
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 21, 2019 4:39 pm

LTolledo wrote:
Mon Oct 21, 2019 10:09 am
are there any other folders that are intentionally excluded from the rsync process?

/dev
/media
/mnt
/proc
/run
/sys
/tmp
/lost+found

User avatar
rpdom
Posts: 15234
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 21, 2019 7:50 pm

Why not just use the -x one --one-file-system option for rsync? That will copy everything in the selected file system including mount points, but not anything that is mounted in them - that excludes anything in /dev, /sys, /proc etc...
Ok, so it will copy the contents of ./lost+found, but that should be empty unless there have been problems.

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

Re: Running Raspbian from USB Devices : Made Easy

Mon Oct 21, 2019 9:54 pm

rpdom wrote:
Mon Oct 21, 2019 7:50 pm
Why not just use the -x one --one-file-system option for rsync? That will copy everything in the selected file system including mount points, but not anything that is mounted in them - that excludes anything in /dev, /sys, /proc etc...
Ok, so it will copy the contents of ./lost+found, but that should be empty unless there have been problems.

I'm aware of all that, but -x will also exclude copying the contents of /boot. This can be solved by doing two separate rsync's, but that would require a little reworking of the current script. I've been considering the options.

Return to “Advanced users”