How to share common rootfs among instances in LXD using directory backend and overlayfs

I have instances for different purposes (asterisk/hostapd/samba etc) .
Any change in rootfs (e.g. apt update/upgrade, fail2ban updates) should be visible in the instances.

In lxc , I can use lxc-clone and provide a configuration like

lxc.rootfs = overlayfs:/var/lib/lxc/lxctest/rootfs:/var/lib/lxc/snapclone/delta0

How can I make my instances inherit/sharing the same rootfs without copying/extracting a new rootfs?


@stgraber does LXD support using overlayfs as rootfs?

No, it doesn’t. We had far too many problems with overlayfs in LXC to want to get them again in LXD :slight_smile:

Hi, is there any recommended way of sharing the rootfs?
Is there a docker like (“FROM” Keyword) way of inheriting an parent container/storage and adding some changes?

I am thinking of, making up my own rootfs (merged view) from overlayfs?

Any ideas?

Usually most folks rely on a simple lxc copy which when on a suitable backend (btrfs, zfs, …) is a cheap copy-on-write operation from its source.

1 Like