[lxc-users] Mounting additional volume on container

Christian Benke benkokakao at gmail.com
Wed Oct 7 09:54:47 UTC 2015

On 5 October 2015 at 17:32, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> The 'lxc.mount.entry's are mounted after the user namespace unshare,
> therefore you are not allowed to mount a device.  You could mount the
> device somewhere onto the host and bind-mount it into the container.

Oh! Ok. Based on the threads I linked earlier I was under the
impression it was possible to mount a device directly, would have been
neat [1][2]

[1] https://lists.linuxcontainers.org/pipermail/lxc-users/2014-February/006257.html
[2] https://lists.linuxcontainers.org/pipermail/lxc-users/2014-February/006174.html

> How to enable this is not clear.  In lxd we can support this
> using the 'disk' device, which is mounted into place by first
> mounting it, on the host, into a directory which is ms-shared
> with the container, then mount --moving it in the container.  In
> lxc we aren't guaranteed to have such a shared directory.  You
> can certainly do it yourself, but I don't know that we can do it
> generically.

I can't follow you here. But I'm able to do a bind-mount now and work
with that, same as in my current OpenVZ-deployment.

>> What confuses me is the intransparency of how the mount is supposed to
>> work according to the lxc-logfile. Why is it trying to mount to
>> "/usr/lib/x86_64-linux-gnu/lxc/bla", not mounting to
>> /var/lib/lxc/lxc_test_ubuntu/rootfs/ or the real lvm-root?
> /var/lib/lxc/lxc_test_ubuntu/rootfs is the source of the rootfs mount
> (when using a directory backed container), not the destination.  The
> container rootfs is always mounted onto /usr/lib/x86_64-linux-gnu/lxc.

As described in /usr/lib/x86_64-linux-gnu/lxc/README, didn't see that
earlier. Thanks for explaining it anyway!

Best regards,

More information about the lxc-users mailing list