How to use LVM for extend the root filesystem

Temporary solution!

opkg update && opkg install blockd mount-utils
#  /etc/rc.local 
sleep 20
mount -t ext4 /dev/mobile-disk/overload /overlay

This problem is caused by /sbin/block
If your mount configuration is written in /etc/config/fstab will be use /sbin/block mount disk.
but in my testing /sbin/block not Overlay mount/overlay
Hope to fix this problem

I'm testing this all out with mdadm + LVM but it seems that rc.d always takes over and runs first. My System Log says that it cannot find the UUID for my LVM for extroot and later on I see My VolumeGroup. Also for mdadm... it starts and stops, it's called twice in rc.d.

Anyone an idea about that ?

From current master, lvm2.preinit
Accessible at https://github.com/openwrt/packages/blob/master/utils/lvm2/files/lvm2.preinit

See the note below regarding the necessary location of /lib/preinit/80_lvm2 and /etc/rc.d/S15lvm2 on the 'lower' partition.

#!/bin/sh
# Copyright (C) 2019 Harrie Rooijackers

# The make proecess copies this file to the /lib/preinit/80_lvm2
# As a result it is executed just before 80_mount_root and makes lvm
# entities available during the mount_root process that handles any
# overlays.  This allows overlays to be lvm2 partitions.

# Note that /lib/preinit/80_lvm2 needs to be on the initial "lower"
# partition for this to work.

do_startlvm() {
        echo "Starting lvm2 during preinit" > /dev/kmsg
        # The following 3 lines are copied from from the start function
        # in /etc/rc.d/S15lvm2 which is copyright by Stefan Monnier
        mkdir -p /tmp/lvm/cache
        /sbin/lvm vgscan --ignorelockingfailure --mknodes > /dev/kmsg || :
        /sbin/lvm vgchange -aly --ignorelockingfailure > /dev/kmsg || return 2
}

# Perform the function only if lvm2 is enabled by the user
# Not sure if the test is that useful since it tests the existance
# of /etc/rc.d/S15lvm2 on the initial "lower" partition only so
# changes made after the overlay is created are not taken into account
[ -f /etc/rc.d/S15lvm2 ] && boot_hook_add preinit_main do_startlvm
© 2020 GitHub, Inc.