Migrating a VMWare Fusion 4.1 instance to ESXi 5

November 19, 2012 Brian Cunnie

A VMware Fusion instance originally created as a side project may grow in importance and need to be housed on a production (i.e. ESXi) server.

Rather than undertaking the painful process of re-creating an instance, it’s easier to migrate the .vmdk files to the ESXi server.

Procedure

In this example, we’re migrating a Windows 7 instance (named w7_64bit_base_10-12-11_updated_IE9) to our ESXi server (server name: esxi2) (new instance name: windows7_2). First, we log into the ESXi server and create a temporary holding directory, then copy the Fusion .vmdk files over:

ssh root@esxi2
mkdir /vmfs/volumes/datastore1/windows7-tmp
exit
scp ~/Documents/Virtual Machines.localized/w7_64bit_base_10-12-11_updated_IE9.vmwarevm/*.vmdk root@esxi2:/vmfs/volumes/datastore1/windows7-tmp
ssh root@esxi2
cd /vmfs/volumes/datastore1/windows7-tmp
vmkfstools -i w7_64bit_base.vmdk -d zeroedthick windows7_2.vmdk

We’ll then need to create a new instance. For this, we use vSphere:

  • File → New → Virtual Machine
  • Configuration: Typical
  • Name: windows7_2
  • Select a datastore for the virtual machine (i.e. datastore1)
  • Guest Operation System: Windows; Version: Microsoft Windows 7 (64-bit)
  • Choose your network connection
  • Virtual disk size: 32GB Thin Provision

Now move the .vmdk file into place:

ssh root@esxi2
cd /vmfs/volumes/datastore1/windows7-tmp
mv -i windows7_2*.vmdk ../windows7_2/
exit

You should be able to boot

Clean up the old files:

ssh root@esxi2
rm -r /vmfs/volumes/datastore1/windows7-tmp
exit

Addendum

You’ll need to make sure that inbound ssh is enabled on the ESXi server.

In the case of Windows, you will need to manage the licensing (e.g. re-activating).

It would be more efficient to keep one terminal session logged into the ESXi server rather than continually ssh’ing in & exiting.

Acknowledgements

John Kastler provided the crucial vmkfstools command.

About the Author

Biography

More Content by Brian Cunnie
Previous
Building a Strategic Data Organization
Building a Strategic Data Organization

There are a few patterns that I experienced at Yahoo! that I continue to see as I meet with Greenplum custo...

Next
Restart post-migration
Restart post-migration

Helps Exceptional / Airbrake? Exceptional purchased Airbrake APIs are different, is there a clear winner...