ESXi Copying a VM Between Two Hosts

UPDATE: If you’re using the odftool.exe and need to use domain accounts read my update here.

I manage a bunch of TFS servers that live on consumer grade hardware. This means that I have to be very good on backups and I also need to be on the lookout for better hardware. I recently purchased some more RAM for a machine that I have sitting around. It was hosting some development VMs; nothing that required a large amount of RAM. I did have a TFS build server that ended up having a bunch of CI builds pointed to it. I decided to do the good think and move the TFS VM to the newer machine with more RAM.

Unfortunately the VMWare vCenter Client that comes with the free license does not support copying from one host to another. I found a good article here that talks about how to do this with a tool called ovftool.

I had not used ovftool before and assumed it was something on the ESXi host that needed to be run from a SSH instance. It turns out you do not need to SSH into the ESXi host to use this tool. The tool is a windows console application that you run from your workstation.

There is another caveat with ovftool. It does not support certain special characters in your password. I had a bunch of special characters so I don’t know if it is any special character or if there are a set. I ended up creating a user called ovfuser with a password that was alphanumeric only. Doing this I was able to use the ovftool to transfer one VM to another host.

Copying from one VM to another.

Copying from one VM to another.

Here’s the breakdown of the call:

ovftool.exe -ds=[DATASTORE_NAME_ON_TARGET] vi://HOST/VMNAME vi://HOST2

HOST2 is going to be the ESXi host where your VM will be copied. From the best I can tell the ds argument is the datastore on the target VM which will contain the VM files.

Hopefully this will help you backup or migrate your VMs to other machines!

About Mike

I'm a software engineer. Look into the about page for more information about me.
Tagged , , . Bookmark the permalink.

5 Responses to ESXi Copying a VM Between Two Hosts

  1. Pingback: VMWare OVFTool Domain User Note - It's Not Found

  2. I am trying to move a VM from an ESXi server to another ESXi server located in another datacentre and I hope this tool will do the trick. Thanks for your post!

  3. Randy Holmes says:

    Two things to watch.
    1) You lose snapshots
    2) You lose thin provisioning, your VM will be converted to Thick.

  4. VM copying is not a good practice. You better to move VM to preserve you MACs and so on. For move and copy purposes there is a great solution from Veeam (Free Edition), but if you need only to move you VM with minimal downtime to another ESXi you better to use Extrasphere solution.

Leave a Reply