LloydPi3
Posts: 22
Joined: Fri Mar 25, 2016 1:53 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Wed May 23, 2018 7:24 pm

Did you make sure you had 2 partitions? Make sure you have 2 partitions by typing sudo blkid – should show sda1 and sda2 where before it was sda1.

There should have been two n commands in gdisk.

This is what I did - following the instructions on the first page
A Before using gdisk need to make sure the HDD is available
1. lsusb to make sure the HDD is recognized & sudo blkid to make sure the HDD is /dev/sda1
2. We do not want it mounted.
B. Use gdisk
1. Type sudo gdisk /dev/sda
a. Finds something just delete it by typing command d (asked for what partition had to type 1 and then d and 2)
2. next command type n
a. Partion # type 1
b. First Sector Hit ENTER (ie accept as is)
c. Last sector I went with +10G or +250G whatever you want the first partition to be - make it large enough to add programs
d. Hex code Hit ENTER
3. Make another partition by typing n - could make more than 1 partition but not necessary
a. Partition # Hit ENTER
b. First sector Hit ENTER
c. Last sector Hit ENTER (uses the rest of the USB drive)
d. Hex Code Hit Enter
4. Verify by typing v
5. Write the partitions by typing w
6. Make sure you have 2 partitions by typing sudo blkid – should show sda1 and sda2 where before it was sda1.
C. Now we need to format the partitions
1. sudo mke2fs -t ext4 -L rootfs /dev/sda1
a. Said it was last mounted on /media/pi/rootfs proceed anyway and I said y
b. Takes a while writing superblocks and filesystem accounting –
2. sudo mke2fs -t ext4 -L my_data /dev/sda2 **** change the label name or you will have to use e2label

sineverba
Posts: 12
Joined: Tue Jul 16, 2013 3:27 pm

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Sun Jun 10, 2018 11:00 am

HI to all,
I did follow procedure in first page. I have a PI1 and last Raspbian stretch (april 2018).

I did notice that last /fstab is a bit different, by the way I did follow the entry for

Code: Select all

/dev/disk-by-uuid
Of course, I did change also the cmdline.txt.

After the reboot, PI hangs with emergency mode and complains with

Code: Select all

Dependency failed for File System Check on /dev/disk/by-partuuid/5cxxxx
Dependency failed for /boot
Dependency failed for Local File System
Any suggest? Thank you very much

This is my fstab:

Code: Select all

proc            /proc           proc    defaults          0       0
PARTUUID=5c1ec57d-01  /boot           vfat    defaults          0       2
#PARTUUID=5c1ec57d-02  /               ext4    defaults,noatime  0       1
#/dev/disk/by-uuid/76929594-b034-4599-8f31-34af1ae2ff79 /       ext4    defaults,noatime 0 1
#PARTUUID=7F58C5CF-67B0-4868-A46F-73D87718DA4E  /       ext4    defaults,noatime 0 1
/dev/disk/by-uuid/76929594-b034-4599-8f31-34af1ae2ff79  /       ext4    defaults,noatime        0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
tmpfs   /tmp/log        tmpfs   nodev,nosuid,size=50M 0 0
And this is the cmdline.txt edited

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=7f58c5cf-67b0-4868-a46f-73d87718da4e rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
And at the end I did add the

Code: Select all

program_usb_timeout=1
to the config.txt

donbrew
Posts: 78
Joined: Sun Sep 04, 2016 2:32 pm

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Sun Jul 15, 2018 3:03 pm

I used this procedure a few months ago with Jessie, it worked perfectly.

Yesterday I tried it with a updated Stretch; there are a couple of oddities.
rootfs auto mounts on /media/pi/rootfs
I also have a ntfs partition with lots of data on it
The problem with auto mounting is that rsync copies all of the data on the mount points, that fills the 20 Gb root very fast..

The work around was to exclude /media/ and /mnt/ in the rsync command
I mounted the new partition /dev/sda1 on /mnt/pihdd1 instead of mnt

sudo rsync -axv --exclude /media/ /mnt/ / /mnt/pihdd1

I am writing this from memory, so maybe some tinkering is needed.

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Sun Jul 15, 2018 3:16 pm

donbrew wrote: rootfs auto mounts on /media/pi/rootfs
Looks as if it's automounted by the filemanager in the GUI (pcmanfm)
If that's the case then you can switch it off in the preferences.
donbrew wrote:
Sun Jul 15, 2018 3:03 pm
The problem with auto mounting is that rsync copies all of the data on the mount points, that fills the 20 Gb root very fast..

