Converting VHDs to VHDX and other questions…
Many of the articles I write for both The World According to Mitch and the Canadian IT Pro Connection come directly from people I meet through my travels. They send me questions about technology by e-mail and rather than simply replying to them, if I feel the questions are relevant, I write them up as articles. So if you meet me at one of my sessions and you ask me a question, do not be surprised if I ask you to e-mail it to me… oftentimes I will need to research the answer, but sometimes it is because I think that it would make for an interesting write-up.
I have known Betty for as long as I have been going to her home town, and while she loves to give me grief I know that she is always attentive and learns from my presentations. She recently sent me an e-mail with two very good questions on Hyper-V following my IT Camp on Windows Server 2012.
I have several virtual machines that were created on Server 2008R2, and I would like to convert them to VHDX to take advantage of all the new features on Windows 2012. Is this possible?
The process for exporting the virtual machine from Hyper-V on Windows Server 2008 R2 and then importing it as a virtual machine onto a host running Windows Server 2012 is fairly simple: Export, then Import. However as I am sure you realize this does not convert the disk file format… ViVo in this case stands for VHD in, VHD out. However the Edit Disk Wizard in the new Hyper-V is your friend here.
Ensure that your virtual machine is powered down (or better yet disconnected).
From the Actions Pane of the Hyper-V Manager click Edit Disk…
On the Before You Begin page click Next.
On the Locate Virtual Hard Disk page navigate to the location of our VHD file (use Browse if you like!). Click Next.
On the Choose Action page select the radio marked Convert and click Next.
On the Convert Virtual Hard Disk page select the radio marked VHDX and click Next.
On the second Convert Virtual Hard Disk page select the disk format you prefer (Fixed or Dynamically Expanding) and click Next.
On the third Convert Virtual Hard Disk page enter the name and location of your new VHDX file and click Finish.
Depending on the size of your source disk it may take a few minutes to create the new file; for larger disks you might want to run the Edit Disk Wizard to compact it before proceeding. However once you are done you will have both the Source and the Destination disks, and all you have to do is edit the settings of your VM and attach the new drive, and you are ready to rock!
Notice that your new file is about 145 MB larger than the original. That is perfectly normal and nothing to be concerned about.
PowerShell: I’ve Got The Power!!
Thanks to folks like Ed Wilson and our very own Sean Kearney it is once again cool to use the command line… or rather, the cmdlet. Nearly anything that you can do in the GUI can also be done in PowerShell, hence allowing us to create scripts to use at various clients or sites. If you want to convert your VHD to VHDX in PowerShell here’s how:
Convert-VHD -Path C:\ClusterStorage\Volume1\VHDsVM-1.vhd -DestinationPath C:\ClusterStorage\Volume1\VHDsVM-1.vhdx
Again, it is important to remember that a) Your hard drive be off-line (or disconnected), and b) that once you have created the new VHDX file you must attach it to the VM before spinning it back up. As well you will notice the difference in file size. Nothing to be concerned by.
(This cmdlet can also be used to convert VHDX files back to VHD files)
Do the virtual machines have to be Server 2012 for me to take advantage of the new features of Hyper-V in Windows Server 2012, and especially the new .VHDX file format?
Of course not. Remember that the host and the guest have no real conception that the other is there; as long as you can install it on x86 hardware, you can install it in a Hyper-V virtual machine. With that being said, there is a difference between can and is supported. Remember that your Windows NT, 2000, DOS 3.3 and OS/2 Warp VMs are not supported by Microsoft… even though they will work just fine
For Bonus Points:
What is possible technologically is not always allowed legally. It is important to make sure that all of the operating systems in your VMs are licensed on that host. I have seen too many companies perform P2V migrations of physical servers that had OEM licenses attached to them, only to discover during an audit that they were out of compliance. Make sure you have verified all of your licensing so that nobody will get their nose out of joint