Sunday, November 24, 2013

How to migrate a VHD to VMware Workstation

Introduction

This posting walks you through the process of migrating a pre-configured Microsoft Virtual Hard Disk (VHD) system to VMware, using nothing more complex than a text editor.  This posting integrates relevant postings on this topic from other authors.  Links to all references uses in researching and developing this posting are provided in the References section, below.  This posting was developed on VMware Workstation 7.1.3 build-324285, but applies to other VMware products, including ESX and Player.

In this posting, you will migrate the Microsoft Windows Server 2003 R2 Enterprise Edition VHD to VMware Workstation 7.1.3.

Step 1: Prepare VHD
  1. Download or locate the Source VHD. For this posting, the source VHD filename is Win2k3R2EE.vhd.
  2. Create a new folder in your VMware VM directory.  For this posting, a new folder win2k301 was created.
  3. Copy the source VHD to your VMware directory
    While not absolutely necessary, it facilitates file management to keep the VHD source file co-located in the same folder as the target VMware VM folder.
Step 2: Create New VM
  1. Launch VMware Workstation.
  2. From the File menu, point to New and then point to Virtual Machine..
  3. Click Virtual Machine.  The first page of the New Virtual Machine Wizard appears.
  4. Select the Custom (advanced) option
  5. Click Next.
  6. On the Choose the Virtual machine Hardware Compatibility page, select the appropriate virtual machine hardware compatibility from the Hardware dropdown, and then click Next.
  7. On the Guest Operating System Installation page, select the I will install the operating system later option, and then click Next.
  8. On the Select a Guest Operating System page, from the Guest operating system group, select Microsoft Windows, and then click Next.
  9. On the Processor Configuration page, leave all settings default, and then click Next.
  10. On the memory for the Virtual Machine page, change the memory to 1 GB (1024 MD), and then click Next.
  11. On the Network Type page, choose the network configuration desired.  For this posting, the Use bridged networking option was selected
  12. Click Next.
  13. On the Select I/O Controller Types page, leave the default (LSI Logic), and then click Next.  The next page is the most important in the VM creation process.
  14. On the Select a Disk page, select Use an existing virtual disk.
  15. Click Next.  The Select an Existing Disk page appears
  16. On the Select an Existing Disk page, click Browse, and then navigate to the location of the VHD
  17. Select the VHD file, and then click Open.  The navigation dialog closes, and you are returned to the Select an Existing Disk page
  18. Back on the Select an Existing Disk page, verify that the path and file name are correct, and then click Next.
  19. On the Ready to Create Virtual Machine page, click Finish.  The VM is created and a new tab appears in VMware
  20. Verify that the VM folder now has VMSD, VMX and VMXF files
Step 3: Edit VMX File
  1. Exit VMware Workstation.  If you are using ESX, remove the new VM (but don't delete the files).
  2. Navigate to the VM folder created in Step 1.  This folder should contain the VHD file along with a VMSD, VMX and VMXF files
  3. Right-click the VMX file, in this posting named win2k301.vmx, point to Open With, and then choose Notepad.  The VMware VM settings file opens in NotePad.
  4. Edit the scsi0.present setting from TRUE to FALSE.
  5. Edit the scsi0:0.present setting from TRUE to FALSE.
  6. Add the following settings:
    ide1:1.present = "TRUE" ide1:1.deviceType = "disk" ide1:1.fileName = "Win2k3R2EE.vhd"
  7. Save and close the VMX file.
Step 4: Launch the VM
  1. Launch VMware Workstation.  If you are using ESX, add the VM back.
  2. Start the VM.
  3. If you repeatedly experience this blue screen,
    you may not have correctly edited the VMX settings file.  Review this file and try again.
  4. You'll see the usual Windows settings screen appear
    and then various Windows Setup dialogs will also appear; and the rest is normal Windows startup
  5. If, after logging into the Windows VM, you find the cursor missing or stuck in the bottom right corner, see Troubleshooting I below.
  6. If after trying to shutdown Windows VM, you find that it appears to hang, see Troubleshooting II below.
Summary

This posting has presented one method for migrating Microsoft VHD systems to VMware Workstation without the need for third party conversion tools.  The process merely involves minor changes to the VMware settings file for the VM.

Troubleshooting I: Mouse cursor does not appear within the virtual machine window
This can occur if the original VHD system had Microsoft Virtual Machine Additions installed.  To verify this, perform the following tests:
  1. Right-click anywhere in the virtual machine window: does a pop-up appear repeatedly in the bottom right corner no matter where you right-click?
  2. Using your keyboard navigation skills, check the installed software: is Virtual Machine Additions listed?
If either is the case, try the following:
  1. Re-open the VHD in Virtual PC or Hyper-V, remove the Virtual Machine Additions, and then repeat steps 1-4 above.
  2. Re-install or update the VMware tools, but leave out the mouse driver, and then reboot.
  3. Launch Regedit, navigate to
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\... ...Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}
    look for the UpperFilters setting, and remove msvmmouf and any spaces from its value, leaving the mouclass value still there