The work around was to exclude /media/ and /mnt/ in the rsync command
I mounted the new partition /dev/sda1 on /mnt/pihdd1 instead of mnt

sudo rsync -axv --exclude /media/ /mnt/ / /mnt/pihdd1
If you use -x (or --one-file-system) then you should not need the exclusions. It should stop at the mount points.

NoNameHere
Posts: 8
Joined: Mon Jun 19, 2017 10:38 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Tue Jul 31, 2018 5:41 pm

I wonder if somebody managed to pull this off with an img file on a NTFS partition on a USB HDD.
The kernel should have a read-only NTFS driver built-in, so my first attempt was to set the NTFS partition as a root partition and see what it does. It didn't give any warnings about rootfstype=ntfs, but it completely refused to mount it either (Tried with both root=PARTUUID=*uuid* and plain root=/dev/sda1). rootwait made it just hang endlessly, no rootwait made it crash instantly without the root partition mounted.
My next attempt was to leave the cmdline.txt as it was, rename the /sbin/init to something else so that I got sh without pretty much booting the Raspbian, and try to do something from there. That got me to sucessfully mounting the NTFS partition and then mounting the img file on a loopback, but not much further than that. pivot_root fails with pivot_root: device or resource busy. Googling tells that this may be from /proc still mounted, but the /proc was never mounted here. I suspect NTFS-3G with its mount.ntfs-3g process still running may prevent the root change, but I don't know really.

Once again, maybe someone knows a proper way to do this?

lucian
Posts: 17
Joined: Wed May 08, 2013 10:33 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Tue Jul 31, 2018 9:17 pm

Hello all,

This is a great guide. I have followed it for a pi raspberry pi 3b with raspbian installed and worked perfectly. I have later tried to apply the same guide on another raspberry pi 3b+ with osmc but for some weird reason after I do all the things in the guide the system will not boot. It will tell me that there are some errors on the /dev/sda1 device with the bad superblock. Is there a way to apply this guide to move the osmc system to a usb? I cannot use the official osmc installer.
Cheers

messypotamia
Posts: 81
Joined: Tue Jan 27, 2015 12:12 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Wed Sep 26, 2018 3:17 pm

Starting to change my PI3's which are very busy with weather software to only boot from the SD then all read/writes are performed on the USB stick because of SD corruption. My first attempt at follow paulv's instructions was successful (thanks paulv) however I have noticed one anomaly which relates to the /var/log/syslog. Here's a pertinent screenshot which should describe what's happening.

Code: Select all

pi@PI3Bplus:~ $ sudo logger powercrash2
pi@PI3Bplus:~ $ tail /var/log/syslog
<...Snip...>
Sep 26 16:56:57 PI3Bplus pi: powercrash2
pi@PI3Bplus:~ $ cat /var/log/syslog | tail | grep powercrash
Sep 26 16:56:57 PI3Bplus pi: powercrash2
pi@PI3Bplus:~ $ cat /var/log/syslog |grep powercrash
Binary file (standard input) matches
pi@PI3Bplus:~ 
As you can see, I write a test entry to syslog, I pipe a cat of the whole file thru |tail| and it picks it up, however, if I cat the syslog then directly into the grep, it doesn't pick it up and gives me a response I haven't seen before. On another Pi3 which I haven't yet moved the system to a USC stick, this doesn't happen. Anybody have an explanation for this? I rely on some scripts to reliably write to syslog, and when I'm testing.
Thanks! --MP

messypotamia
Posts: 81
Joined: Tue Jan 27, 2015 12:12 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Fri Sep 28, 2018 8:20 am

messypotamia wrote:
Wed Sep 26, 2018 3:17 pm
Starting to change my PI3's which are very busy with weather software to only boot from the SD then all read/writes are performed on the USB <<SNIP>>
Anybody have an explanation for this? I rely on some scripts to reliably write to syslog, and when I'm testing.
Thanks! --MP
I discovered that, although I've never seen this before, it probably has nothing to do with moving the system to a USB stick; rather, somehow binary characters are being written to the syslog and grep (et al) has a hard time picking them out unless you tell it to include binary. Sorry for the trouble, leaving this just in case for someone else.

Naoned
Posts: 1
Joined: Sun Oct 07, 2018 7:02 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Sun Oct 07, 2018 7:33 am

Hi

