Lxd snap - can't locate /containers folder

I don’t understand the logic here

total 4
lrwxrwxrwx 1 root root 66 Nov 14 16:23 [container_name] -> /var/snap/lxd/common/lxd/storage-pools/default/containers/[container_name]

but

$ sudo ls -l /var/snap/lxd/common/lxd/storage-pools/default/containers/
ls: cannot access '/var/snap/lxd/common/lxd/storage-pools/default/containers/': No such file or directory

I am running the snap lxd on an ubuntu 20.04 host. The default (btrfs) storage pool is initialized to live on an entire LVM logical volume as described in this related Topic.

The mounts are all hidden away in a mount namespace so the host doesn’t get confused.

You can peak into that mount namespace through /var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/

thx.

this is LXD (not LVM or any other type of partitioning nor fs type) behaviour, right?

curious whether …

  1. this is to avoid unintentional use of a partition dedicated to an LXD storage-pool for other operations?
  2. if it was possible to nevertheless use that dedicated space for other then storage-pool activities via the path /var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/ if you wanted to?

We don’t mount the whole storage pool for LVM, that’s not how LVM works. Each volume stored on the volume group is mounted as it is needed under that location. But the directory itself is not actually part of the pool.

You can use the space in the volume group to create your own volumes and mount them but this is not recommended as you may hit volume naming conflicts with LXDs volumes.