I have been looking deeper into Hyper-V Disk performance after very noticeable performance degradation when some of our database servers were virtualised.
It turns out I had set up the virtual hard disks (VHDs) in possibly the worst combination of options! To create the Virtual Machines (VMs) I had installed Windows Server 2008 Enterprise onto 1 dynamic VHD. I then set this to read only and created differencing disks to have 4 different VMs all sharing the original VHD as the base. This worked great and was certainly quick to set up. However, for production machines the disks should really be set from Dynamic to Fixed. This is not an option with differencing disks. I had also taken some snapshots which additionally degrades VHD performance.
With the plan to start again from scratch I went to my test server. This has Windows Hyper-V Server 2008 on it (i.e. not the Full windows server 2008 just the free core version of Hyper-V). I read about using Pass-Through Disks (PTDs) for database servers as they offer the best performance. The is a great video on how to do this at http://blogs.technet.com/mattmcspirit/archive/2009/02/27/new-virtualboy-tv-video-hyper-v-and-pass-through-disks.aspx. In Hyper-V R2 the fixed disk VHD is meant to almost match PTDs but as I can’t get my hands on R2 that isn’t an option for me.
- 1 x Raid 1 50GB
- 3 x Raid 5 at 20GB
- 3 x Raid 5 60GB
I installed Hyper-V 2008 onto the Raid 1 drive and then connected to it via Hyper-V manager on my laptop (using Remote Server Administration Tools – RSAT)
Unfortunately, the logical drives did not show up in the “Add VHD” section. I had a feeling this is because they weren’t “initialized”. Normally I would do this through the Disk Management Console but this isn’t included in Hyper-V and cannot be done remotely either. It turns out I have to use DISKPART on the Hyper-V Server command line
- Log on to the Hyper-V desktop using “Remote Desktop”
- go to the Command prompt and type “DISKPART”
- Select the disk you want to initialize/set offline. These are numbered from 0 (the host drive). “SELECT DISK 1”
- Check there are no partitions on the disk by typing “DETAIL DISK”
- Set the disk offline by typing “OFFLINE DISK”
- Type “EXIT” to leave DISKPART and close the Remote Desktop Session
- Go to the VM settings in the Hyper-V manager and the disks now show up
I now need to install the OS to the VM and check the disk performance actually has improved!