Being consistent with my preferences in life, this is not a simple task. At least, figuring it out was not a plug-and-play activity we are all used to in the VMWare world of virtualization.
I want: A KVM Windows Server 2008 R2 guest installed on an LVM logical volume utilizing the VirtIO drivers for storage.
The LVM portion was pretty straight forward. Create an LVM out of the free space in my PV.
sudo lvcreate -n <lvname> -L 50G <vgname>
That was the simple part..
Lets start with the define statement.
sudo virt-install -v --connect qemu:///system --vnc --vnclisten <KVM Host IP> --noautoconsole --bridge=br0 -n <domainname> --hvm --arch=x86_64 --os-type=windows --os-variant=win2k8 --vcpus=2 -r 2048 -c /path/to/image/Win2K8R2-x64.iso --disk path=/dev/<vg_name>/<lv_name>,device=disk,bus=virtio
Open your VNC viewer to the location you configured. If you need help with that:
virsh vncdisplay <domainname>
It will output your connection info.
Once you start this VM, you will notice the installer doesn’t list any drives. This is expected.
You need to download the VirtIO drivers from Linux KVM. These are provided by RedHat.
Now, you have to shutdown the guest.
virsh destroy <domainname>
And then edit the domain. We have to make two changes.
virsh edit <domainname>
First, look for the following line.
Before it add the following. This allows your VM to boot from CDRom
Next, scroll down till you will see something like this:
<disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/primary/indium'/> <target dev='vda' bus='virtio'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/srv/images/Win2K8R2-x64.iso'/> <target dev='hdc' bus='ide'/> <readonly/> </disk>
Add the following after the cdrom entry. Of course, adjust the source file path. Note the target dev is set to hdd. This is the key to getting the second disk to work.
<disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/path/to/drivers/virtio-win-1.1.16.iso'/> <target dev='hdd' bus='ide'/> <readonly/> </disk>
Save and exit the editor.
Start the domain back up and connect to the VNC console.
virsh start <domainname>
Once you get to the drive selection screen again, you still won’t have a drive listed. Click the “load drivers” button and then click “Browse”.
From there select the folders
and click OK.
It will take a few minutes and it should then display a drive.
From there on it is a standard install.
You should do a little clean up and remove the boot and disk entry from the domain configuration we added earlier.