Monday, December 17, 2012

Convert VM from VM Workstation to ESX / ESXi


Importing and exporting virtual machine from a VMWare ESX Server host requires converting that virtual machine’s .vmdk file(s) from one format to another.
Although the underlying technologies work the same, the formatting of the VMDKs differ.
You have 2 options:
1) If you have a running copy of workstation, simply use VMware Converter as you would for any normal conversion, treating the VM as you normally would a physical host in a P2V
2) If you have no working Workstation, you can clone / convert the vmdk at the command line – as I have a fully ESXi lab to play in, I don’t have Workstation running on any machines in my office – as such, when IBM recently supplied a VM for a demo . . that had been created on VM workstation, I had to import it. I used the following process.
Firstly, get hold of an SSH tool ( I use putty)
Next, open a connection to any host that has the storage containing the vmdk presented
In ESX / ESXi, this will be in /vmfs/volumes/
Note: the destination path /dest/folder/vmserver1.vmdk should not contain any existing files with the name ‘vmserver1.vmdk’. If it does the file will be overwritten.
Importing Virtual Disks from GSX Server and Workstation to ESX Server
Before an ESX Server can run a virtual machine created on a different version of VMWare, the virtual disks must first be converted to a format that can be read by the VMFS file system. This is done by running the following vmkfstools command:
vmkfstools -i /.vmdk :.dsk
is the name of the folder from which you are importing from
is the name of the virtual machine file(s) to be imported
is the name of the VMFS partition you are importing to
An example of a complete command would be:
vmkfstools -i /vmfs/volumes/CLRLAB001T1/vmserver1.vmdk /vmfs/volumes/CLRLAB001T1/vmserver1_new.vmdk
Additional information regarding the vmkfstools command can be found in the ESX Server documentation.