[CentOS-virt] using an lvm for kvm vm

Sun Feb 13 18:21:06 UTC 2011
Dennis Jacobfeuerborn <dennisml at conversis.de>

On 02/13/2011 09:27 AM, Nataraj wrote:
> Is there a simple way to directly install a vm on an lvm (or proably
> seperate LVM's for root and swap)?   For example something like:
> lvcreate -L 10G -n testvm_root vg_myvg
> lvcreate -L 1G -n testvm_swap
> Then somehow setup the VM to be able to directly install and boot the vm
> from these LV's.  How do I do this?

You can do this with virt-manager. Just specify the logical volume as 
storage instead of a file. You'd have to add the swap space after the 
installation though.

The way I do this is to create just one logical volume for the VM with 11G
and the in the guest specify one 10G volume for root and 1G for swap. That 
way you only have one logical volume per VM on the host.

> Could you then pause the virtual machine and safely take an LVM
> snapshot, continue the VM and then mount the snapshot on the host and do
> a backup?

Probably not. If you pause the guest then the filesystem on it might be in 
an inconsistent state. You will be able to make a snapshot since that 
happens on the block level but you might have problems mounting it.