<div dir="ltr"><div><div>isnt --make-rbind and -rbind the same ?<br><br></div>anyways, I think understood the rslave concept. <br>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 ?<br>
<br>But the problem is the cleanup after pivot_root goes through all the folders in the host proc/mount list. <br>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.<br>
<br></div>sorry about the delay.<br><br>Thx.<br><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 11, 2014 at 3:35 PM, Serge Hallyn <span dir="ltr"><<a href="mailto:serge.hallyn@ubuntu.com" target="_blank">serge.hallyn@ubuntu.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">Quoting Vijay Viswanathan (<a href="mailto:vijay.vishy@gmail.com">vijay.vishy@gmail.com</a>):<br>
> Thanks,<br>
> seem to work only for sharepoint within / mounted as ext4<br>
> doesnt seem to work if the shared folder is inside of a tmpfs ( ad hoc<br>
> created /tmp etc., )<br>
><br>
><br>
> container1.conf : added entry for /mnt  [ lxc.mount.entry = /mnt<br>
> /container1/rootfs/mnt none rw,rbind 0 0 ]<br>
> container2.conf : added entry for /mnt [ lxc.mount.entry = /mnt<br>
> /container2/rootfs/mnt none rw,rbind 0 0 ]<br>
><br>
> works :<br>
>   mkdir -p /mnt<br>
>   chmod 777 -R /mnt<br>
>   mkdir -p /media<br>
>   mount --make-rbind /media /media<br>
<br>
</div>I'm sorry, --make-rbind doesn't exist in toolsets I'm aware of.  I'm<br>
also confused by the ordering.  Could you please write two scripts<br>
to set up the shared/slave mounts, verify that running one after a<br>
reboot works and the other fails (meaning container mounts sharing<br>
works the way you want), then attach the scripts as well as container<br>
fstabs?<br>
<div class="HOEnZb"><div class="h5"><br>
>   mount --make-rshared /media<br>
>   mount --make-rbind /media /mnt<br>
>   mount --make-rslave /mnt<br>
><br>
><br>
> container1.conf : added entry for /mnt pointing to  /tmp/mnt  [<br>
> lxc.mount.entry = /tmp/mnt /container1/rootfs/mnt none rw,rbind 0 0 ]<br>
> container2.conf : added entry for /mnt pointing to  /tmp/mnt<br>
><br>
> doesnt work:<br>
> mount -t tmpfs -o mode=01777 tmpfs /tmp<br>
>   mkdir -p /tmp/mnt<br>
>   chmod 777 -R /tmp/mnt<br>
>   mkdir -p /tmp/media<br>
>   mount --make-rbind /tmp/media /tmp/media<br>
>   mount --make-rshared /tmp/media<br>
>   mount --make-rbind /tmp/media /tmp/mnt<br>
>   mount --make-rslave /tmp/mnt<br>
><br>
> container-2 still unmounts /tmp/mnt<br>
><br>
> what ever container1 mounts in /mnt is visible on container2<br>
><br>
> found a thread where entry in fstab matters?<br>
><br>
> Thanks.<br>
><br>
><br>
><br>
> On Tue, Feb 4, 2014 at 11:36 AM, Serge Hallyn <<a href="mailto:serge.hallyn@ubuntu.com">serge.hallyn@ubuntu.com</a>>wrote:<br>
><br>
> > Quoting Vijay Viswanathan (<a href="mailto:vijay.vishy@gmail.com">vijay.vishy@gmail.com</a>):<br>
> > > Hi<br>
> > > Is there an option where shared mount works and restrict propogation of<br>
> > > unmounts ?<br>
> > ><br>
> > > This the sequence to reproduce the issue.<br>
> > > 1) make /mnt share mount<br>
> > > 2) mount a usb stick on it /dev/sdc -> /mnt/usb<br>
> > >              [here mount shows : /dev/sdc on /mnt/usb type ... ]<br>
> > > 3) Now start a container that has the mount entry for /mnt<br>
> > > [e.g., lxc.mount.entry = /mnt /home/otvlxc/rootfs/mnt none rw,bind 0 0 ]<br>
> > ><br>
> > > what I see is :<br>
> > > lxc-start      73733.655 DEBUG    lxc_conf - umounted<br>
> > > '/myvm1_putold/mnt/usb'<br>
> > > /mnt/usb is gone from the host also :(<br>
> > ><br>
> > ><br>
> > > The reason I want to make /mnt shared is that to share a mount point that<br>
> > > is mounted by one vm ( not just mounts done by host) be available on<br>
> > > another vm any suggestions towards this is fine too.<br>
> > ><br>
> > > Any tips and tricks ?<br>
> ><br>
> > You can't separate umounts from mounts.  However you can do a step<br>
> > better than what you have.  You want to have slave semantics from<br>
> > the host to another directory, then share from that to all<br>
> > containers.  That way, mounts on your host will be seen in the<br>
> > containers, but umounts in the containers won't be seen on the<br>
> > host.  Mounts done in one container will be seen in the others,<br>
> > however umounts will as well.<br>
> ><br>
> > -serge<br>
> > _______________________________________________<br>
> > lxc-users mailing list<br>
> > <a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
> > <a href="http://lists.linuxcontainers.org/listinfo/lxc-users" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br>
> ><br>
<br>
> _______________________________________________<br>
> lxc-users mailing list<br>
> <a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
> <a href="http://lists.linuxcontainers.org/listinfo/lxc-users" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br>
<br>
_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br>
</div></div></blockquote></div><br></div>