In this article, we'll describe an method you can use to migrate VMware virtual machines to Virtual Server. Part one will discuss preparing the source VM for the migration, and part two will discuss how to prepare the FTP server, clone the source VM and prepare the target VM. Here's what you need: - Disk imaging software such as Symantec Ghost. For those who do not have Ghost, this article outlines the creation and deployment of an image using the open source Ghost for UNIX (G4U). I tested the procedures using both Symantec Ghost and G4U. With G4U, the image deployment to the new Virtual Server VM was twice as fast as with Symantec Ghost, which was very surprising.
- FTP Server for upload and storage of cloned image (if using G4U).
- Windows Setup CD or latest installed service pack files for VM OS to be migrated.
- The script prepvm.vbs, which is used to disable services and drivers that may prevent the migrated VM from booting successfully.
Imaging and redeploying a VMware VM as a Virtual Server VM can be relatively painless, as long as you remove the unnecessary drivers and services and replace the existing Hardware Abstraction Layer (HAL) driver with a generic HAL. Keeping the target hard disk configuration the same as the source VM disk configuration will ensure that the boot.ini file will not need to be modified prior to cloning the VM. Now let's look at the migration process. Preparing the source VMThe most important part of the imaging process is preparing the source VM. This should ensure that the new VM, when deployed to Virtual Server, will not blue screen or fail to start. As a safeguard, this procedure will use my prepvm.vbs script to disable any possible leftover VMware drivers that could cause Windows startup to hang on the new VM. Here is the script: 'prepvm.vbs
'Removes VMware-specific drivers from a system
On Error Resume Next
' Instantiate Shell Object
Set objShell = CreateObject("WScript.Shell")
' Disable VMware Tools Service
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\VMTools\\Start", _
4, "REG_DWORD"
' Disable VMware vmx_svga video driver
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Start", _
4, "REG_DWORD"
' Disable VMware vmmouse driver
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\vmmouse\\Start", _
4, "REG_DWORD"
' Disable VMware vmscsi driver
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\vmscsi\\Start", _
4, "REG_DWORD"
' Disable VMware PCnet driver
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\PCnet\\Start", _
4, "REG_DWORD"
' Disable VMware Buslogic driver
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\buslogic\\Start", _
4, "REG_DWORD"
' Disable SCSI Miniport drivers
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\symc810\\Start", _
4, "REG_DWORD"
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\symc8xx\\Start", _
4, "REG_DWORD"
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\cpqarray\\Start", _
4, "REG_DWORD"
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\pcntn4m\\Start", _
4, "REG_DWORD"
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\cpqnf3\\Start", _
4, "REG_DWORD"
objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\MRaidNT\\Start", _
4, "REG_DWORD"
' Restart Computer
strComputer = "."
'Prompt user of impending reboot
WScript.Echo("The system is prepared for imaging and will now shutdown.")
WScript.Sleep(3)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\\\" & _
strComputer & "\\root\\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Shutdown()
Next
To prepare the source VM, follow these steps: - Create a backup copy of the VM and work with the backup copy for the remainder of this process. Preparing the backup for cloning ensures that, if an error occurs during the cloning process, the source VM will still be available.
- Boot up the backup copy of the source VM and login. Copy the prepvm.vbs script to the VM, but do not run it at this point.
- Use Add/Remove Programs to uninstall the VMware Tools. When prompted, reboot the VM.
- Log back in to the VM. If the Found New Hardware Wizard opens after you login, cancel the wizard. If prompted to reboot, click No.
- Check the service pack level of the system. If no service pack is installed, you will need the OS Setup CD for this step. If a service pack is installed, then you will need access to the service pack setup files (extracted and on a CD, saved locally, or accessible via the network).
Note that it is extremely important that the files you copy match the OS/Service Pack version. Copying older file versions (such as from the Setup CD when the OS has already reached a specific service pack level) may render the system unable to boot. - Open the command prompt window.
- To refresh to the default HAL, run this command (assumes Service Pack or Setup CD-ROM has the drive letter D):
expand d:\\i386\\hal.dl_ %windir%\\system32\\hal.dll Note that if you are copying files from the %windir%\\system32\\servicepackfiles folder (assuming SP backup files were copied locally to the system's hard disk during the service pack installation), you will just copy the servicepackfiles\\i386\\hal.dll file to the %windir%\\system32 folder. - Replace the current ntoskrnl with the default by running this command:
expand d:\\i386\\ntoskrnl.ex_ %windir%\\system32\\ntoskrnl.exe Note that if you are copying files from the %windir%\\system32\\servicepackfiles folder (assuming SP backup files were copied locally to the system's hard disk during the service pack installation), you will just copy the servicepackfiles\\i386\\ntoskrnl.exe file to the %windir%\\system32 folder. - Now run the prepvm.vbs script. The VM will now shut down and is ready to be imaged.
With the source VM ready to go, you're just about ready to start the imaging process.
Preparing the FTP server If you plan to use G4U to image the virtual disk, you will need to have an FTP server available. You will also need to create an account on the FTP server named install that has permission to create and write files to the server. If you're looking for a quick and dirty FTP application, take a look at Cerberus FTP. While free for personal use, the commercial version of this software retails for $59.99. With the FTP server setup and an account named install, you're ready to image the source VM. Cloning the source Virtual Machine Follow these steps to prepare a cloned image of the source virtual machine's hard disk: - Download the G4U CD-ROM ISO image and save it on the source VM's host system.
- Configure the VM's virtual CD-ROM to use the downloaded g4u-2.2.iso file.
- Boot the VM and hit ESC as the VM begins to boot. This should allow you to see the VM's boot menu. When the boot menu appears, select the CD-ROM drive.
- By default, the VM will attempt to obtain an IP address via DHCP. If no DHCP server is available, you can set a static IP address for the VM by following these steps:
- Determine the name of the network interface by running the command ifconfig –a.
- Now set the IP address by running the command ifconfig <ip address> netmask <subnet mask>. For example, to set the IP address on interface pcn0, you would run ifconfig pcn0 192.168.0.10 netmask 255.255.255.0.
- You can now start creating the image. To do this, run the command uploaddisk <ftp server> <filename.gz> [disk]. For example, to create an image named w2ksrv.gz in the images folder on the server 192.168.0.5, you would run uploaddisk 192.168.0.5 images/w2ksrv.gz.
Note that if the virtual machine is using a virtual SCSI disk, you will need to specify which disk to clone in the command syntax. You can see all disks discovered by G4U by running the disks command. So if the last example used a virtual SCSI disk instead of an IDE disk, you would run this command: uploaddisk 192.168.0.5 images/w2ksrv.gz sd0. - When prompted, enter the password for the install account on the FTP server. In a moment, the image upload should begin.
- Wait for the upload to complete. Once finished, power off the source VM.
You're now ready to deploy the image to the target VM. Preparing and imaging the target VM To prepare and image the target VM, follow these steps: - On the Virtual Server (or Virtual PC) host, create a new virtual machine that includes the same hardware configuration as the source VM. Note that the virtual hard disks on the target system must be equal to or larger than the virtual hard disks on the source VM.
- Configure the VM's virtual CD-ROM to use the downloaded g4u-2.2.iso file.
- By default, the VM will attempt to obtain an IP address via DHCP. If no DHCP server is available, you can set a static IP address for the VM by following these steps:
- Determine the name of the network interface by running the command ifconfig –a.
- Now set the IP address by running the command ifconfig <interface name> <ip address> netmask <subnet mask>. For example, to set the IP address on interface tlp0, you would run ifconfig tlp0 192.168.0.10 netmask 255.255.255.0.
- To download the image to the VM, use the following command syntax: slurpdisk <FTP Server> <image path and file> [disk]. For example, to download an image named w2ksrv.gz in the images folder on the server 192.168.0.5, you would run slurpdisk 192.168.0.5 images/w2ksrv.gz.
- When prompted, enter the password for the install FTP account. Note that if an error occurs with the download, you may need to specify the target disk in the slurpdisk command syntax (example: slurpdisk 192.168.0.5 images/w2ksrv.gz wd0). To see a list of target disks for the command, run the disks command.
- Once the download completes, reboot the virtual machine.
- Once the system boots up, login to the VM. You should see that new hardware was detected and you are prompted to reboot. Click Yes to reboot.
- After the system reboots, log back in and then install the VM Additions. This will install the Virtual Server (or Virtual PC) compatible drivers on the new virtual machine.
I have used the process documented in this article to covert Windows 2000, Windows XP and Windows Server 2003 VMware virtual machines to Virtual Server 2005 R2 virtual machines. When the cloned system will not start on the virtual server, the usual causes of this problem are: - VMware-related drivers were not uninstalled prior to the source system being cloned. This can be corrected by logging into the Recovery Console and disabling the VMware-related drivers (listed in the prepvm.vbs script).
- Incorrect hal.dll and ntoskrnl.exe files copied to the %windir%\\system32 folder. This can be corrected by logging into the Recovery Console and copying the correct file versions to the %windir%\\system32 folder.
- Boot.ini file from original source points to wrong OS location on the new Virtual Server disks. This can be fixed by running bootcfg /rebuild from the Recovery Console.
As a last resort, many have resorted to re-running Windows setup on the cloned VM and selecting to repair the existing OS installation. Although this can return the cloned VM back to operation, it will take considerable time and likely will require you to reinstall any previously installed applications on the VM. For more information on troubleshooting Windows startup problems, take a look at Windows Server 2003 – Troubleshooting Startup. When I first started performing VMware to Virtual Server migrations, the process was often very time consuming. With this process, preparing the source VM for cloning can take less than 15 minutes with the remainder of the time in the migration process taking up by the cloning software itself. Any imaging method can be used to clone the virtual disk(s) from the source VM to the target VM, but the real key in the migration process is the preparation of the source VM. When prepared properly, as you have seen, virtual machine migration can be a relatively painless process.
|