Moving back to Hyper-V

I recently lost 12lbs. thanks to SharePoint 2013. Due to the huge memory requirements I upgraded to a Lenovo W530 with dual 512GB SSDs and 32GB RAM. The new kit, laptop, power supply and bag are 12lbs lighter than than my old Dell M6500 kit! Anyway, in the process I also changed the way I run my laptop. I followed Andrew Connell’s approach of running boot-to-vhd for Windows 8. I was interested in Windows 8 for a few reasons, primarily because Windows 8 offers Hyper-V. This means I have to convert my VMware demo servers to Hyper-V compatible VHD files.

Preserve the Investment

I have a huge investment in my demo environment. Not so much the servers, but the data, accounts and sweat equity (much of it through the graces of friends who have helped me along the way). I originally created the demo in Hyper-V and converted them to VMware when I had a huge public demo failure because of networking issues I could not resolve on Hyper-V and Windows Server 2008R2. If you have seen my demos you know that Dog House Toys is a fully fleshed out company. The thought of rebuilding the servers and then all the demo scenarios they represent was too horrible to consider, so I decided to try a new tool from Microsoft to do the job. The Microsoft Virtual Machine Converter http://technet.microsoft.com/en-us/library/hh967435.aspx is a free tool that will convert virtual machines to the Hyper-V format. The GUI is designed to connect to a host server and perform the conversion. Since I am running VMware Workstation, I used the command line utility that is included to perform the task.

The Process

The process is actually very simple, the only major issue is you need to find disk space for the ENTIRE drive (not just the part reported on your host). For example, all of my guest drives are based on 120GB maximum size. So, event though my smallest drive is 11GB physically, when converted it will become 120GB on disk. Then you can use DiskPart to compact the drive back to it’s original size. To do this for a VMware *.vmdk file to create a dynamicly expanding drive (if you want to compact it later) use the following command:

mvdc c:\vmware\SHELTIE\SHELTIE.vmdk e:\HyperV8\SHELTIE\SHELTIE.vhd /Dyn

If everything works correctly after the process runs you will have a new VHD file ready to be mounted, defragged and compacted. CAUTION: DiskPart is a powerful tool, pay attention or you will do harm to your computer! I do this with DiskPart:

Diskpart
Select vdisk file=e:\HyperV8\SHELTIE\SHELTIE.vhd
Attach vdisk

Notice that this mounts your disk with a drive letter. Now you can defrag and consolidate free space from the command line (NOT in the DiskPart window) with:

defrag <drive letter>: /X

When that is done return to the DiskPart windows and do the following:

Detach vdisk
Attach vdisk readonly
Compact vdisk

When that is done, detach the vdisk and exit DiskPart.

Detach vdisk
Exit

You should now have a VHD file that is similar in size to the VMDK you started with. Now just create a New Virtual Machine in Hyper-V manager and associate the VHD with the new machine. When you first run the machine you will have to reboot it a few times as it figures out the new host. I also uninstalled the VMware Tools and reinstalled the Hyper-V Integration Services tools.

Problems

Of course I wouldn’t be posting all this if the process was trouble-free. I ran the tool on my first VMDK file and it worked flawlessly. This disk had been created recently in VMware and was fairly small. I attempted to convert another, much older, disk and received the following error:

Step 1 of 3: Loading Source Disk

The number of sectors per track cannot exceed 63 for this disk.
Parameter name: sectors
Actual value was 255.

Bing-ing around I knew I was in trouble, most of the posts were from years ago and were about the inner workings of virtualization. Nothing about conversion. I realized that the disks that were having issues were originally created in Hyper-V and I converted them to VMware using the VMware converter utility. Now I am trying to convert them back. One post discussed the “sectors per track” issue and indicated that VMware did not care what the value was, and showed how to edit the VMDK file to change the value. The problem was my disks were single disks, not spanned across multiple 2GB files like the sample. So I decided to test a theory. I converted my disks to 2GB files with the vmware-vdiskmanager that comes with workstation:

vmware-vdiskmanager.exe -r c:\vmware\SHELTIE\SHELTIE.vmdk -t 1 e:\HyperV8\SHELTIE\SHELTIE.vmdk

Creating disk 'e:\HyperV8\SHELTIE\SHELTIE.vmdk'
Convert: 100% done.

Virtual disk conversion successful.

Then I opened the first VMDK file in the series with Notepad++ and found the offending line:

ddb.geometry.sectors = "255"

and changed it to:

ddb.geometry.sectors = "63"

Save and close the file and retry the conversion.

mvdc e:\HyperV8\SHELTIE\SHELTIE.vmdk f:\HyperV8\SHELTIE\SHELTIE.vhd /Dyn

Step 1 of 3: Loading Source Disk...
Step 1 of 3: Loading Source Disk Completed.

Source file found of size 127.0 GB. 

DiskGeometry:

 Cylinders: 65278
 Tracks/Cylinder: 16
 Sectors/Track: 63
 Bytes/Sector: 512
 MediaType: FixedMedia

Step 2 of 3: Creating Destination Disk

Step 2 of 3: Creating Destination Disk Completed.

 Destination file created of size 127.0 GB.
 
DiskGeometry:

 Cylinders: 65278
 Tracks/Cylinder: 16
 Sectors/Track: 63
 Bytes/Sector: 512
 MediaType: FixedMedia
 
Step 3 of 3: Copying raw data

Step 3 of 3: Copying raw data completed.

Conversion Complete!
The converted file is located at: f:\HyperV8\SHELTIE\SHELTIE.vhd

Conclusion

I have to hand it to the folks that created the conversion tool. When I hit the issue I emailed the contact address and they responded in an hour! This is a great tool for getting yourself back to Hyper-V. I have been running the converted machines for about 3 weeks now without a glitch.

|| Hyper-V || VMware || Windows 8

comments powered by Disqus

Let's Get In Touch!


Ready to start your next project with us? That’s great! Give us a call or send us an email and we will get back to you as soon as possible!

+1.512.539.0322