Sunday, September 16, 2007

Migrating VM from VMware server to ESX 3.0

It actually takes a long time for me to sort out what to do. Finally, I had my BES server migrated to ESX from VMWare Server.

First step, please check if your HDD in the VM is SCSI or IDE. If it is SCSI, it saves you a lot of steps. If it is IDE, consult VMWare technical support first before migrating since I find an knowledge base article in the VM website (ID 1881). It requires you to convert from IDE to SCSI virtual disk first (the article applies to ESX 2.5, not sure if it applies to ESX 3.0, again, contact VM for more info.).

Second step, export a virtual disk from VMware server to ESX3.x. Since I don't have NFS running on the VMware server, I need to move the VM to another server with NFS running. Go to the VMWare Server. Remove any snapshot running on the VM. After that, power down the VM. Copy the whole folder for the VM from VMWare server to my NFS Share in the Windows NFS server. telnet to the ESX server. mount the NFS share to the ESX server. then run the following command on the ESX server.

vmkfstools -i /src_folder/src.vmdk -d 2gbsparse /dest_folder/dest.vmdk

(where src_folder is my mount pt for the NFS share. dest_folder is a folder I create on the vmfs datastore. However, the /dest_folder can be any directory that the ESX host can acess).

This exports the source VMDK files into a series of COW (Copy-On-Write) files that are of maximum 2GB size. Once they're sitting in /dest_folder, you will need to re-assemble them into a monolithic flat VMDK file for use with ESX. Run the following command to re-assemble them.:

vmkfstools -i /dest_folder/dest.vmdk /vmfs/volumes//new_vm_disk.vmdk

Now, follow the steps in ESX 3.0 server configuration guide to import the VM

In the VI Client, create a new virtual machine using the Custom configuration option.

When configuring a disk, select Use an existing virtual disk option and attach theWorkstation or GSX Server disk you imported. If you experience bluescreen for Windows server, check the SCSI controller type you define for the VM.

1 comment:

Andy said...

After migrating successfully using command line, weird thing happens. For example, I have migrated a VM called BES. ESX server automatically create another directory called BES_1 and all the VM definition file and non volatile RAM, logs...located in the BES_1 directory. The vmdk is still in the BES directory. I am not sure why it happens. However, the solution is to turn off the VM. Go to Edit Settings and remove the HDD (do not slect the option to delete it from disk).

In the putty session to the ESX server, move the vmdk files to BES_1.

Go to Edit Settings on VI and add a HDD, select to use existing vmdk and browse to BES_1 to select your vmdk.

Remove the BES directory if you want since all the files are under BES_1. Now turn on the VM.