Could not power on VM : No swap file. Failed to power on VM
When the ESX server get unexpected restart, it might happen that some of the VMs has a problem with Power on due to file lock.
Failed to power on VM Could not power on VM : Lock was not free.
Failed to initialize swap file ‘/volumes/4d8a07c2-b63cce23-a467-d8d385b8f298/vm01/vm01-3473aa90.vswp’ : Lock was not free
Failed to power on VM. Could not find swap file.
What to do it that case ? Find out which server keeps a lock on files, move VM to that server and power it on.
- We have to find out which server keeps file locked.
Log in to server via ssh, navigate to datastore and folder with virtual machine files, type – touch out put should be: device or resource busy
- next step is to identify MAC address of the server which keeps file locked, from a command prompt type vmkfstools -D which will send all info to vmkernel log
- Next, tail /var/log/vmkernel and search for expression after word owner (see picture below, arrow with rectangle). last 12 figures is a MAC address of the service console from server which keeps file locked.
- When MAC address is known, is easy to find a server which keeps a lock, log in to ESX servers over ssh and execute command: ifconfig | grep -i hw
As you can see on above figure, MAC address corresponding to expression from vmkernel log. Guilty server was found 🙂
- Perform vMotion of problematic VM to server which keeps the lock and power VM on.