[lxc-users] Setting up containers with multiple logical volumes
Joshua Schaeffer
jschaeffer0922 at gmail.com
Tue Feb 11 15:11:09 UTC 2014
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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140211/547feb13/attachment.html>
More information about the lxc-users
mailing list