X86_64: multiple partitions and mounting extra partition in OpenWrt

I have a 64Gb disk inside my x86_64 box and I want to use like 10Gb-20Gb of it for the /opt partition within OpenWrt (for docker-related storage).

I use the ext4 images which I make myself and I don't keep anything when flashing, so would be nice to have a persistent /opt.

Are there any guides that I've missed which would allow me to achieve what I want (as in the OpenWrt in the first ext4 partition and another partition which will be untouched by the future firmware flashing)?

I have never really looked into the ext4 images, but that 'just works' for me with the squashfs based images (/srv/ remains untouched over sysupgrades):

Filesystem                Size      Used Available Use% Mounted on
/dev/root                26.8M     26.8M         0 100% /rom
tmpfs                     1.9G      4.0M      1.9G   0% /tmp
/dev/loop0              891.3M     67.6M    823.7M   8% /overlay
overlayfs:/overlay      891.3M     67.6M    823.7M   8% /
/dev/sda1                31.9M      6.6M     25.4M  21% /boot
/dev/sda1                31.9M      6.6M     25.4M  21% /boot
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda3                28.3G     18.4M     26.8G   0% /srv

(I do build with CONFIG_TARGET_KERNEL_PARTSIZE=32 && CONFIG_TARGET_ROOTFS_PARTSIZE=920, so that accounts for those size differences, in retrospect I should have kept TARGET_ROOTFS_PARTSIZE much smaller (perhaps in the ~250 MB range) - and yes, my /overlay/ doesn't actually need more than ~1 MB, the other 66+ MB are fs overhead for the crap f2fs overlay).

1 Like

I do exactly the opposite :slight_smile:

Ext4, always, and two parallell installs which I alternate.
The not currently used is the one getting the next upgrade, then just reboot into it.

1 Like

Do you pick (and set default) partition in grub? Is the partition switch automated?

Yeah, just change the default menu value in grub.