5

Looking for example/howto/etc of howto create an overlayfs for my diskless computers.

I have multiple diskless computers that have root on nfs configured. I would like to use an overlay for files that need to be changed for the computes. Like /etc/hostname and /etc/fstab, etc...

Anyone have this working that can give me a reference url?

Jorge Castro
  • 73,717
Mike
  • 51

2 Answers2

3

I can almost get this working by installing overlayroot, then adding an /etc/overlayroot.local.conf file like this:

overlayroot_cfgdisk="disabled"
overlayroot=tmpfs

However, this bug in overlayfs is blocking my progress. That bug means NFSv3 and overlayfs currently can't play nice together for the copy-on-write functionality you're looking for. Although once that's fixed, I do think using overlayroot is probably the best way to add the needed initramfs magic.

With the above bug, you can create files in the upperdir that don't exists in the lowerdir, but the copy-up from the lowerdir to the upperdir is what's broken. So as a workaround, I recursively delete all files found in these directories when I install my rootfs on the server:

/etc/apparmor.d/cache/
/var/log/
/var/lib/ubuntu-release-upgrader/
/var/lib/update-notifier/

This gives me a more-or-less properly functioning system, enough to run the client stuff I need.

For more info, check out Dustin Kirkland's blog post on overlayroot.

jderose
  • 669
1

You could try adding to your startup scripts (e.g. paste into /etc/rc.local - before the exit 0 line - if you don't want to get into the nitty gritty of bootscript programming) the following sequence which uses a temporary memory filesystem for the overlay (you'll want to replace that line with one that points to your preferred location!):

mkdir /mnt/root /mnt/overlay
mount -o bind / /mnt/root
mount -t tmpfs tmpfs /mnt/overlay
mount -o lowerdir=/mnt/root,upperdir=/mnt/overlay -t overlayfs /

Beware, that I've NOT tested whether this works!