Why are storage-pools mounted under /var/lib/lxd/storage-pools?

I ran

lxc storage create btr-pool btrfs source=/media/user/lxc
lxc storage create dir-pool dir source=/media/user/ext4-store/lxc

And now mount gives me (aside from the actual mounts specified above):

/dev/sdb2 on /var/lib/lxd/storage-pools/dir-pool type ext4 (...)
/dev/sdb1 on /var/lib/lxd/storage-pools/btr-pool type btrfs (...)

Is this correct? If so, could someone explain the purpose of these mount points?


It’s correct, all storage pools are always mounted in /var/lib/lxd/storage-pools, that makes it so we can do kernel security policies, migration tools, backup tools and in general give user instructions that will work regardless of configuration.

When a source is configured, LXD will simply bind-mount that source onto the normal storage pool path and then continue operating as normal, that’s what those mount entries represent.

That entirely makes sense now. Thanks!

p.s. discovered the findmnt command in the process, neat.

1 Like

I recently updated from LXD 3.0.3 (deb) to 4.2 (snap) under Ubuntu 18.04 LTS. I have two storage pools with btrfs backend on two differnent lvm volumes.

Before I ran lxd.migrate, the storage-pools have been mounted under /var/lib/lxd/storage-pools like described above, after the migration everything works, but the pools are not visible as mounts on the host system.

What happend here? Are the pools and the root-filesystems not accessible from the host anymore?


Snap uses a different path, the path is /var/snap/lxd/common/lxd.
I guess you should find your data there now.

No, the mounts of the filesystems are not visible at all on the host. The directory /var/snap/lxd/common/lxd/storage-pools/default for example exists but is empty.

The snap hides everything away in its own mount namespace.

If you need to introspect things you can use the /var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools path to take a peak inside it.