[lxc-users] shared mount and umount propogation.

Serge Hallyn serge.hallyn at ubuntu.com
Tue Feb 4 19:36:32 UTC 2014


Quoting Vijay Viswanathan (vijay.vishy at gmail.com):
> Hi
> Is there an option where shared mount works and restrict propogation of
> unmounts ?
> 
> This the sequence to reproduce the issue.
> 1) make /mnt share mount
> 2) mount a usb stick on it /dev/sdc -> /mnt/usb
>              [here mount shows : /dev/sdc on /mnt/usb type ... ]
> 3) Now start a container that has the mount entry for /mnt
> [e.g., lxc.mount.entry = /mnt /home/otvlxc/rootfs/mnt none rw,bind 0 0 ]
> 
> what I see is :
> lxc-start      73733.655 DEBUG    lxc_conf - umounted
> '/myvm1_putold/mnt/usb'
> /mnt/usb is gone from the host also :(
> 
> 
> The reason I want to make /mnt shared is that to share a mount point that
> is mounted by one vm ( not just mounts done by host) be available on
> another vm any suggestions towards this is fine too.
> 
> Any tips and tricks ?

You can't separate umounts from mounts.  However you can do a step
better than what you have.  You want to have slave semantics from
the host to another directory, then share from that to all
containers.  That way, mounts on your host will be seen in the
containers, but umounts in the containers won't be seen on the
host.  Mounts done in one container will be seen in the others,
however umounts will as well.

-serge


More information about the lxc-users mailing list