Mounting /var to tmpfs - Dracut Question

C. Cook c.a.cook at quantum-sci.com
Tue Oct 30 19:57:10 UTC 2018


I am working toward making a read-only filesystem, and setting aside the
merit and feasibility of that, I need to mount /var in tmpfs.  Of course
/var/log, spool, cache, lock, etc must be writeable, and we can't
anticipate what other areas of /var a given application might decide to
write to. (I've already resolved other parts of the filesystem)

I intend to mount /var, overlay. (a new feature in kernel 3.18+)  I
don't want the underlying /var to be written at all, even on boot, so I
think it stands to reason that this must be done in a dracut module,
maybe with a premount or mount hook.  Overlay mounts are a wonderful new
feature which much improves on union mounts.  In this case I want /var
on disk to be Under and read-only, and /var in tmpfs to be Over and rw.

The overlay mount commands are no problem.  But putting this action in
the right place in the boot process has me stuck.  Under Posix standards
I believe I'd put the script in /usr/local/lib/dracut/modules.d.  But
I'm not clear on dracut's process and how it assembles initramfs, nor
how to invoke the pre-mount hook.

Input appreciated.





More information about the redhat-list mailing list