Remount overlayfs to a different folder without reboot

Hi,

When trying to test out some experimental changes to switch config, it would be super convenient to work on overlayfs mounted in memory, and commit only when the change is tested to work without resorting to reboot to fail safe mode.

Here's my mount information

root@X4:/mnt/zram/overlay# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/zram0 on /mnt/zram type ext4 (rw,relatime,block_validity,delalloc,barrier,user_xattr)
/dev/ubi0_1 on /overlay type ubifs (rw,noatime)

I tried to remount overlayfs with

mount -t overlay / -o remount,lowerdir=/,upperdir=/mnt/zram/overlay/upper,workdir=/mnt/zram/overlay/work

However, of course, it did not work.

Can anyone shed some light on properly unmounting / remounting overlayfs (this actually surprised me because google and bing did not return any result for unmounting overlayfs!) ? I know this can definitely be done without reboot because I've seen overlayfs on /tmp/overlay before it get switched to mounting on /overlay

Thanks!