[lxc-users] shared mount and umount propogation.
Vijay Viswanathan
vijay.vishy at gmail.com
Thu Mar 6 17:47:34 UTC 2014
isnt --make-rbind and -rbind the same ?
anyways, I think understood the rslave concept.
You want me make a slave mount (e.g., /mnt ) of some original share mount (
e.g., /media ) and expose only /mnt in the lxc conf right ?
But the problem is the cleanup after pivot_root goes through all the
folders in the host proc/mount list.
If /media is shared and /mnt is rslave, exposing only /mnt in the
container still doesnt help because, the pivot_root's clean unmounts /media
and there by /mnt is affected.
sorry about the delay.
Thx.
On Tue, Feb 11, 2014 at 3:35 PM, Serge Hallyn <serge.hallyn at ubuntu.com>wrote:
> Quoting Vijay Viswanathan (vijay.vishy at gmail.com):
> > 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
>
> I'm sorry, --make-rbind doesn't exist in toolsets I'm aware of. I'm
> also confused by the ordering. Could you please write two scripts
> to set up the shared/slave mounts, verify that running one after a
> reboot works and the other fails (meaning container mounts sharing
> works the way you want), then attach the scripts as well as container
> fstabs?
>
> > 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
> > >
>
> > _______________________________________________
> > lxc-users mailing list
> > lxc-users at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-users
>
> _______________________________________________
> 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/20140306/b909f207/attachment.html>
More information about the lxc-users
mailing list