romprod
Posts: 20
Joined: Sat Jun 09, 2012 6:31 pm

[PI4:] how do I move the filesystem to a USB stick/Drive

Wed Jul 03, 2019 12:41 pm

Hi Guys,

I'm trying to accomplish this on a new RPi4 because it doesn't natively support USB boot but I'm having issues.

I'm using Raspbian Buster and I'm using the PARTUUID method as described in quite a few guides but I can't get the thing to boot.

I don't have any micro HDMI ports to check what it's actually doing so I'm kinda stuck in getting it to run the OS from a USB HDD

Has anyone been able to get it working with a RPi4 yet?

Thanks,
Last edited by romprod on Thu Jul 04, 2019 6:41 pm, edited 1 time in total.

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 9:10 am

Hi, I am also trying to boot not directly from USB, but I want to have /boot on sdcard and "rootfs" on SSD disk attached viac USB... but I am not able to get it work.
first thing I tried was just sdcard and SSD disk swap from old RPI3 to new RPI4 (os upgraded to buster), no luck, wont boot.
so I decided to flash fresh buster image to new SD card and it booted fine. then I tried to move "rootfs" using two methods: win32imager and rsync.

with win32imager there was issue that SSD had same PARTUUID and UUID, and I was unable to change PARTUUID.
so I tried create whole new partition using fdisk and mke2fs and afterwards using rsync I copied whole "rootfs".....

