Moving locked VM’s in ESXi using SSH

VMware vSphere is a very nice piece of virtualization software.

Sadly there are a few things that can go wrong and I had the “luck” to hit one of those. Waking up on a morning to notice that 4 VM’s are offline because of the ESXi host going down (hardware failure) isn’t something you want to wake up with. The worst news was that it was a new host which hadn’t been added to a cluster yet so no HA :-(.Thank god I run the machines from a storage!

After adding the storage to another ESXi host I was looking for a way to boot the machines from the new ESXi host. The problem was that vCenter saw the hosts as disconnected and VMotion wasn’t possible. Joy?

Thank god (again?) for SSH access on the machine. So I logged into the machine and managed to boot the machines on the new host by using the following command:

vim-cmd -H hostname_of_new_hypervisor /vmfs/volumes/datastorename/vm-dir/vm.vmx start

Weird thing about this: vCenter (which wasn’t able to do anything with the machines) did see the hosts being moved and changed them to the new ESXi host.

Niels Engelen
Working as a pre-sales with an interest for anything virtual and cloud. Certified as a VMware Certified Professional 4 and 5. Niels also gained the VMware vExpert award (2012-2016) and is an ex-PernixPro.