When using LXD (LTS release v2.0.11) with a ZFS storage backend there’s a noticeable delay when starting a container. The delay does not happen for the dir backend. Is this expected behavior with the ZFS backend?
After a container starts, I see this error message in the LXD log:
INFO[01-11|00:26:47] Starting container action=start creation date=2018-01-10T23:12:07+0000 ephemeral=false name=trusty stateful=false EROR[01-11|00:26:58] zfs mount failed driver=storage/zfs output="cannot mount 'lxd/containers/trusty': filesystem already mounted\n" INFO[01-11|00:26:58] Started container action=start creation date=2018-01-10T23:12:07+0000 ephemeral=false name=trusty stateful=false
There’s roughly a ten second delay from when
lxc start is ran and when the “zfs mount failed” error shows up and the container ultimately starts.
When I trace exec syscalls on the system (using bcc execsnoop), I see that
/sbin/zfs mount is being called repeatedly up until the “zfs mount failed” log error message appears.
Given that the LXD error message says “filesystem already mounted”, I tried manually unmounting the container’s zfs mountpoint. After unmounting, there is no delay when starting the container and the zfs error message doesn’t happen. Stopping and starting the container again results in the delay as the zfs mountpoint resides even after the container has stopped.