A quick question: I was going through the mount output of an openWRT device, and I noticed this:
root@OpenWrt:/# mount ... /dev/loop0 on /overlay type ext4 (rw,noatime) ... root@OpenWrt:/# cat /sys/class/block/loop0/loop/backing_file /mmcblk0p2 root@OpenWrt:/# cat /sys/class/block/loop0/loop/offset 14155776
Correct me if I'm wrong, but it seems the /overlay partition is mounted through a loopbackdevice, that takes its backing file from a direct raw partition.
I never tried this before and didn't know it worked, but as far as I understand the only benefit of doing this (vs just doing a simple mount) is that you can skip the partition table on the device and force the start of some filesystem at a specific offset.
Is this what this is used for? (to remain flexible somehow in case the partition table/mtd mapping/whatever is not setup correctly?) Or are there other shenanigans going on under the hood for which this method was devised?
I quickly tried to find the relevant code that actually sets up the mapping, but didn't immediately find it. Perhaps someone could point me to the relevant location?
Thanks for your feedback!