[CentOS-virt] Slightly OT: Centos KVM Host/Guest functions and LVM considerations

Eric Searcy emsearcy at gmail.com
Wed Sep 14 23:45:57 EDT 2011


On 9/14/11 1:41 PM, Chris Wik wrote:
> On 14.09.2011, at 18:51, Jeff Boyce wrote:
> 
[...]
>>  The more I 
>> read the more confused I get about understanding the hierarchy of the 
>> storage (disks.RAID.[PV,VG,LV].Partition.Image File) and how I should be 
>> looking at organizing and managing the file system for my functions.  With 
>> this I don't even understand it enough to ask a more specific question.
> 
> Some examples might help. This is what I do:
> 
> Disks -> RAID -> PV -> VG -> LV -> VM filesystem /
> Disks -> RAID -> PV -> VG -> LV -> VM filesystem /boot
> Disks -> RAID -> PV -> VG -> LV -> VM filesystem swap
> 
> I like this method because it makes it easy to take a snapshot of the VM filesystem and run a backup from dom0 (yields a consistent backup with no interruption to the running VM)
> 
> or
> 
> Disks -> RAID -> PV -> VG -> LV -> VM's partition map -> VM filesystems (/, /boot, swap, etc)
> 
> or
> 
> Disks -> RAID -> PV -> VG -> LV -> VM's partition map -> PV -> VG -> LV -> VM filesystems
> 
> Which setup you choose depends on how much flexibility you want, and whether you want to manage LVM inside the VM or not. LVM inside the guest allows more flexibility inside the VM...

I do host LVs as guest whole disk block devices (second alternative); in
my experience guest installs in anaconda+kickstart are easier on single
drive vs. multiple LVs passed (first alternative).  I don't think KVM
can direct LVs to partitions like Xen can, aka lv_root->xvda1,
lv_var->xvda2, so I think your filesystems would have their own vda,
vdb, vdc etc ... just a hunch though).  Also it's a lot of LVs to manage
in the host depending on how many partitions you do for systems (4 or 5
VMs with half dozen partitions each...)

Chris, do you fsync your guest before you snapshot the LV guest
partition to make sure your filesystem is clean?

First alternative provides *very* easy access to filesystems from the
host.  For second alternative, "kpartx" from the host lets you access
the partitions from the host if you need to.  Third alternative is very
confusing if you want to mount guest volumes from host for any sort of
emergency data needs, because the LVM vg names can conflict (vg_main in
guest can't coexist with vg_main in host).

Eric


More information about the CentOS-virt mailing list