The fstab below in MicroOS uses by default an overlay for /etc
:
cat /etc/fstab
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa / btrfs ro 0 0
UUID=82f3ac8b-5b20-4420-b8c7-f994fccb82e7 /var btrfs subvol=/@/var,x-initrd.mount 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /usr/local btrfs subvol=/@/usr/local 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /srv btrfs subvol=/@/srv 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /root btrfs subvol=/@/root,x-initrd.mount 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /opt btrfs subvol=/@/opt 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /home btrfs subvol=/@/home 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /boot/writable btrfs subvol=/@/boot/writable 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /boot/grub2/x86_64-efi btrfs subvol=/@/boot/grub2/x86_64-efi 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /boot/grub2/i386-pc btrfs subvol=/@/boot/grub2/i386-pc 0 0
UUID=45e755ab-5185-4f37-8c78-7a31f4d6dfaa /.snapshots btrfs subvol=/@/.snapshots 0 0
overlay /etc overlay defaults,lowerdir=/sysroot/etc,upperdir=/sysroot/var/lib/overlay/1/etc,workdir=/sysroot/var/lib/overlay/work-etc,x-systemd.requires-mounts-for=/var,x-systemd.requires-mounts-for=/sysroot/var,x-initrd.mount 0 0
In a previous comment it was noted that this /sysroot
is located in /var/lib/overlay
, which is indeed correct.
But what I seem to misunderstand is how /etc/fstab
understands that this /sysroot
is actually in /var/lib/overlay
. The kernel documentation doesn’t provide me with the answer either. There it seems to define a directory on the filesystem? But if that’s true, how does this work if the verbatim directory /sysroot
does not exist?