Raspberry Pi 4 B extroot configuration

Hi,

I am new to OpenWrt, and today I installed it on a Raspberry Pi 4 B. It has a microSDXC card with 128GB which I want to use for additional software.

So I found https://openwrt.org/docs/guide-user/additional-software/extroot_configuration
I did not quite match but I believe it should now work - but it does not.

DEVICE="$(awk -e '/\s\/overlay\s/{print $1}' /etc/mtab)"
gives me /dev/loop0 which I find strange.

So I

  • did what 2. Configuring rootfs_data says
  • created another partition mmcblk0p3 with ext4
  • did what 3. Configuring extroot says but instead of sda1 used mmcblk0p3
  • did what 4. Transferring the data says
  • rebooted
  • but now everying is as before

What should I do?

The current state:

root@fxpi:/# mount /dev/mmcblk0p3 /mnt
root@fxpi:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 4352      4352         0 100% /rom
tmpfs                  1951948        56   1951892   0% /tmp
/dev/loop0               95003      5022     82819   6% /overlay
overlayfs:/overlay       95003      5022     82819   6% /
/dev/mmcblk0p1           65390     15994     49396  24% /boot
tmpfs                      512         0       512   0% /dev
/dev/mmcblk0p3       122205824     66264 115888760   0% /mnt
root@fxpi:/# block info
/dev/loop0: UUID="0f4f1165-25b2-4f12-a1fc-31849cb4022a" LABEL="rootfs_data" VERSION="1.0" MOUNT="/overlay" TYPE="ext4"
/dev/mmcblk0p1: UUID="2877-029C" VERSION="FAT16" MOUNT="/boot" TYPE="vfat"
/dev/mmcblk0p2: UUID="b4e43f3a-a6abb168-21c05266-2b5cf18a" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mmcblk0p3: UUID="0d3b2a4c-bb14-4bb2-abbf-37717762bac5" VERSION="1.0" MOUNT="/mnt" TYPE="ext4"
root@fxpi:/etc# uci get fstab.overlay
mount
root@fxpi:/etc# uci get fstab.overlay.uuid
0d3b2a4c-bb14-4bb2-abbf-37717762bac5
root@fxpi:/etc# uci get fstab.overlay.target
/overlay

Anyone was able to configure extroot on any other partition than default one on raspberry ?
I tried as mentioned here on mmcblk0p3 and on external USB /dev/sda1 but without success.
I found topic Expanding OpenWrt squashfs image? (SDcard) - #11 by pierrehavelaar
which leads to https://bugs.openwrt.org/index.php?do=details&task_id=2231

I too am having the same problem. Can anyone help? Being able to use an ext4 partition on the Pi\s SD card as overlay (while keeping the easy resetability of SquashFS) would be great

Maybe @wulfy has some ideas considering how much work he's put into his build. Or maybe has a suggestion of who to ask.

didn't attempt an extroot-overlay on squashfs

messed around with one on ext4 and while it was functional... it was a little more clunky... probably something minor with the traditionally early mtd style overlay switching...
(from memory i think I may have set the partition label to 'rootfs_data' or something... but I don't think that would work on squashfs)

imho

dont go hand in hand...

for sdcard based devices... i recommend;

  • burn a second sdcard with the same version and tape it to the top of the case
  • use the image builder to change the default partition sizes of an ext4 fs image

squashfs + large-overlay on a following partition do make sense from a 'virtual-box' -> 'gimme-more-space-now' on a factory image does make some sense... so we might have to hang around for someone who's using an sdcard style(squashfs) image to mess around with it a little more to pinpoint the quirks more clearly...

even then... I think it's only a thing for people with 'intermediate' or previous experience with overlay on other devices... to many places people can overlook steps or fail to transfer what is good general guidance into situational use...

afaik @erdoukki would probably be the person who comes to mind who might have some practical experience / ability to pinpoint exact quirks re: squash+sdcard+extroot-overlay...
( farouk tazkan ? name escapes me is also a master in this space )

my overwhelming advice is that default partition sizes on sdcard/disk images is at least 35-50% too small... the smartest thing that can be done in the short term is adding at least an extra %35 which for most people...

will remove the need for the overlay all together...

All wise words someothertime, however it would be good if all squashfs devices behaved similarly in respect to extroot, whether they're mtd, nand or emmc based. Would just save a lot of hassle for everyone!

1 Like

indeed...

the use case you provided seems entirely new... i'm not aware of any nand, emmc or mtd device that will allow for an extra augmented extroot-overlay on the same disk...
(guides and advice specifically state to use an additional disk)

in the linux overlay man pages i believe this is actually outlined as one of the primary restrictions of overlays in general...
(hint: if your preinit sets up a loopdev it will work)

going off the downloads stats... these kinds of images rank very highly in popularity... so i'm sure there are many others with similar experience...

here is another tip...

if you leave your 'hot-swap' sdcard in a usb-card reader... you can mount it and run a cron/manual periodic backup as such;

sysupgrade -b -k /mnt/card2p1/sysupgrade.tgz

if you ever need to recover ... swap the cards... possibly re-install any recently installed packages... would take maybe 2mins tops...

I prefer personaly use an ext4 system and extend the eMMC (or uSD) with an additional partition where I copy the system root (and mount as / for extroot)...
Then fstab (block-mount ipk) take care of any crash and check fs with the option :

config 'global'
...
        option  check_fs        '1'
...
config 'mount'
        option  target  '/'
        option  uuid    'replace with correct uuid found it with blkid command'
        option  enabled  '1'
        option enabled_fsck '1'

It is a 24/24 7/7 365/365 solution which is crashless !
No problem with sysupgrade, but you'll need to replace then the added partition content with the sysupgraded rootfs content...

I have done some "ugly" scripts to take care of this type of installation; available here :

They also take care of adding ipk at upgrade and firstboot...

Mostly working on espressobin board arm64 custom firmware but may be enhanced and fixed to be more stable and use also on any board like the RPi !

The poweroff, unplug, crash of filesystem is easily fixed with this method / scripts...
An automated reboot may happen after a filesystem fix...

1 Like

on pi 3, just followed this guide, I wasn't expecting that easy but it worked somehow in first try

start from here, I already formatted partition to ext4 on ubuntu machine before inserting card to Pi

I don't really see the problem, use ext4 and extend the root FS.
Why bother with exroot in the 1st place?

that was title of this thread