If you feel this tip has saved you time or effort, please consider buying us a cuppa coffee to keep things going!
Prepare Virtual Machine for Migration
Usually, VMware virtual machine will use virtual SCSI disks and controllers for its hard drives, but Hyper-V uses virtual IDE drives. If you try to convert your VMware system to Hyper-V without changing controllers, you will probably get BSOD errors or unbootable drives.
These are the steps I followed to prepare the disk system for the migration:
Uninstall VMWare tools on your virtual machine.
Shutdown the Virtual Machine in VMware.
Once shutdown, go to the hardware settings of the VM and add a new disk (the size of the disk is not important, you will delete this virtual disk shortly). When adding the disk make sure to select and IDE disk, not SCSI.
Boot your virtual machine, and watch that it installs the IDE channels and that the disk able to be initialised/formatted from within the virutal machine.
Shutdown your virtual machine and remove the IDE disk from the virutal machine - you can delete the vitual disk image too if you like.
Convert VMDK to VHD
Once you have your VMWare virtual machine prepared for conversion, open the virutal machine's vmdk file with a conversion utility. I ended up using the trial version of WinImage.
Open WinImage and click Disk -> Convert Virtual Hard Disk Image.
Browse to your vmdk file and choose open.
Select either a fixed or dynamic size disk, click OK.
Choose the vhd file type and type a name for your converted disk, click save.
Open Hyper-V Manager and connect to your Hyper-V server.
Choose Action -> New -> Virtual Machine
Create a new virtual machine with the hardware preferences set the way you like, and choose your newly converted vhd as the virtual machines hard disk.
Boot the virtual machine. At this stage I ran into trouble with the boot sector of the vhd.
A disk read error occurred press ctrl + alt + delete to restart
I found that the convertor software can cause the boot sector to become invalid, preventing the vm from booting up with the error:
a disk read error occured
press crt + alt + delete to restart
This issue can be repaired - first you have to mount the vhd as a disk on a computer. Windows 7 and Windows Server 2008 R2 can mount vhd's as normal disks using the disk management snap-in.
Right-click Computer -> Manage.
Right-click on Disk Management and choose Attach VHD.
Open testdisk_win.exe - availiable here: http://www.xtralogic.com/testdisk_rebuild_bootsector.shtml
The notes on http://www.xtralogic.com/testdisk_rebuild_bootsector.shtml are quite good, but for completness I'll repeat them here.
Select Create to create a new log file
On the selecte media menu, choose your newly mounted VHD disk and choose Proceed.
Select Intel
Select Advanced
Select Boot partiton
Once the system check the disks, choose Rebuild BS - this will repair the fail with the boot sector
Choose Write
Type Y to confirm
Quit the repair tool, and unmount the VHD using the disk management snap-in.
Hopefully, you should now be able to use this VHD as your boot drive in your virtual machine.
References:
Repair vhd boot sector - http://www.xtralogic.com/testdisk_rebuild_bootsector.shtml
WinImage Usage notes - http://www.sertec.ca/howtos/Howto-Convert-VMDK-to-VHD-Partition-types.html
WinImage - http://www.winimage.com/winimage.htm
Disk2vhd - http://technet.microsoft.com/en-us/sysinternals/ee656415
|