Where is OpenWrt storing config on ERLite flash?

Can anyone help explain where/how OpenWRT is storing configuration changes on the flash drive in a Ubiquiti ERLite3 router?

After scouring the docs on flash layout, and examining the removable drive on my Linux desktop, I can't find where it's keeping the configured contents of what is the /overlay filesystem.
Partition 2 is still a squashfs, appearing unchanged from when I installed it. Yet, the router is remembering my configuration. How?

Configuration management on OpenWrt is generic to all devices, using uci and storing inside the (virtual-) rootfs, under /etc/config/. Given that the rootfs is read-only, the actual configuration gets written to the overlay.

That's exactly what has me puzzled: I can't determine where overlay gets written.
The only partitions on the flash drive are the two installed originally, and the /overlay mount point in the root squashfs is still empty. (As it should be) Which makes sense since /overlay is mounted from something else, but what?

The /overlay filesystem is packed into the rootfs partition after the squashfs ROM. At runtime a script mounts it using a loop mount with an offset.

/dev/loop0 on /overlay type f2fs (rw,lazytime,noatime,background_gc=on,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)

I think that x86-squashfs works the same way. Since the squashfs is read only it never expands to conflict with using the tail end of the partition for something else.

It would be theoretically possible but difficult to re-create this and mount the overlay offline on another system.

Thank you! That explains exactly what I was hoping to understand.

(my concern was it was perhaps using the device's built-in flash - which should contain only the bootloader) instead of the pluggable USB. The pluggable flash is somewhat unique to this device and very handy for changing OS' easily)
I will study /etc/preinit and its successor scripts more carefully for how this happens.
(not an easy task, at least for me)
It helps a lot to at least know what I'm looking for.
Thanks again.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.