Thursday, August 9, 2007

VMDK to VHD Conversion with Virtual Machine Manager Beta 2

I have been working with the conversion of VMware virtual machines to Microsoft Virtual Server machines. Microsoft has a public beta of System Center Virtual Machine Manager (SCVMM) (Beta 2) that includes Physical-to-Virtual (P2V) and Virtual-to-Virtual (V2V) capabilities. The conversion of physical machines is done through the GUI in SCVMM. Conversion of VMware's VMDK files is done through PowerShell commands.

I was most interested in playing with the V2V functionality of the tool to see how well it worked. I have several VMs in test and production running on various flavors of VMware's products. For my first attempt I worked with one of my smaller Windows 2000 Server with Service Pack 4 VMs.

I stopped the source virtual machine and copied its working directory to one of my Microsoft Virtual Server hosts. I am running SCVMM in a Virtual Server VM. The first step I did was to run the New-V2V command which has this description:

"Converts a virtual machine created in VMware(R) to a Virtual Server-based virtual machine managed by Virtual Machine Manager."

Working with a copy of the original VMware VM I followed the example from Get-Help New-V2V -detailed.

First I ran:

Get-VMMServer -Computername vmm-beta2.matrix.com

Per the notes in the example this retrieves the server object from the VMM database.

Then:

$VMHost = Get-VMHost -ComputerName "ghost.matrix.com"

This retrieves an object that represents the virtual machine host and allows me to reference that object as $VMHost.

and Finally:

New-V2V -VMXPath "\\ghost\c$\tmp\W2KServer_w-SP4_SPARKS\win2000serv.vmx" -VMHost $VMHost -Name "SPARKS01" -Path "e:\virt-servers\dump" -MemoryMB 256 -RunAsynchronously

This command points New-V2V to the vmx file for the VMware virtual machine and creates a VM on the Virtual Server VM Host in the Path listed. It also sets the amount of memory to 256MB. RunAsynchronously returns the shell prompt immediately while the job runs. You can watch the job in the admin console of SCVMM. There are also several other options detailed in the help file for New-V2V that you can pass regarding properties of the new Virtual Server VM.

This was a smaller VM that I was working with, only a 2.8GB VMDK file. The conversion went pretty quickly, but I was met with errors before completion.

"Error (3217)
Required files for the P2V conversion of \\ghost\c$\tmp\W2KServer_w-SP4_SPARKS\win2000Serv.vmx are missing from the P2V patch cache. The files are archived in DRIVER.CAB, which is located at %WINDIR%\Driver Cache\i386 on \\ghost\c$\tmp\W2KServer_w-SP4_SPARKS\win2000Serv.vmx or on the Microsoft Windows 2000 installation media.

Recommended Action
Copy DRIVER.CAB for the source operating system and paste the file to "C:\Program Files\Microsoft System Center Virtual Machine Manager 2007\P2V Patch Import" and then run Convert Physical Server wizard again."

This error also occurred for SP4.cab, the UPDATE ROLLUP 1 for SP4 and another update or two.

To resolve I copied the driver.cab and SP4.cab from other Windows 2000 Server SP4 machine to "C:\Program Files\Microsoft System Center Virtual Machine Manager 2007\P2V Patch Import" on the SCVMM host. I also downloaded the updates needed individually from the Microsoft site and copied them to the same location. Once those files are copied I ran the following command in the SCVMM PowerShell prompt to add them to the Patch Cache

PS C:\> $vmmserver = get-vmmserver -computername VM-BETA2
PS C:\> add-P2VPatch -vmmserver $vmmserver

Then, through the GUI I could click retry job to let the conversion process continue.

This portion of the conversion finished and I was able to start the new Virtual Server VM through the admin console for the SCVMM. The VM booted Windows 2000 with no issues. Upon logging in new hardware was detected and I was asked to reboot.

After the reboot I did lose my mouse and keyboard control for the VM. I could no longer enter CTRL-ALT-DEL to login. The keyboard did work to hit F8 to get to Safe Mode, but once in Safe Mode the keyboard and mouse did not work either.

At this point I decided to boot to the recovery console to see if I could find out what the issue was. First I noticed that VMware Tools was still trying to start. I disabled it from the Recovery Console by typing:

DISABLE vmwaretools

I rebooted after this and still had the issue. So back to the recover console I went. I noticed the i8042prt service was set to disabled. So I ran the following command to enable it:

ENABLE i8042prt SERVICE_BOOT_START

After a reboot the mouse and keyboard worked in the VM. I installed the Virtual Additions into the guest OS and all appears well with the newly converted VM.

2 comments:

Phonopsia said...

When you say you downloaded the updates invidually from the Microsoft site, do you mean that you placed all the post-SP4 patches installed on the original guest OS in the P2V Patch Import directory and then added them?

Elfshadow said...

I was using the V2V PowerShell tools for my early conversions of a VMDK file. During the conversion the job would fail and the message would indicate I needed a missing update. It was after I added the drivers.cab, SP4.cab and the UPDATE ROLLUP I was prompted for certain patches. I would add one and then Restart the job through the SCVMM admin console.

For example, I received an error that I was missing KB900725. I searched for that on Microsoft's site and then downloaded the patch and put it in the P2V Patch Import directory and ran the add-P2VPatch command. Then I would click Restart Job in the SCVMM. Then it would prompt me for another missing patch, which I would repeat the process.

In my case my first test conversion was of an older Windows 2000 Server VM that had been powered off for quite some time. I only had to add four patches from specific KB articles and I was prompted for each missing one. A machine patched better than my test one was, might be prompted for even more updates.

Does that help?