BUT still I am unable to boot, RPI4 will load devices and last line is saying that SCSI device (my SSD disk) is loaded and that`s all.

I guess you have same issue, but you are unable to see it.

I really do not understand why RPI4 is unable to boot when /boot is on SD and / is on SSD (via USB).
and yes cmdline.txt and /etc/fstab is correctly set.

Gomoto
Posts: 125
Joined: Tue Feb 12, 2013 1:21 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 3:17 pm

(I only had to change the entry in the cmdline.txt file to the new device "root=/dev/sda3" in my case after I used dd to transfer the filesystem to the new device.)

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 4:54 pm

using /dev/sdaX as reference for mounting filesystem is not good idea. anytime it can be changed from /dev/sda1 to /dev/sdb1 etc and your system will be not able to boot.

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 5:32 pm

I just tried with /dev/sdbX in cmdline.txt and same behavior.
RPI4 is just unable to boot when rootfs is not on SDcard.

S0litaire
Posts: 216
Joined: Thu Dec 29, 2011 4:24 pm
Location: Ayrshire, Scotland
Contact: ICQ Skype Twitter

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 5:51 pm

I might be wrong but, at the moment the Rpi4 can only boot via the SD card.

They changed how the Rpi boots up and are no longer using the "bootcode.bin" file in the SD card. The this file is now held on a chip on the board itself and i think the file on the SD card is ignored.

Due to this change the Pi does not load in the USB drivers until after it's started booting (So you can't boot from USB as these drivers are not loaded till after the initial boot process starts.) so it needs access to the SD-Card at boot to read the start*.elf files.

It should work if you have the root on a SSD and the /boot/ on the SD card (Also try and use UUID of the SSD partition, instead of /dev/sda# in fsatab, that helps keeping things pointed to the correct drives if you have multiple USB devices plugged in.)

They are working to get Network PXE boot working first then things like USB boot.

Read more about it here:
https://www.raspberrypi.org/documentati ... teeprom.md
--
Laters

Bill "Solitaire" C

Anáil nathrach, ortha bhas betha, do cheol déanta

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

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 6:02 pm

Try this.

Write a Raspbian Buster image to your USB drive with Etcher.
Format a microSD card with the FAT32 file system.
Copy the contents of the USB drive's "boot" partition to the microSD card.
Put the SD card into the Pi4 and connect the USB drive.
Power it up and it should boot.

Once up and running, edit /etc/fstab to mount the microSD card as /boot, then reboot.

Let us know if that works for you (others have told me it worked).
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?

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 7:17 pm

Hello HawaiianPi,

I tried your suggestion with fresh buster installation.
it started booting even it showed screen that it is resizing root partition (means that boot sequence noticed that disk where is rootfs has free space [240GB SSD drive]) but anyway it did not boot up. it stays on splash screen as you can see below.
IMG_20190704_205203.jpg
IMG_20190704_205203.jpg (159.31 KiB) Viewed 1400 times
I really do not understand what is the problem with RPI4, I really want to have rootfs on SSD, because of better performance and also longer lifespan compared to SDcard. and I got it work on RPI3 without any issues, but RPI4 is refusing.

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

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 7:34 pm

Okay, check the cmdline.txt file to see that it is pointing to the 2nd partition on the USB drive for root.

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=8d44433f-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether quiet splash plymouth.ignore-serial-consoles

Note that cmdline.txt should be all on 1 single line with only a single space delimiting parameters. Use a pure text editor, not a word processor to edit the file (Notepad++ is a good one for Windows).
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?

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

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 7:45 pm

If that doesn't work, try disabling the automatic partition resize by removing init=/usr/lib/raspi-config/init_resize.sh from cmdline.txt before booting (start with a freshly imaged card, and remember to only leave a single space).
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?

Gomoto
Posts: 125
Joined: Tue Feb 12, 2013 1:21 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 8:31 pm

Perhaps it worked only on my pi because I did a (unrecommended) rpi-update. (Because after I tried other firmware, it did not work on my pi too).

Did you try the USB 2.0 ports also. It worked on USB 2.0 even with the testing firmware on my side.

I found this information helpful for my transfer to ssd.

https://www.zdnet.com/article/raspberry ... sktop-kit/

(I did not follow the steps blindly. I just used the info from the articel as starting point. I did not have to worry about PARTUUID for example. I just used /dev/sda3 (where I put my filesystem copy) in my case. You do not need a fstab file also. After the file system is copied to the new device, the cmdline.txt entry is all you need.)
Last edited by Gomoto on Thu Jul 04, 2019 8:34 pm, edited 1 time in total.

PiUser10
Posts: 11
Joined: Mon Dec 30, 2013 9:20 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 8:33 pm

I have just followed the instructions at https://www.tomshardware.co.uk/boot-ras ... 61081.html and it
worked ok for me.
When I booted first time it took a while and flashed a few messages about /dev/sda2 (where I put /) then proceeded to display the desktop.
I now have /boot running off sdcard and / running of usb 3.0 WD passport drive.
A big thank you to tomshardware for the instructions.
This should keep me going until the release of the new eeprom that allows direct usb booting without the sdcard.

PiUser10
Posts: 11
Joined: Mon Dec 30, 2013 9:20 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 9:52 pm

Well a quick update .......
After running with / on USB 3.0 device for an hour or so it was much less responsive than the SDCard !
Sower to boot and slower to open programs like Chromium and Thunderbird.
This is either my drive throughput or an issue with the USB 3.0 throughput (I hope it is not the latter).
I have moved back to the original SDCard setup, will either get a sata ssd drive and try again or wait until usb boot is support in EEPROM.

romprod
Posts: 20
Joined: Sat Jun 09, 2012 6:31 pm

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Thu Jul 04, 2019 10:43 pm

PiUser10 wrote:
Thu Jul 04, 2019 8:33 pm
I have just followed the instructions at https://www.tomshardware.co.uk/boot-ras ... 61081.html and it
worked ok for me.
When I booted first time it took a while and flashed a few messages about /dev/sda2 (where I put /) then proceeded to display the desktop.
I now have /boot running off sdcard and / running of usb 3.0 WD passport drive.
A big thank you to tomshardware for the instructions.
This should keep me going until the release of the new eeprom that allows direct usb booting without the sdcard.
Thanks, I've re-done it using this method but I'm still unable too boot. This is pretty much what I've already tried but thought I'd give it another go incase I've missed something.

Curiously the activity light is now flashing on my USB-SATA cable after being idle, so I wonder if it's actually reading from the disk but very slowly. I'll leave it going over night and see what happens.

I might have to fork out for a micro HDMI adapter so that I can check what it's doing but I'd rather not have to buy something else!

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Fri Jul 05, 2019 10:33 am

Hello Guys,

FINALLY I am booted using SSD drive for rootfs, thanks everyone for suggestions and help.

Anyway, I noticed really strange issue, and I think that this was main reason why I was unable to boot using SSD for rootfs.

As you can see on screenshot below, RPI4 was struggling to communicate with SSD drive (sda on screenshot).
I have two drives, one is 3.5" 4TB drive placed in box with own power supply (such large [physical size and storage size] requires 12V to work), and as I mentioned earlier 240GB SSD drive.
but when I had both of them plugged into USB3 ports, RPI4 was unable to boot from SSD.
So, I tried plug SSD into USB2 port, and Whoala! it booted like a charm. without any error message or so.

So, I would like to hear from raspberry foundation or anyone else, to let me know what is going on and why I can`t have two drives (1 with own power supply) connected to USB3 ports. that`s why I bought this device, for USB3 ports and 1Gbit ethernet to have it as NAS.
IMG_20190705_121439.jpg
IMG_20190705_121439.jpg (173.21 KiB) Viewed 1246 times

PiUser10
Posts: 11
Joined: Mon Dec 30, 2013 9:20 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 2:38 pm

Just received delivery of a UGreen m.2 Portable enclosure and a WD Blue M.2 250 GB SSD.
Set it up and moved the / content over (as per previous instructions) and adjusted the cmdline.txt (used PARTUUID= not /dev/sda1)
Re-booted PI4 and it is all good now very fast and no more excessive writes on the SDCard so it should last a lot longer.
P.S. The chipset in this enclosure is listed with lsusb as ASMEDIA bridge + and testing with hdparm gives read speed of 325+ MB/s
with the original VL805 firmware if this helps anyone looking for possible working solutions.
I think enclosures using VIA chipsets are maybe having some performance issues, especially after updating the PI VL805 to
the heat saving firmware.
Very happy with the results so far, next when EEPROM is released to do direct SSD boot.

romprod
Posts: 20
Joined: Sat Jun 09, 2012 6:31 pm

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 2:46 pm

I've just this minute figured out why it wouldn't work....

So, found out that it would work using the PARTUUID method as per the guides etc but only when plugged into the USB2 socket.

The I found this site https://wiki.odroid.com/odroid-xu4/soft ... _fw_update and updated the firmware as below

Code: Select all

sudo ./JMS578FwUpdate -d /dev/sda -v
Bridge Firmware Version: v133.2.0.2

Code: Select all

sudo ./JMS578FwUpdate -d /dev/sda -f ./JMS578-Hardkenel-Release-v173.01.00.02-20190306.bin -b ./backup.bin
Update Firmware file name: ./JMS578-Hardkenel-Release-v173.01.00.02-20190306.bin
Backup Firmware file name: ./backup.bin
Backup the ROM code sucessfully.
Programming & Compare Success!!
Give everything a cold reboot (if you have power to your USB->SATA device

Code: Select all

sudo ./JMS578FwUpdate -d /dev/sda -v
Bridge Firmware Version: v173.1.0.2

Voila!

It now boots from USB3 ports!


Previous speed test on USB2

Code: Select all

sudo hdparm -tT /dev/sda                    

/dev/sda:
 Timing cached reads:   1754 MB in  2.00 seconds = 877.30 MB/sec
 Timing buffered disk reads: 102 MB in  3.05 seconds =  33.39 MB/sec
New speed test on USB3

Code: Select all

 hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   1826 MB in  2.00 seconds = 913.42 MB/sec
 Timing buffered disk reads: 1122 MB in  3.00 seconds = 373.49 MB/sec

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 2:54 pm

Hello romprod,

Have you tried it on your RPI4 right?
because I do not want to brick my USB3 ports or even whole RPI4.
and I see that this update manual is not directly for RPI, but for Odroid.

romprod
Posts: 20
Joined: Sat Jun 09, 2012 6:31 pm

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 2:56 pm

Yes, completed this about 15 minutes ago.

You're updating the firmware of the USB-SATA device, not the RPi

You could in theory do it from any Linux PC/Laptop etc

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 3:09 pm

oh, I see.

do you know how to find out if your procedure will work for my SATA to USB device?

I am using this one: https://www.axagon.eu/en/produkty/adsa-1s6

and when I executed command to show firmware version, it showed I think very old version and my box is 2 years old.
So, I am quite confused it this procedure is going to help me.

Code: Select all

[email protected]:/tmp/JMS578FwUpdater# ./JMS578FwUpdate -d /dev/sdb -v
Bridge Firmware Version: v18.1.0.1

[email protected]:/tmp/JMS578FwUpdater#

romprod
Posts: 20
Joined: Sat Jun 09, 2012 6:31 pm

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 3:18 pm

erikvo wrote:
Sat Jul 06, 2019 3:09 pm
do you know how to find out if your procedure will work for my SATA to USB device?
Run lsusb and if you get the same result here you should be good to go. It's the JMS567 type

Code: Select all

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 152d:0578 JMicron Technology Corp. / JMicron USA Technology Corp. JMS567 SATA 6Gb/s bridge
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 3:27 pm

hm,

tried, but it did not show any chip version. so I tried to open it and indeed it is JMS578.

My last question, do you think it is good idea to update it when it is used for rootfs? or should I boot from SDcard and then update?

Code: Select all

[email protected]:/home/pi# lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 174c:1153 ASMedia Technology Inc. ASM1153 SATA 3Gb/s bridge
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 152d:1576 JMicron Technology Corp. / JMicron USA Technology Corp.
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[email protected]:/home/pi#
cip.jpg
cip.jpg (204.07 KiB) Viewed 1093 times

romprod
Posts: 20
Joined: Sat Jun 09, 2012 6:31 pm

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 3:31 pm

I did it while it was used for the root partition.

erikvo
Posts: 9
Joined: Thu Jul 04, 2019 9:01 am

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 4:07 pm

RPI4 finally booted when rootfs is connected via USB3 port.
BUT, it is incredibly slow. boot took 5times longer than usual. login via ssh also took quite long time.

and when I checked top, I see strange high cpu usage for IO.

Code: Select all

top - 18:06:53 up 8 min,  3 users,  load average: 7.39, 8.00, 4.30
Tasks: 130 total,   1 running, 129 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.2 sy,  0.0 ni, 25.0 id, 74.7 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3906.0 total,   3426.3 free,    215.0 used,    264.7 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.   3561.8 avail Mem
figured out, that I have another USB3 to SATA box, and found that this second box is using ASMedia’s ASM1153E.
and guess what? it booted like a charm....

Code: Select all

[email protected]:~ $ dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 7.04327 s, 152 MB/s
[email protected]:~ $
SO, my whole problem was not related to RPI4, but to faulty USB3 <> SATA controller........

Many thanks to you all, for your help and advices. you helped me really a lot.

romprod
Posts: 20
Joined: Sat Jun 09, 2012 6:31 pm

Re: [PI4:] how do I move the filesystem to a USB stick/Drive

Sat Jul 06, 2019 5:10 pm

Mines working but I'm noticing some cpu related slowdowns.

It'll do for now though, for what I need I can wait for any improvements.

Return to “Advanced users”