How to move a VM without vCenter or Storage VMotion
This something that I don’t have to use very ofter but it can save sometime if you have a standalone ESX hosts. If you have vSphere with vCenter server than Storage VMotion is the way to do this same thing. It’s also much easier to accomplish. But if you are a small shop or have a standalone host some place these few steps will get the job done.
Just to make things clear you cannot do this while the Virtual Machine is running, you will have to shut it down first. Then log into the service console via SSH or at the console directly. You need to login with root privileges or us SU – to elevate your rights.
Before starting you will need to find out the LUN ID that your machine is located on. You do not want to use the datastore friendly name for these commands. There are 2 ways that you can find this out.
The second option to find out the LUN ID would be to connect directly to your host. Then go to the Configuration tab and click on storage from the left section. You can then click on the Datastores and you will be able to see the ID in the lower section. I circle an example on the picture above.
Now that you have identified the LUN ID’s and shutdown your virtual machine. You can now unregister the VM so that it can be moved without breaking anything. Use the command listed below with your details and refer to the picture above to see what it looks like on my test machine.
vmware-cmd -s unregister /vmfs/volumes/LUN ID/vmname
Now that the virtual machine has been unregistered it can be moved. This can be done by the mv linux command and providing a source and target locations. Use a command like the one below and again refer to the image above to a real life example.
mv /vmfs/volumes/source LUN ID/vmname /vmfs/volumes/destination LUN ID/vmname
The last step now that you have moved the virtual machine is to register it with the host. This is similar to the earlier step and I have listed a command sample below. Also the image above shows my lab example.
vmware-cmd -s register /vmfs/volumes/LUN ID/vmname/vmname.vmx
About Brian Suhr
Brian is a VCDX5-DCV and a Sr. Tech Marketing Engineer at Nutanix and owner of this website. He is active in the VMware community and helps lead the Chicago VMUG group. Specializing in VDI and Cloud project designs. Awarded VMware vExpert status 6 years for 2016 - 2011. VCP3, VCP5, VCP5-Iaas, VCP-Cloud, VCAP-DTD, VCAP5-DCD, VCAP5-DCA, VCA-DT, VCP5-DT, Cisco UCS Design