read-only rootfs + writable overlayfs made easy with dracut

90overlay overlay-generator: replace BindsTo= with Wants= and After= for fsck. 2 days ago
COPYING Add license and copyright informations. 22 days ago
README.md readme: mention directories having to be created since the module won't perform this. 22 days ago
README.md

dracut-overlayfs

This is a custom dracut module designed to facilitate the use of a read-write overlayfs on top of a read-only root filesystem.

It currently does the following:

  • Parse the kernel command line for the overlay= parameter, which should point to the writable layer of the overlayfs.
  • Performs fsck via systemd units generated on the fly for both the root and the writable layer. If fsck cannot be performed, systemd will mention it but not stop the boot process.
  • Setups the overlayfs using systemd generated mount units.

How to use

Place the 90overlay module in /usr/lib/dracut/modules.d and generate your initramfs. It should get picked up automatically. Then, add the overlay= setting to your kernel command line. It can be anything recognized by udev:

  • A partlabel in the form overlay=PARTLABEL=....
  • A partuuid in the form overlay=PARTUUID=....
  • An uuid in the form overlay=UUID=....
  • A label in the form overlay=LABEL=....
  • A device node in the form overlay=/dev/sdX1 (not recommended).

You might need to explicitly add additional drivers and fsck tools in your initramfs, as once you booted onto the overlayfs, when regenerating the initramfs, dracut will not notice which fs module you will require, nor which fsck tool.

Then format a partition with whatever filesystem you wish to use, and create the following directories, with this exact naming:

  • lower
  • upper
  • work