[lxc-users] Setting up containers with multiple logical volumes

Joshua Schaeffer jschaeffer0922 at gmail.com
Mon Feb 17 16:20:27 UTC 2014


I still can't get this to work, I'm sure I'm missing something simple or 
obvious. To recap, I'm trying to use an LVM logical volume for my 
container's /var and /tmp partitions. Since I've been unable to get this 
to work, I've just beenfocusing on getting /tmp to work.  I changed my 
mount points and my container's config:

Here are my logical volume onthe host:

root at reaver:~# lvdisplay /dev/vg_lxc1/lv_ldap_tmp1
   --- Logical volume ---
   LV Path /dev/vg_lxc1/lv_ldap_tmp1
   LV Name                lv_ldap_tmp1
   VG Name                vg_lxc1
   LV UUID GDru3y-oLJB-Iv06-tjv3-wHuq-p8Fi-xBUscf
   LV Write Access        read/write
   LV Creation host, time reaver, 2013-11-30 13:46:16 -0700
   LV Status              available
   # open                 1
   LV Size                4.00 GiB
   Current LE             1024
   Segments               1
   Allocation             inherit
   Read ahead sectors     auto
   - currently set to     256
   Block device           254:4

I've mounted this LV to: /mnt/lxc/ldap/tmp on the host.  I then changed 
my container's config file:

root at reaver:~# cat /var/lib/lxc/ldap_baneling/config |grep lxc.mount.entry
lxc.mount.entry                = proc 
/var/lib/lxc/ldap_baneling/rootfs/proc     proc    nodev,noexec,nosuid 
0    0
lxc.mount.entry                = devpts 
/var/lib/lxc/ldap_baneling/rootfs/dev/pts devpts    defaults        0    0
lxc.mount.entry                = sysfs 
/var/lib/lxc/ldap_baneling/rootfs/sys     sysfs    defaults        0    0
#lxc.mount.entry            = /mnt/lxc/ldap/var 
/var/lib/lxc/ldap_baneling/rootfs/var     none    defaults        0    0
*lxc.mount.entry         = /mnt/lxc/ldap/tmp 
/var/lib/lxc/ldap_baneling/rootfs/tmp   none    defaults        0    0*

When I start my container I don't see the new mount:

root at baneling:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           3.1G     0  3.1G   0% /run/shm
rootfs           10G  537M  9.5G   6% /
tmpfs           801M   16K  801M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock

Do, I need to put something in the container's fstab?

Thanks,
Josh

On 02/12/2014 05:02 PM, Alvaro Miranda Aguilera wrote:
> sorry, i should have been more clear.
>
> seems you are trying to mount /a into /a that won't work.
>
> at those level, where are the logical volumes mounted?
>
> Say you want to share
>
> /media/lv1
>
> into container as /media/lv1
>
> then, the line should be:
>
> lxc.mount.entry    = /media/lv1 
> /var/lib/lxc/ldap_baneling/rootfs/media/lv1    none bind    0    0
>
> do you see the difference with your line?
>
> if you have already mounted your lv inside the container, unmount it, 
> mount it somewhere else, and try as I tell you, for me it works.
>
> if you have time, I wrote this:
>
> http://kikitux.net/lxc/lxc.html
>
>
>
>
>
> On Wed, Feb 12, 2014 at 9:34 AM, Joshua Schaeffer 
> <jschaeffer0922 at gmail.com <mailto:jschaeffer0922 at gmail.com>> wrote:
>
>     Based on the documentation I read, this can be the same, however
>     all I really care about is that the LV gets mounted to that
>     location on the host.
>
>
>     On Tue, Feb 11, 2014 at 1:13 PM, Alvaro Miranda Aguilera
>     <kikitux at gmail.com <mailto:kikitux at gmail.com>> wrote:
>
>
>         On Wed, Feb 12, 2014 at 4:11 AM, Joshua Schaeffer
>         <jschaeffer0922 at gmail.com <mailto:jschaeffer0922 at gmail.com>>
>         wrote:
>
>             lxc.mount.entry = /var/lib/lxc/ldap_baneling/rootfs/var
>             /var/lib/lxc/ldap_baneling/rootfs/var none    bind    0    0
>             lxc.mount.entry    = /var/lib/lxc/ldap_baneling/rootfs/tmp
>             /var/lib/lxc/ldap_baneling/rootfs/tmp none    bind    0    0
>
>
>
>         you are mounting the same path in the same path?
>
>
>
>         _______________________________________________
>         lxc-users mailing list
>         lxc-users at lists.linuxcontainers.org
>         <mailto:lxc-users at lists.linuxcontainers.org>
>         http://lists.linuxcontainers.org/listinfo/lxc-users
>
>
>
>     _______________________________________________
>     lxc-users mailing list
>     lxc-users at lists.linuxcontainers.org
>     <mailto: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/20140217/dcbdf74e/attachment.html>


More information about the lxc-users mailing list