This tutorial is super well done! I am using a 32 GB 32 msata SSD drive in the Inateck case that runs on the Raspberry PI 3 Raspbian stretch!

pi@raspberrypi_3:~ $ sudo nano /etc/fstab

proc /proc proc defaults 0 0
PARTUUID=dcf7fcf9-01 /boot vfat defaults 0 2
PARTUUID=d7931bd4-3e99-448e-b5fe-f941c40b7ac6 / ext4 defaults,noatime 0 1
PARTUUID=9e43c454-5baf-4ec3-8796-36c29272ccec /mnt/my_data ext4 defaults 0 1

# PARTUUID=dcf7fcf9-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that

However, I have two questions:

How to access now all my SD card?

How to move the folder / home / pi / Documents in the 2nd partition my_data?

thanks in advance

Naoned

Wilburn643
Posts: 1
Joined: Sat Dec 15, 2018 10:21 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Wed Dec 19, 2018 9:54 am

This is very good. It has solved the problem that I was having with gphoto2 writing to both the hard drive and the sd card.

Just a thought though. I made a copy of my sd card image with pi cloner before I started, as I had been working on it for a week and didn't want to loose what I had.

_____________________________________________________________________________________________________________________________________________
mybkexperience

wpballa1
Posts: 70
Joined: Sat Jun 27, 2015 12:49 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Wed Aug 14, 2019 12:40 am

Paulv,
I've tried your instructions a half dozen times with a Full Buster on a model 4 B and it isn't quite working (using the PARTUID). A number of steps appear to need updating, but once I did get it working no other usb sticks could mount when plugged in, so there appears to be some further subtle change needed.
The main problem seems to be that the OS auto mounts the stick making it difficult to partition, put a file system on and move to /mnt instead of /media.
I hope you can help.
Bill
I have the same problem on both a model 3 B and 2 B. Here are the key inputs.

Code: Select all

pi@Bsqrd:~ $ sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="3FFE-CDCA" TYPE="vfat" PARTUUID="0cf71762-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="3122c401-b3c6-4d27-8e0d-6708a7613aed" TYPE="ext4" PARTUUID="0cf71762-02"
/dev/sda1: LABEL="rootfs" UUID="89a0661e-5145-4be0-b36b-6238c910a27b" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="e7cebffd-ee1e-47bd-b900-492ed735fc22"
/dev/sdb1: UUID="80B1-F9A6" TYPE="vfat" PARTUUID="d9d1df8f-01"
/dev/mmcblk0: PTUUID="0cf71762" PTTYPE="dos"

Code: Select all


pi@Bsqrd:~ $ more /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=e7cebffd-
ee1e-47bd-b900-492ed735fc22 rootfstype=ext4 elevator=deadline fsck.repair=yes ro
otwait quiet splash plymouth.ignore-serial-consoles

Code: Select all

pi@Bsqrd:~ $ more /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=0cf71762-01  /boot           vfat    defaults          0       2
PARTUUID=e7cebffd-ee1e-47bd-b900-492ed735fc22 / ext4 defaults,noatime 0 1
#PARTUUID=0cf71762-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

Code: Select all

pi@Bsqrd:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  6.2G   22G  23% /
devtmpfs        459M     0  459M   0% /dev
tmpfs           464M   20M  444M   5% /dev/shm
tmpfs           464M   13M  451M   3% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           464M     0  464M   0% /sys/fs/cgroup
/dev/mmcblk0p1  253M   40M  214M  16% /boot
tmpfs            93M     0   93M   0% /run/user/1000


daemmi
Posts: 1
Joined: Thu Aug 15, 2019 11:14 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Thu Aug 15, 2019 11:24 am

Hey all,

I used this How To for my Raspberry Pi 3 and now also for my Raspberry Pi 4. It works actually. But if I connect my SSD to one of the 2 blue USB3 ports of the Raspberry Pi 4 it doesn't boot up. On the other two ports it works well.

I get this errors:

FAILED to start Configure Bluetooth Modems connected by UART
FAILED to start System Logging Service
FAILED to start Avahi mDNS/DNS-SD Stack
FAILED to start Login Service
FAILED to start WPA supplicant
FAILED to start Disk Manager

Is this a hardware problem? The SSD works if I boot from SD. So the USB3 actually works.

Thanks in advance

Cheers Jonas

gkreidl
Posts: 6325
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Thu Aug 15, 2019 12:37 pm

daemmi wrote:
Thu Aug 15, 2019 11:24 am
Hey all,

