Mount host directory recursively in container

I have a LXD (2.18) host with a ZFS pool on Ubuntu 16.04 LTS. I have different ZFS datasets as:

tank/Multimedia
tank/Multimedia/Muziek
tank/Multimedia/Video
tank/Multimedia/Fotos

and all mounted on the host.
When I try to mount the mounted /tank/Multimedia in a container at (let’s say) /Multimedia, the it only show the contents of Multimedia and not the sub datasets Music, Video and Fotos.

Is there a way to mount such a dataset recursively or do I really have to add them all in the container seperately with lxc config device add…?

Did you try setting the “recursive” property to true on your disk entry?

Hmmmm maybe I should think about RTFM first for a change. Thanks Stephane! That was exactly what I was looking for.
Triple bookmarked: https://github.com/lxc/lxd/blob/master/doc :wink:

https://lxd.readthedocs.io should have a more readable layout.

We still need to update a bunch of links to point to it :slight_smile:

is it work?

I tried like this:

sudo zfs create user-pool/myDATA/docker

lxc config device add ubuntu myDATA disk source=/myDATA path=/myDATA recursive=true

doesn’t work for me.
/myDATA is mounted, but /myDATA/docker doesn’t mounted.


recursive option work after reboot.
before reboot, myDATA mounted only.