I'm trying to figure out how to create an LXC using multiple LVM logical volumes. I'd like to dohave the root filesystem of the LXC on its own LV, the /var directory of the LXC on its own LV, and the /tmp directory of the LXC on its own LV. Here is what I've done sofaron the host:

=====================================
root@reaver:~# vgdisplay vg_lxc1
  --- Volume group ---
  VG Name               vg_lxc1
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  21
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               261.70 GiB
  PE Size               4.00 MiB
  Total PE              66994
  Alloc PE / Size       11264 / 44.00 GiB
  Free  PE / Size       55730 / 217.70 GiB
  VG UUID Zb2ume-1Ty9-s8Ze-NEZc-7Vee-A3h7-A2IvGd
=====================================

=====================================
root@reaver:~# lvdisplay vg_lxc1
  --- Logical volume ---
  LV Path /dev/vg_lxc1/lv_ldap_var1
  LV Name                lv_ldap_var1
  VG Name                vg_lxc1
  LV UUID VfCZgf-ZOGA-lJgn-GFO8-fOAd-IMzl-QF32aY
  LV Write Access        read/write
  LV Creation host, time reaver, 2013-11-30 13:46:11 -0700
  LV Status              available
  # open                 1
  LV Size                10.00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:3

  --- 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

  --- Logical volume ---
  LV Path /dev/vg_lxc1/lv_ldap_root1
  LV Name                lv_ldap_root1
  VG Name                vg_lxc1
  LV UUID u1tAUH-t7CB-tEdp-M84c-H93p-9CEn-7xXzAM
  LV Write Access        read/write
  LV Creation host, time reaver, 2014-02-10 20:19:30 -0700
  LV Status              available
  # open                 1
  LV Size                10.00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2
=====================================

I manually created the LV's that I would use for /tmp (lv_ldap_tmp1) and /var (lv_ldap_var1), but the LV for the rootfs (lv_ldap_root1) I created using the lxc-create command:

=====================================
lxc-create -n ldap_baneling -t debian -B lvm --vgname vg_lxc1 --lvname lv_ldap_root1 --fstype xfs --fssize 10G
=====================================

This seems to work correctly for the rootfs, but I can't seem to get the container to use the /var and /tmp LV's. This is what I've changed in my container's config file:

=====================================
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
=====================================

I've mounted the LV's under their respective directories. However, when I run df /var or df /tmp under the container it appears that that those directories are still mounted under the rootfs. Am I just going about this incorrectly? Any direction would be appreciated.

Thanks,
Josh
_______________________________________________
lxc-users mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-users

Reply via email to