KVM: Optimizing performance on virtual machines (VM`s)

After having set up quite a few VM`s in my career, i have picked up a couple of tips on how to get the most power out of your VM`s:

Get new/correct drivers for your VM`s
Remember to make sure that you have all the correct drivers, this is at least important for IO(Disk) and Network devices. Windows has many devices that will work with basic Microsoft drivers, but that does not mean that the performance magically gets awesome. After making sure that the correct drivers were in place, i managed to go from ~900Mbit to 9.9Gbit on a 10gbit-network between a Linux (Red Hat) and Windows 2k8 server. (tested with iperf which exists for both Windows and Linux)

Turn off Power saving options in BIOS / Hardware
More or less all servers, either they being brick servers, home servers or blade servers, have BIOS settings that enables or disables power saving mode. I know from experience that at least all HP blades comes with power saving enabled per default. Turn off this to make sure that your VM`s gets the performance they expect to get. (I have had VM`s simply be sluggish with this feature turned on, turning it off made CPU-performance get normal)

Turn off CPU throttling on the VM host machine
I have also had issues with slow VM`s even when the power options was fixed in BIOS. I then realized that some Linux distributions (Ubuntu) have a default CPU scheduler that throttles down the CPU when it is not needed. After making sure that the host did NOT do this, the VM`s finally started acting as they should. Check out your Linux distributions guides on how to change this.


Any other tips i should add to the list? Feel free to add a comment below! 🙂

Windows is unable to install to the selected location. Error 0x80300001

After installing drivers during a Windows-installation you might get this error message when you select a drive to install it on “windows is unable to install to the selected location. Error 0x80300001”

This is another (strange) way for Windows to say that you have not inserted the Windows CD/DVD again. Put it back in again, wait a second and then the error message should disappear. (If it does not, try to hit refresh after putting the CD in)

Expanding a kVM disk image

Had to expand a KVM virtual machine today. Luckily, that`s pretty straight forward. You simply create a new disk image with the extra size needed, merge it into the original disk and voila. Then you just need to partition in the extra space and you are good to go.


1: Halt your virtual machine.

You need to stop your virtual machine before going wild with the drive. Virsh stop <vm name>, or virsh destroy <vm name> if it somehow wont stop.

2: Create a disk with the extra space needed:

qemu-img create -f raw 5gig.img 5G

3: Merge it into the disk you are working with

cat 5gig.img >> yourdisk.img

4: Boot up and and partition your drive.

Then start up your virtual machine again with virsh start <vm name>. If you use Windows server, all you need to do is to visit disk managent, right click your drive with little free space and choose “extend partition”. The job takes seconds and does not require any reboot.

Two Crucial C300 in RAID0 on a M4A87TD motherboard causes BSOD`s, hangs in Win7

So i have tried to use Two Crucial C300 in RAID0 on a M4A87TD motherboard for a while now. After a while i started experiencing BSOD`s, hangs, crashes, freezes etc. I tried to debug -everything- until i came over multiple complaints about the same on the Crucial forums. (Not exactly the same, but enough to check it out)

I decided to simply remove the RAID and only use one drive for Windows 7. So far it appears to be very stable again, so hopefully the issues was related to the combination of two SSD`s in RAID0 on a AMD-RAID controller.

Time will tell.

Shutting down Windows 2003 / 2008 server with virsh shutdown

virsh shutdown can be compared to pushing the power button on a server, that will normally tell the OS to shut down gracefully. Microsoft on the other hand looks on that as a security issue and have per default disabled the ability to shut down the server if no admin is logged in on the server. (Aparantly you cant do anything naughty if you have access to the server..)

This causes virsh shutdown to not function as intended for Windows servers.

Luckily, You can fix this by setting the following registry key to 1:


PS: If that does not help, check out the power settings i gpedit.msc, some information about that can be found @