[CentOS-virt] using an lvm for kvm vm

Mon Feb 14 01:14:02 UTC 2011
Nataraj <incoming-centos at rjl.com>

On 02/13/2011 02:30 PM, Nataraj wrote:
> On 02/13/2011 10:21 AM, Dennis Jacobfeuerborn wrote:
>>> 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.
>>
>> Regards,
>>    Dennis
> I've heard of somebody doing something to make this work. I think you
> could create another LV (from inside the VM - assuming a linux VM) on
> top of whatever raw partition was available to the VM.  Then you could
> take the snapshot within the VM (which I believe guarantees that the
> filesystem is sync'ed when the snapshot is taken.)  Then you use losetup
> and lvscan to make the lvm vg available on the host and I think you
> could access the snapshot without even pausing the vm.
>
>
> Nataraj
I guess this is not the case.  You can attach the VM virtual disk to the
loopback and see the VG and it's LV's, but they show up as unavailable. 
I guess changing the snapshot to be available would be writing to the LV
structure and could cause corruption while the vm is running, so better not.

Nataraj