Page 1 of 1

Possible to use LVM2 volume for guest OS

Posted: 31. Jul 2009, 00:58
by chronoboy
I will be doing a re-partitioning of my desktop Linux workstation, and am wondering if it is possible to point a VMDK to an LVM2 logical volume?

In the documentation, it does not state an example of using this type of set-up. I have found online blogs which show how to use a ZFS volume for a VMDK disk. I have done searches everywhere, even using this forums search feature, and there does not appear to be any information relating to using an LVM2. I would assume it would work, however there are no examples which show this, only the using of entire disks.

The problem is, I cannot use an entire disk for a VMDK, as my disc has no MBR/Standard partitioning scheme. The entire disk /dev/sda is used as a dm-crypt volume, and the system loads the kernel and initrd.img from PXE to de-crypt and mount the volume. Inside this encrypted volume, there lies an LVM2, currently my set-up has the root partition using the entire dm-crypt. I will be switching this to an LVM2 instead.

Windows guests will be unable to work with the dm-crypt/LVM2 parition layout, so I want to dedicate an entire logical volume within my LVM2 to a Windows guest. When you run the command to manually create the vmdk, does it check the MBR and partition layout and fail if nothing or invalid set-up exists? Is there a way to force it, and allow the Guest VM to create a disk layout inside the logical volume(MBR/NTFS Partition).

I do not need to load this guest OS natively on the host at all, I just want to limit the file system usage on my Linux box and use a block device directly for a guest.

Re: Possible to use LVM2 volume for guest OS

Posted: 31. Jul 2009, 20:41
by Sasquatch
Have you tried a few things yourself first? I know that the MBR isn't checked, because you have to supply one yourself for use in the VM (check the manual).

Re: Possible to use LVM2 volume for guest OS

Posted: 1. Aug 2009, 02:56
by chronoboy
Sasquatch wrote:Have you tried a few things yourself first? I know that the MBR isn't checked, because you have to supply one yourself for use in the VM (check the manual).
Thanks, that's what I needed to know, if the MBR is checked. I read the documentation and it didn't really explain the process the command takes, by reading it, I thought it did read the MBR to determine the disc layout. I am unable to try this myself until I re-do my workstation set-up, and needed to know before hand if I should include this in my LVM. The main reason to re-do everything is to use an LVM to host a few guest OSes. If it didn't work, then I would scrap the idea and wouldn't re-do the system.

Another question relating to raw disk access, but not LVM2. If for example, you let VirtualBox use an external HDD as a raw disc... Does VirtualBox store the MBR on the external HDD or in the VMDK? If there a way to force it to write the MBR to the external HDD for later booting from the host computer? I am actually in the middle of testing this out, and am hoping when I return to work on it later that it works as I would like it to.