Looks like we’ve had that logic for quite some time.
Basically if LXD is given a subset of an existing pool (say tank/lxd
), it will not perform a zpool export
on shutdown. But if LXD is given a full zpool to work with, either one it created itself or one provided by the user, it will run zpool export
on shutdown to ensure everything is nice and consistent.
On startup, LXD runs zpool import -d /var/lib/lxd/disks/
as that’s the path that LXD created loop-backed zpools use for their disks, so zpool import
will scan both that path and the regular block devices on the system.
Your setup is uncommon because you’re using a loop backed zpool backed by 4 files which weren’t created by LXD (so aren’t in the path we scan) and as you’re providing the entire pool to LXD, it does get exported on shutdown.
There are two easy ways out of this that I can think of:
- Put an init job that runs prior to LXD and runs the correct
zpool import
for your setup - Relocate your zpool backing files to /var/lib/lxd/disks. Note that this option isn’t exactly ideal as LXD generally expects that directory to be used for loop-backed pools that it itself manages, so it may get confused by files that don’t line up.