1
0
I use Linux overlay
fs as root filesystem to keep the real root partition read-only and write changes to another fs (e.g., tmpfs or another partition).
However, when the root filesystem is finally in place (after 'pivot root'), the original mounts (let's say at /dev/sda
at /mnt/root-write-protected
) is hidden in the initial root (eg. init ramdisk), but still actively mounted. However, it is not visible from inside the root filesystem anymore, nor can the original device be mounted again in a writeable fashion, as mount
says:
mount: /dev/sda is already mounted
despite no entry is listed by mount
or cat /etc/mtab
.
How can I access (e.g., read from, remount) this hidden mount?
Off topic, How are you doing this "I use Linux overlay fs as root filesystem to keep the real root partition read-only and write changes to another fs (e.g., tmpfs ..." ? – Anwar – 2019-07-06T17:46:07.460
For Debian like Distros (like Ubuntu) there is a package
overlayroot
, that installs all scripts needed. Also there are older scripts lurking in the internet, that can be installed to the initrd to write-protect the root partition. If you try to do it manually, it's quite involved as you have to do it in early boot (when the kernel mounts the root partition) and therefore you need to do scripting in the initrd. – dronus – 2019-07-10T13:11:03.537I installed the package but couldn't find helpful scripts. All scripts was for accessing files under an overlay mounted fs – Anwar – 2019-07-12T06:45:30.703
After installing the package, you have to set up some configurations eg. edit
/etc/overlayroot.conf
. There is some documentation inside. – dronus – 2019-07-13T09:52:33.640