I used this How To for my Raspberry Pi 3 and now also for my Raspberry Pi 4. It works actually. But if I connect my SSD to one of the 2 blue USB3 ports of the Raspberry Pi 4 it doesn't boot up. On the other two ports it works well.

I get this errors:

FAILED to start Configure Bluetooth Modems connected by UART
FAILED to start System Logging Service
FAILED to start Avahi mDNS/DNS-SD Stack
FAILED to start Login Service
FAILED to start WPA supplicant
FAILED to start Disk Manager

Is this a hardware problem? The SSD works if I boot from SD. So the USB3 actually works.

Thanks in advance

Cheers Jonas
Check this: https://www.raspberrypi.org/forums/view ... 1#p1501426
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

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

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Thu Aug 15, 2019 8:23 pm

wpballa1 wrote:
Wed Aug 14, 2019 12:40 am
Paulv,
I've tried your instructions a half dozen times with a Full Buster on a model 4 B and it isn't quite working (using the PARTUID). A number of steps appear to need updating, but once I did get it working no other usb sticks could mount when plugged in, so there appears to be some further subtle change needed.
The main problem seems to be that the OS auto mounts the stick making it difficult to partition, put a file system on and move to /mnt instead of /media.
I hope you can help.
Bill
I have the same problem on both a model 3 B and 2 B.

Rather than executing multiple pages of instructions, you might want to give usb-boot a try:

Code: Select all

pi@raspberrypi:~ $ sudo umount /media/pi/boot
pi@raspberrypi:~ $ sudo umount /media/pi/rootfs
pi@raspberrypi:~ $ sudo ./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:~ $ sudo reboot

That's it!

gkreidl
Posts: 6325
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Fri Aug 16, 2019 5:01 am

RonR wrote:
Thu Aug 15, 2019 8:23 pm

Rather than executing multiple pages of instructions, you might want to give usb-boot a try:
Sorry, but this is exactly the wrong attitude.
This great tutorial makes people understand what they are doing. That's the reason for the existence of the Raspberry Pi.
What you are proposing is: Stay stupid, be happy.
BTW, I'd call that "thread hijacking".
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

User avatar
SyncBerry
Posts: 75
Joined: Sat Sep 21, 2019 11:13 am
Location: France (S-W)

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Mon Sep 30, 2019 1:32 pm

Hi
Great thread !
And now, how do I prevent the original /dev/mmcblk0p2 rootfs to automount in /media/mypiuser so that it drops a day-to-day-not-that-useful-icon to the desktop of mypiuser anytime I boot ?
Thank you

[EDIT]: in the lap time I discovered that this mount is done when I log in GUI. When I reboot and only ssh to the pi, ls /media/pi is empty.

Is it stupid idea to add umount /dev/mmcblk0p2 at the end of .bashrc ?

User avatar
SyncBerry
Posts: 75
Joined: Sat Sep 21, 2019 11:13 am
Location: France (S-W)

Hide partitions on the Desktop

Thu Oct 03, 2019 2:06 pm

SyncBerry wrote:
Mon Sep 30, 2019 1:32 pm
...
And now, how do I prevent the original /dev/mmcblk0p2 rootfs to automount in /media/mypiuser so that it drops a day-to-day-not-that-useful-icon to the desktop of mypiuser anytime I boot ?
...
We can do this via gnome-disks-utility (whose icon drop in Accessories once installed): the gear->Change mounting options. Nice tool that shows you the corresponding changes to udisks and fstab when you tick an option.
There we can also prevent automount

cbp
Posts: 2
Joined: Sat Jan 04, 2020 11:59 pm

rsync errors

Sun Jan 05, 2020 12:14 am

Hi All,

I am having some issues when I run rsync. I tried everything, including fsck on a Ubuntu VM, with no success.

Code: Select all

sudo rsync -axv / /mnt
I am out of ideas and need help.

This is my error:

Code: Select all

rsync: write failed on "/mnt/usr/lib/arm-linux-gnueabihf/libQt5XcbQpa.so.5.11.3": Read-only file system (30)
rsync error: error in file IO (code 11) at receiver.c(374) [receiver=3.1.3]
Running the rsync gives similar read-only errors and after several tries, the last error is this:

Code: Select all

rsync: recv_generator: mkdir "/mnt/usr/src" failed: Input/output error (5)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/mnt/var" failed: Input/output error (5)
*** Skipping any contents from this failed directory ***
usr/src/
var/

