Tuesday, June 9, 2009

Converting Disks in Hyper-V

I recently have been running into space issues. I had a four hundred gigabyte hard drive that had almost not space remaining. It stored 8 running servers with dynamically expanding disks that had a maximum size of 40 gigabytes (on the host it was almost 42 gigabytes). I also had to store a backup server image (sysprepped) for copying to quickly create a new server if needed. Additionally, one of the hard drives was 70 gigabytes, not 40. All around, the total came to 459 gigabytes if each hard drive expanded to its largest.I suggested to my boss that we should convert each disk to fixed rather than dynamic disks to improve performance. He agreed and I began my search for how to convert disks. Much to my delight, converting a disk is a relatively painless (albeit slow) process.
Here's how:

For starters, open up the Hyper-V Manager. If you have been working with Hyper-V for any amount of time, you should know where this is. If you're totally new to this, Hyper-V Manager should be located in Administrative Tools. If you can't find it there, open a run window (Windows Key + R) and type mmc. From the window that comes up, Click File -> Add/Remove Snap-in... From the window that comes up, scroll down in the Available snap-ins list and double click Hyper-V Manager. Click OK.

*NOTE* A server must be either off or paused to convert the disk (I chose off for my conversions)

Alright, now that that's out of the way, right click the server you want to convert.

From there, click settings. In the window that comes up (Settings for ), click the hard drive you want to convert. In my case I only had one hard drive 'attached' to my servers.
From here, click Edit

The window that comes up (Edit Virtual Hard Disk Wizard) will start on the "Locate Disk" step but should continue to the next step automatically in a few seconds. On the "Choose Action" step, check the radio button next to the "Convert" option (second down from the top).

Click Next. This will take you to the "Convert Disk" step. Here you need to set the destination filename for the conversion. In my case, I just selected the old file from the browse window and added a "_fixed" at the end of the filename. Any naming scheme works though of course.

Click Next yet again. This will bring you to the summary window. Make sure everything you entered is correct and click Finish.

From here, just sit back and relax.

The conversion speed at the beginning can be a little deceiving. Mine got almost 25% done in the first five minutes. It actually took it about an hour to complete for forty gigabytes though. Reminds me of a cell phone. It reads full battery power until it has none left and then it says it has none five minutes before turning off.