2

I configured LXD using existing ZFS pool. I then created a container, which is running correctly. LXD knows about the ZFS storage, because it created two directories there: containers and images. Also, "lxc info" displays the ZFS pool name.

However, the directories in the ZFS pool are empty. The actual files have been stored in /var/lib/lxd.

What am I missing here?

  • Wait, I'm not sure I understand this. I did not try ubuntu+ZFS myself yet, but I thought you can setup a ZFS file system on Ubuntu and then mount it like any other "drive". Then applications should absolutely not care where their files are located as long as the correct paths are provided. – Potaito Apr 15 '16 at 17:38
  • Well, that's the point: I have set up a ZFS file system, and passed it to LXD during the init process. However, LXD isn't actually using it - hence this question. – Brad Richards Apr 21 '16 at 6:23
1

Here is what it looks like for containers:

root@nsn7:~# zfs list -r nsn7/lxd/containers
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
nsn7/lxd/containers                     2,95G   259G    19K  /nsn7/lxd/containers
nsn7/lxd/containers/lds-xenial          2,68G   259G  3,16G  /var/lib/lxd/containers/lds-xenial.zfs
nsn7/lxd/containers/maas-trusty          214M   259G   214M  /var/lib/lxd/containers/maas-trusty.zfs
nsn7/lxd/containers/maas-trusty-virbr1  57,0M   259G   570M  /var/lib/lxd/containers/maas-trusty-virbr1.zfs

Observe where each zfs dataset is mounted, above and in this output asking specifically for the mount-related options:

root@nsn7:~# zfs get all nsn7/lxd/containers/maas-trusty|grep mount
nsn7/lxd/containers/maas-trusty  mounted               yes                                      -
nsn7/lxd/containers/maas-trusty  mountpoint            /var/lib/lxd/containers/maas-trusty.zfs  local
nsn7/lxd/containers/maas-trusty  canmount              on                                       default
0

I saw this myself in the beginning, letting LXD set up the ZFS partition for me and then going back into it to set the mountpoint, but as you say it was empty.

You already have the answer provided by Andreas (and you should accept it as so), but just for clarification should it not be apparent:

LXD mounts the individual paths in the same place as it would if using DIR - /var/lib/lxd/(containers/images) and setting a mount point at the root of the ZFS pool you set up won't give you visibility of these folders as you might expect on a "traditional" FS.

It isn't entirely clear when looking at it for the first time, but it's working as intended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.