Run Writeable Overlay from RAM (tmpfs)

Raspberry Pi 4b 64-bit running OpenWrt 23.05 using squashfs factory image

For development and test purposes I am hoping to have a system that starts fresh on every reboot. I understand that the overlay is the writeable partition where system changes like package installs and config file changes persist. I'm thinking that if I can redirect the overlay to tmpfs then any changes I make for testing etc will be erased on reboot.

Has anyone done this? I found one thread from around 2020 that seemed similar but it was never solved.

AFAIK OpenWrt automatically falls back to tmpfs if it can't mount the overlay partition. So just remove it's entry in the partition table.

Thank you! I ended up adding the following to the end of the boot section in /etc/init.d/boot

     # Create temporary folders for /etc and /usr
     mkdir -p /tmp/etctmp /tmp/usrtmp
     # Copy the contents of /etc to the temp folder
        cp -Ra /etc/. /tmp/etctmp
     # Mount /etc as tmpfs
        mount -t tmpfs tmpfs /etc -o rw,noatime
     # Copy the contents from the temp folder to the mounted tmpfs /etc folder
        cp -Ra /tmp/etctmp/. /etc
     # Delete the temporary folder
        rm -rf /tmp/etctmp
     # Repeat the above for the /usr folder
        cp -Ra /usr/. /tmp/usrtmp
        mount -t tmpfs tmpfs /usr -o rw,noatime
        cp -Ra /tmp/usrtmp/. /usr
        rm -rf /tmp/usrtmp

     # Remount the root filesystem as read only
        mount -o remount,ro /

So far, the system seems stable, but I need to test it. If it holds up I will mark this as solved.