How to migrate a VMWare Workstation VM to ESXi
I could not find a simple explanation on how to do this anywhere so I'll document this as simply as I can. The versions this references is VMWare Workstation 7.1 and ESXi 4.0.
- First I'll assume you have a Workstation VM on your local machine. You'll need to migrate this to your ESX box. As a side note I tried to use a USB drive to move over the VMs. If this is possible, I could not find out how. The USB drive would not mount. So I needed to use the vSphere interface.
- Login to vSphere. Choose the 'Summary' tab and look over at the right column of stuff and locate the 'Datastore' area. Right-click on the datastore you want to upload to and choose 'Browse Datastore'. With the root folder selected on the left, choose the 'Upload files to datastore' button. It looks like a database cylinder with a green arrow pointing up. It gives you the option of 'File or Folder', I just selected my local folder with all my VM Workstation files. Hit ok and depending on the size of your VM files and the network speed, prepare to wait a while or go get something to eat.
- (Several hours later)
Now your files are up on the server but if you attempt to add that hard drive to a new ESX VM and start it you'll get an error similar to:
Failed to open disk scsi:0:0. Unsupported and/or invalid disk type 7D'oh. You need to convert this disk using server-side tools.
ssh into your ESX server and locate your uploaded VM files. Mine were located under:
/vmfs/volumes/<crazy long uid>/<workstation vm folder>/*.vmdkOnce there you will use the vmkfstools command to convert the drive. There are several formats and I don't claim any expertise on which format to use. I chose 'thin' hoping to use the least amount of disk space. It kinda worked, I'll explain below. You can dig into these options a bit more but some of the other format options were:
-zeroedthick -eagerzeroredthick -rdm -rdmp -2gbsparse -monosparse -thick -thin -monoflat -monosparseI used the following command to do the conversion:
vmkfstools -i workstation.vmdk -d thin newesx.vmdkIf you look at the file system level this will create two files: newesx.vmdk and newesx-flat.vmdk. I had a dynamic disk in Workstation that was currently 15GB but could grow to 100GB. This conversion made the newesx-flat.vmdk the full 100GB if you looked at it with 'ls -l'. However in the summary screen of vSphere it still listed Used Space as 15GB. This didn't seem quite right but there you go.
- Now go ahead a create a new VM through vSphere and choose 'Custom' so that you can assign our newly converted drive to it. That's it. I hope it helps you out.