<div dir="ltr"><div class="gmail_quote"><div dir="ltr">I managed to mount the partition! For that the procedure looks as follows:<br><br><ol><li>On the master:<div class="im"><br><br>mkdir /share/containerX<br>mkdir /var/lib/lxc/containerX/rootfs/share<br>

mount -t tmpfs share /share/containerX<br>
mount --make-rshared /share/containerX<br><br></div><div class="im">cat >> /var/lib/lxc/containerX/fstab << EOF<br>/share/containerX /var/lib/lxc/containerX/rootfs/share none bind 0 0<br>EOF<br><br></div></li>

<li>On the container: modify the /etc/rc.local to remount the /share directory with slave option enabled:<br>
mount --make-slave /zfs<br></li></ol>The only problem remains is that the partitions mounted under /share are unmounted the moment the container is shut down. Is there a "clean" way to avoid that?<br><font color="#888888"><br>

--<br>Arie</font><div><div></div><div class="h5"><br>
<br><br><br><br>On Thu, Sep 22, 2011 at 15:27, Arie Skliarouk <<a href="mailto:skliarie@gmail.com" target="_blank">skliarie@gmail.com</a>> wrote:<br>> Hi,<br>><br>> Thank you for the instructions, but looks I did something wrong.<br>


><br>> If I create files on the /shared/containerX, they appear properly in<br>> the container's /shared directory. If I create a directory in the<br>> /shared/containerX directory and mount some other partition onto that<br>


> /shared/containerX/an_partition directory, the partition's content<br>> appear empty inside of the container. It shows properly though on the<br>> host machine.<br>><br>> Aren't --make-rshared and --make-rslave counterexclusive?<br>


><br>> --<br>> Arie<br>><br>><br>> On Wed, Sep 21, 2011 at 20:26, Serge E. Hallyn<br>> <<a href="mailto:serge.hallyn@canonical.com" target="_blank">serge.hallyn@canonical.com</a>> wrote:<br>>> Quoting Arie Skliarouk (<a href="mailto:skliarie@gmail.com" target="_blank">skliarie@gmail.com</a>):<br>


>>> I want to bind-mount an directory inside of a running container.<br>>>> If I mount the directory using bind mount, the container does not see<br>>>> files in it.<br>>>><br>>>> It is important to me to be able to do the mounts and umounts from the<br>


>>> host machine, as we are dealing with LVM snapshots.<br>>><br>>> If it's ok to do it ahead of time, then you can use mount entries in<br>>> your config file.<br>>><br>>> If you want to be able to just manually run the mount command from<br>


>> the host at any time, then you'll need to create a directory for<br>>> the sharing and mount that into your container ahead of time.  For<br>>> instance,<br>>><br>>> mkdir /share/containerX<br>


>> mkdir /var/lib/lxc/containerX/rootfs/share<br>>> mount -t tmpfs share /share/containerX<br>>> mount --make-rshared /share/containerX<br>>> mount --make-rslave /share/containerX<br>>> cat >> /var/lib/lxc/containerX/fstab << EOF<br>


>> /share/containerX /var/lib/lxc/containerX/rootfs/share none bind 0 0<br>>> EOF<br>>><br>>> lxc-start -n containerX -d<br>>><br>>> Now when you mount something under /share/containerX, it will show<br>


>> up under /share in the container.  I.e.<br>>><br>>> -serge<br>>><br>><br><br></div></div></div>
</div><br></div>