sent 4,855,347 bytes  received 249,470 bytes  1,458,519.14 bytes/sec
total size is 7,024,737,103  speedup is 1,376.10
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]
There are lots of other messages above:

Code: Select all

*** Skipping any contents from this failed directory ***
I reformatted the external ssd about 5 times and tried the steps again from this tutorial and other similar one I found online.

Any help will be appreciated.

Thanks in advance,

User avatar
SyncBerry
Posts: 75
Joined: Sat Sep 21, 2019 11:13 am
Location: France (S-W)

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Tue Jan 07, 2020 6:03 pm

When I first setup my Pi I had many things to change so I did it step by step (newb). I did with 2 ssd's I could swap if needed and 2 different lines in cmdline.txt (one commented) directing boot to either the /rootfs PARTUID on one ssd or the other.
I used a file I slightly tweaked before each running rsync depending what I wanted to do (simple backup or restore the last backup) to specify exclusions to rsync.

Code: Select all

cat rsync-excludes
# file to use with rsync. see manual for how to use/set exclusions from file.
/proc/*
/sys/*
/dev/*
/boot/*
/tmp/*
/run/*
/mnt/*
/home/pi/.cache/lxsession/LXDE-pi/run.log
/lost+found/*   #to be continued, see below
/home/lost+found/*      #IIRC, maybe because I have /home in a dedicated partition 
#You may need to change this one
/media/*
Unfortunately my bash_history lost its elder lines, so I can't tell anymore what exact rsync command I used
Here the last greped lines in the .bash_history from the second drive:

Code: Select all

sudo rsync -avx / /media/newdrv
sudo rsync -avx /boot /media/newdrv/boot_OrgSDcopy/
sudo rsync -avx --exclude-from '/home/MyUser/rsync-excludes' /home/.  /media/home/.
sudo rsync -avx --exclude-from '/home/MyUser/rsync-excludes' /.  /media/rootfs/.



NimbUx
Posts: 171
Joined: Fri Jan 03, 2020 10:33 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Sat Jan 25, 2020 11:40 pm

First thing, like many others I want to thank the O.P. for writing the fine tutorial ! Following its mainlines, and of special interest, its use of (more or less) unique IDs with the proper syntax and idioms in, respectively, the SDcard's cmdline.txt and the new target root file system's /etc/fstab files,
I was able to successively run Raspbian, first from a USB key (as an exercise), and finally from a portable, rotating 500 GiB USB hard disk : cool !

I wish to convey a couple personal remarks gained from this experience, fwiw :

1. in spite of the OP warnings, his method with trivial mods applies also to the case when the SDcard has NOOBS (or PINN). In fact, keeping PINN in place on the SDcard, beyond providing for easier maintenance, has the advantage of adding time for the external disk(s) to come alive, should it be needed - without further fuss.

2. For the partitioning of an external disk, I don't quite understand why the O.P. insisted on "gdisk" and the new "GPT"-style. Actually MBR-formatted disks also will have disk and partition UUID's and PARTUUID's and his method is equally workable there.
Perso I prefer MBR-style, for exchanging data with older OSes (yes, even DOS).

[ edited out a first version of this post written before I had sorted outthe problems I thought I had applying the O.P's method to MBR-formatted disks. ]

sinrajendra
Posts: 1
Joined: Mon Apr 13, 2020 11:13 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Mon Apr 13, 2020 11:28 am

Excellent instruction. Used it for my Pi4 without any issue. Thanks for the effort that you have put in.
I did an installation of Node-red and LAMP on the SD card prior to moving the filesystem to the external HDD.
Thereafter, I have installed a photo-server Piwigo which use the LAMP stack and uploaded several thousand photos. Everything is working fine.

I am now worried as to what to do in the event of failure of either of the three main parts - the SD card, the HDD or the Pi4. Obviously I need to create some sort of backup. Can you please tell me how to take a backup and restore it in the unforeseeable situation of a failure in any of three parts.

messypotamia
Posts: 81
Joined: Tue Jan 27, 2015 12:12 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Mon Apr 27, 2020 8:53 pm

I'm broke... thought I followed carefully but had to take the sd card out & rename cmdline.sd to cmdline.txt to get it to boot. Looking at things to figure out what I did wrong. I remember the part of editing the /etc/fstab, and the cmdline.usb, was not *perfectly clear* to me. While reverting to the sd card boot, I mounted dev/sda1 so I could compare the /etc/fstab. Here are what I believe are the pertinent files. I still can't see what the problem is; but when cmdline.usb is the cmdline.txt, it never boots. (I don't have a console hooked up, it's all via ssh).

Code: Select all

#Here are the two /etc/fstabs:

pi@RPI4:/etc $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=29606f3c-01  /boot           vfat    defaults          0       2
PARTUUID=29606f3c-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
pi@RPI4:/etc $ cat /mnt/etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=29606f3c-01  /boot           vfat    defaults          0       2
PARTUUID=d05c536f-3181-4abd-9922-cf1c66a15563  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
Here is blkid:

Code: Select all

pi@RPI4:/etc $ sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="0C61-73F5" TYPE="vfat" PARTUUID="29606f3c-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="43f2d0bb-83be-464f-94d0-9a751f376c64" TYPE="ext4" PARTUUID="29606f3c-02"
/dev/sda1: LABEL="rootfs" UUID="d05c536f-3181-4abd-9922-cf1c66a15563" TYPE="ext4"
/dev/sda2: LABEL="data" UUID="130ebbb1-24c1-419c-9b35-ed2ea077fc27" TYPE="ext4"
/dev/mmcblk0: PTUUID="29606f3c" PTTYPE="dos"
Here are the two cmdline.*:

Code: Select all

 cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=29606f3c-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait consoleblank=0 quiet splash plymouth.ignore-serial-consoles
pi@RPI4:/etc $ cat /boot/cmdline.usb
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=d05c536f-3181-4abd-9922-cf1c66a15563 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait consoleblank=0 quiet splash plymouth.ignore-serial-consoles program_usb_timeout=1
And finally (this is under the cmdline.sd version of cmdline.txt)

Code: Select all

pi@RPI4:/etc $ findmnt -n -o SOURCE /
/dev/mmcblk0p2
pi@RPI4:/etc $ findmnt -n -o SOURCE /boot
/dev/mmcblk0p1
pi@RPI4:/etc $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G   13G  757M  95% /
devtmpfs        1.8G     0  1.8G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G  8.5M  1.9G   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mmcblk0p1  253M   53M  200M  21% /boot
tmpfs           391M     0  391M   0% /run/user/1000
/dev/sda1        18G   14G  3.3G  81% /mnt
pi@RPI4:/etc $
The more I look at this, the more I don't see what I did wrong however the danged thing hangs -- never comes up -- when I use the .usb version of cmdline.
Whiskey Tango Foxtrot. Maybe I'm missing something. Appreciate someone who knows more about this than I do telling me what they see wrong.
Thanks, stay safe ---- MP

messypotamia
Posts: 81
Joined: Tue Jan 27, 2015 12:12 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Mon Apr 27, 2020 10:24 pm

I'm broke... ...<SNIP>... but when cmdline.usb is the cmdline.txt, it never boots. (I don't have a console hooked up, it's all via ssh).
I hooked up a screen so I could see what's going on. It stalls at "[ 2.689679] sd 0:0:0:0: [sda] Attached SCSI removable disk"
Please see the screenshot I took (w/ my mobile)! Note: I unplugged/replugged the USB just to see, it ack's that.

Image

Someone knows what's wrong. That person just isn't me.
Thanks ----- mp
Attachments
PI4_boot_stall2 (Small).jpg
PI4_boot_stall2 (Small).jpg (134.87 KiB) Viewed 1609 times

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

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Mon Apr 27, 2020 11:17 pm

messypotamia wrote:
Mon Apr 27, 2020 10:24 pm
Someone knows what's wrong.

Try usb-boot : Running Raspbian from USB Devices : Made Easy

messypotamia
Posts: 81
Joined: Tue Jan 27, 2015 12:12 am

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Mon Apr 27, 2020 11:41 pm

Re: STICKY: HOWTO: Move the filesystem to a USB stick/Drive

Quote RonR

Post by RonR » Tue Apr 28, 2020 1:17 am
A Raspberry Pi 3B+ has a native USB boot mode (this mode has to be manually enabled by setting an OTP bit on a Raspberry Pi 3B)
-- Sir, I'm not booting from the USB using a "native boot mode", RPI4 isn't capable. I just want it to boot from the SD then the rest of the o/s comes up by mounting the USB as /dev/sda1. Incidentally I do have a PI3B which has no sd card, it boots from the USB and has been up running my weather station for over a year now (438 days) without a reboot.
My problem with this RPI4 is the instructions in the STICKY:.... didn't work.

Return to “Advanced users”