How-to – Moving VMWare server/workstation .vmdk to ESX Server

0
1204

While finishing the setup of my VMWare ESX infrastructure, I needed to move a couple of virtual machines from a VMWare Server (running on Windows XP) to my ESX server.

Migrating most of those machines was relatively easy : I booted the virtual machine using the VMWare convertor cd and used the convertor to move that virtual machine to ESX. However, this technique did not work for my Longhorn beta 3 server.

That machine was created as a “Vista (experimental)”, and apparently the vmware convertor doesn’t recognize it (yet). Result : the vmware convertor died with a “Unable to determine Guest OS” error message.

I used the following technique to move the vmdk files to ESX manually :

First of all, Download FastSCP from http://www.veeam.com/veeam_fast_scp.asp and install it (in my case, I installed it on my Windows XP machine)

Next, I set up a connecting to the esx server using FastSCP. Navigate to /vmfs/volumes/<id> and create a new folder. I created a folder called “hercules”

The virtual machine I want to migrate is called “Hercules” and contains of a couple of files : —-

Select the two vmdk files (Hercules.vmdk and Hercules-flat.vmdk) and use FastSCP to copy them the esx server, in the newly created folder. Since we are working with big files, the copy process may take a while…

After copying the files, log on to the esx server using ssh and go to that folder.

[[email protected] root]# cd /vmfs/volumes/46e65002-47bafdb7-c511-000423df90e4/ 
[[email protected] 46e65002-47bafdb7-c511-000423df90e4]# cd hercules/ 
[[email protected] hercules]# ls Hercules-flat.vmdk Hercules.vmdk

Now use the vmkfstools utility to clone the vmdk file (use the filename of the ‘small’ file). Note : this process will take a little while…

[[email protected] hercules]# vmkfstools -i Hercules.vmdk Hercules-new.vmdk 
Destination disk format: VMFS thick 
Cloning disk ‘Hercules.vmdk’… 
Clone: 100% done.

When the conversion is completed, you can delete the 2 old files

[[email protected] hercules]# ls -al 
total 31458496 
drwxr-xr-x 1 root root 840 Sep 11 17:57 . 
drwxrwxrwt 1 root root 1540 Sep 11 18:14 .. 
-rw-r–r– 1 root root 16106127360 Sep 11 17:38 Hercules-flat.vmdk 
-rw——- 1 root root 16106127360 Sep 11 18:13 Hercules-new-flat.vmdk 
-rw——- 1 root root 344 Sep 11 18:13 Hercules-new.vmdk 
-rw-r–r– 1 root root 352 Sep 11 17:38 Hercules.vmdk

[[email protected] hercules]# rm Hercules.vmdk 
rm: remove regular file `Hercules.vmdk’? y

[[email protected] hercules]# rm Hercules-flat.vmdk 
rm: remove regular file `Hercules-flat.vmdk’? y

[[email protected] hercules]# ls -al 
total 15729792 
drwxr-xr-x 1 root root 560 Sep 11 18:15 . 
drwxrwxrwt 1 root root 1540 Sep 11 18:14 .. 
-rw——- 1 root root 16106127360 Sep 11 18:17 Hercules-new-flat.vmdk 
-rw——- 1 root root 344 Sep 11 18:17 Hercules-new.vmdk

Now create a new virtual machine in ESX, use Custom configuration.
When you’re at the disk configuration window, select “use an existing virtual disk” and select the newly created vmdk file.

Complete the wizard.