[lxc-users] shared mount and umount propogation.

Vijay Viswanathan vijay.vishy at gmail.com
Mon Feb 10 22:20:27 UTC 2014


Thanks,
seem to work only for sharepoint within / mounted as ext4
doesnt seem to work if the shared folder is inside of a tmpfs ( ad hoc
created /tmp etc., )


container1.conf : added entry for /mnt  [ lxc.mount.entry = /mnt
/container1/rootfs/mnt none rw,rbind 0 0 ]
container2.conf : added entry for /mnt [ lxc.mount.entry = /mnt
/container2/rootfs/mnt none rw,rbind 0 0 ]

works :
  mkdir -p /mnt
  chmod 777 -R /mnt
  mkdir -p /media
  mount --make-rbind /media /media
  mount --make-rshared /media
  mount --make-rbind /media /mnt
  mount --make-rslave /mnt


container1.conf : added entry for /mnt pointing to  /tmp/mnt  [
lxc.mount.entry = /tmp/mnt /container1/rootfs/mnt none rw,rbind 0 0 ]
container2.conf : added entry for /mnt pointing to  /tmp/mnt

doesnt work:
mount -t tmpfs -o mode=01777 tmpfs /tmp
  mkdir -p /tmp/mnt
  chmod 777 -R /tmp/mnt
  mkdir -p /tmp/media
  mount --make-rbind /tmp/media /tmp/media
  mount --make-rshared /tmp/media
  mount --make-rbind /tmp/media /tmp/mnt
  mount --make-rslave /tmp/mnt

container-2 still unmounts /tmp/mnt

what ever container1 mounts in /mnt is visible on container2

found a thread where entry in fstab matters?

Thanks.



On Tue, Feb 4, 2014 at 11:36 AM, Serge Hallyn <serge.hallyn at ubuntu.com>wrote:

> 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
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140210/da742966/attachment-0001.html>


More information about the lxc-users mailing list