How to move a physical machine / server to a VMware VM

A special thanks for this post from Alan Gordon:

In recent months I have had a lot of questions regarding to to migrate physical serves to VM’s. And while VMware provides an excellent tool (VMware converter) for migrating physical machines / server , this tool does unfortunately  not support OS X as a source…..VMware hint hint !!

So what are your options? Fortunately VMware has ported their vmware-vdiskmanager tool and vmware-rawdiskCreator tool to OS X as part of their VMware Fusion package !

These two tools provide a very easy way to convert the hard drives of a physical machine to the needed virtual disk format (vmdk). In the following I will give a brief step by step on how to migrate the disk of a physical machine hard drive to a vmdk.

As the tools need exclusive access to the hard drives of the physical machine, and need to unmount them you would want to boot the machine to be migrated in target disk mode or alternatively boot it on an alternate media with the WMware tools installed. Also please make sure to have access to some storage for the resulting vmdk files.

1. First start with booting the physical machine to be migrated of a USB stick, another hard drive with the VMware tools installed.

2. Launch terminal and use the diskutil command to identify the device descriptor of the device you want to migrate eg. (note the device number…(in most cases disk1, if you don’t have a lot of other devices mounted):

diskutil info

3. Since we need to migrate a physical disk and since the converter tool vmware-vdiskmanager tool cannot convert physical disk directly, we will use another tool, vmware-rawdiskCreator, to create a pointer / link for for the actual physical disk, that vmware-vdiskmanager can operate on, so punch in the following in the terminal and press enter(the below example implies that VMware Fusion is installed in your /Applications/ directory

/Applications/VMware Fusion.app/Contents/Library/vmware-rawdiskCreator create /dev/<DEVICENUMBER> fullDevice <DESTINATIONFOLDER>/<VMDKNAME>-link lsilogic

4. Unmount the device to be migrated with the following command in terminal

diskutil unmount /dev/<DEVICENUMBER>

5. Now we have the pointer / link file that vmware-vdiskmanager can work on, so punch in the following in the terminal and press enter to convert to physical hard drive.

/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager –r <DESTINATIONFOLDER>/<VMDKNAME>-link.vmdk –t <DESTINATIONFOLDER>/<VMDKNAME>.vmdk

After the process ends,  the resulting vmdk file, in the <DESTINATION> folder will be a working vmdk file that you can add to a VM in ESXi / vSphere.

The trick here is that we use a VMware tool, vmware-rawdiskCreator, to create a link file to a physical device, and use that link file with the vmware-vdskCreator. Be aware that you will need to space on the destination for the whole physical disk converted into a vmdk.