« Mozilla Firefox Preview Release 1 Out | Main | Manolas Handmade Soaps »

September 14, 2004

Migrating VMware GSX VMs Running W2K/W2K3 To VMware ESX Server

Contrary to what may be popular belief, I do work for a living. I haven't blogged much about work in the past, but when I have to really dig to find some nugget of info or experiment to find something out, I figure publishing the info might be useful in the future. (At least, to me. ;) ) That's why I'm posting this.

We've been using VMware GSX Server on two relatively large development/test systems for almost two years. We just bought an HP Proliant DL585 (the demo Opteron server I blogged about previously) to run VMware's ESX Server product. While I'm waiting for the additional hardware I need to productionize the server for ESX, I've installed the software to play with it. One of the things we're going to want to do with it is move some of our existing virutal machines (VMs) from our GSX servers to our ESX server. However, after I looked at the fine print, I found it wasn't going to be so easy.

Update (28-Jun-2006): In preparing for our implementation of ESX Server 3, I've been in the VMware Knowledge Base quite a bit. It looks like they've documented an IDE->SCSI virtual disk conversion process that obviates the need for these procedures.

Most of our VMs run W2K Server and W2K3 Server. By default, when you create a VM in GSX Server 2.5.1 and specify one of these OS's, the default virtual hard disk type that's offered is IDE. Near the end of the virtual disk creation wizard, you can select and "Advanced" menu and select SCSI or IDE, but we've never needed to do that, so we hadn't. Reading the manual page that describes how to migrate the VM, it states that:

The virtual machine you want to migrate must have been configured with a virtual SCSI disk and have a supported guest operating system installed.

How convenient. So now I had to find a way to migrate my OS install on a W2K/W2K3 VM from the IDE drive to a SCSI drive. Here's the method I used (on a W2K3-based VM):

  1. Create a new virtual hard disk that is large enough to hold all the files on the VM server's C: drive. I chose to make the new hard drive the same size as the old one. For the .vmdk file name, I suggest using a descriptive one, that includes the server's name. It will help later. Use the Advanced menu near the end of the wizard to specify that it should be a SCSI drive.
  2. Partition and format the SCSI drive under W2K3 (which should automatically load a driver for the virtual SCSI adapter). Assign it a drive letter (I used E:).
  3. Perform a backup that includes the System State. This will put current copies of the registry files in C:\Windows\Repair\. (Reference)
  4. Use ROBOCOPY from the Resource Kit to copy the file structure from C: to E: as follows:

    ROBOCOPY C:\ E:\ /SEC /MIR /R:0 /W:0

    (That copies over everything that isn't currently locked for reading, so it's best to shut down as many services as possible before attempting this.)
  5. Mark the E: partition as active in Disk Management.
  6. Shut down the VM and remove the virtual disk that is the IDE C: drive from the VM's configuration.
  7. Obtain VMware's SCSI driver floppy image and put it on your GSX server. (Reference)
  8. Boot the VM to the W2K3 installation CD and hit F6 to specify that you're going to load a manufacturer-supplied SCSI driver. (W2K3 doesn't ship with support for the virtual SCSI adapter. This reference says that you shouldn't use the VMware-supplied driver with W2K, though. Perhaps W2K does support that adapter out of the box.)
  9. When prompted for the Manufacturer-Supplied Adapter disk, mount the VMware SCSI Driver floppy image (the *.flp file you saved before) in the VM's virtual floppy drive and connect it.
  10. When prompted, boot the Recovery Console. In the recovery console, specify the installation you want to access (usually 1, for the default OS installation). At the C:\Windows> prompt, issue the "fixboot" command. This ensures that your new boot drive has a good boot sector. (I'm not entirely sure this was necessary, but I did it as a precaution.)
  11. Since the registry files were not copied over via the ROBOCOPY command, they need to be copied over from the C:\Windows\Repair\ directory to the C:\Windows\System32\Config\ directory. Type the following commands into the Recovery Console (reference):

    copy c:\windows\repair\system c:\windows\system32\config\system
    copy c:\windows\repair\software c:\windows\system32\config\software
    copy c:\windows\repair\sam c:\windows\system32\config\sam
    copy c:\windows\repair\security c:\windows\system32\config\security
    copy c:\windows\repair\default c:\windows\system32\config\default

  12. Exit the Recovery Console and let the system reboot. Boot to the W2K3 install CD again and hit F6 to load the VMware SCSI driver as before. (You may need to dismount the floppy drive if it is ahead of the CD-ROM drive in the VM's boot order BIOS setting.) This time, select to repair the existing installation of Windows. Select to "set up Windows now" and then "repair...".
  13. The VM will run through the W2K3 repair process (it seems like an upgrade). When it's done, the VM should boot up and look OK when you login to it. (I didn't use a particularly complicated VM for my testing, so YMMV.)

Now that the VM is using a SCSI virtual disk, it can be migrated to ESX server. The process to do so is outlined here. You'll want to note exactly which filename corresponds to the root .vmdk file that is used for the virtual SCSI disk. The process they describe is pretty straightforward. You make the .vmdk file(s) in question available to the ESX server and copy them over to a VMFS partition. Then you create a new VM and point it to the .vmdk file. After a few boots, installation of new VMware tools, and an upgrade of the virtual hardware, your VM should be stable and ready to rejoin the network.

Hope that helps anyone in a similar situation in the future.

TrackBack

Listed below are links to weblogs that reference Migrating VMware GSX VMs Running W2K/W2K3 To VMware ESX Server:

» Migrating VMware GSX VMs Running W2K/W2K3 To VMware ESX Server from Kushanir Blog
More info can be found on my page... [Read More]