Troubleshooting II: Shutdown Locks
This occurs after attempting a normal shutdown of the server.  The screen changes, the message appears indicating that server is shutting down, the message disappears, and then only a normal desktop is displayed that is unresponsive to keyboard and mouse input.  The only way to force the server to shutdown us using VMware shutdown option.  There is significant discussion and troubleshooting steps on this issue to be found in the VMware knowledgebase.  However, the workaround is simple:
  1. On the VM server (guest OS), from the Start menu, point to Control Panel, and then point to VMware Tools.
  2. Click this item.  The VMware Tools dialog appears
  3. Select the Scripts tab:
    1. On the Scripts tab, from the Script Event dropdown, select Shut Down Guest Operating System.
    2. Enable Use Script.
    3. Select Custom script
    4. Click the Edit button.
    5. In that file, add the following:  shutdown /s /t 10 /d P:0:0 /c "VM guest shutdown".
  4. Save and close the file
  5. Click OK.
  6. Test by performing a normal shutdown of the server.
References
Notes

10 comments:

Clemn Sp said...

Really nice! It helps me out! It works, and very well. I was looking for the solution and i cannot believe it was too easy.

Muchas gracias!

Anonymous said...

Thanks, this was very helpful and surprisingly simple. I did run into one minor issue with this technique where VMware Workstation complained that the CD-ROM IDE device was configured as a slave with no master. I changed the IDE positions from 1 to 0, and the system booted up just fine. Thanks again for the great tip!

Anonymous said...

So easy! It worked with my Microsoft VHD files. Good stuff!

judy boy said...

Thanks, this was very helpful and surprisingly simple. I did run into one minor issue with this technique where VMware Workstation complained that the CD-ROM IDE device was configured as a slave with no master. I changed the IDE positions from 1 to 0, and the system booted up just fine. Thanks again for the great tip!

Anonymous said...

I don't have those options when I do those steps. I don't have steps 3 and 4 available and I never got a select I/O Controller type dialogue it just went to "finish"

I am using Workstation 12 free so could that have anything to do with it?

Al said...

Not sure without viewing a screenshot of what you are seeing, but these options are basic and I would suppose they would be available for all versions. I don't have V12 so I can't be sure. I would suggest that you post your question to the VMWare forums.

Jared Romano said...

I am using VM Workstation V12 and this trick does not work for this version. It just says that the .vhd File is incompatible with Workstation Version xx.x. It does this no matter what hardware version you select on screen 2 of the wizard. I can say however, that it worked when I was using Version 9. I am currently trying StarWind V2V image converter and will report my results.

Anonymous said...

I have followed all the steps and powered on the virtual machine but it shows that windows is loading file. Does it suppose to be like that?

Al said...

I'm not sure what the issue may be when Windows appears stuck on "Loading files..." Did you try hitting F8 before this and try booting in safe mode?

Anonymous said...

Steps are perfect, worked fine in VMware Player 7.1.4. Thank you.