VMware ESXi 5 VM reset stuck at 95%

Hi folks,
Ivailo here to talk about a problem I had few days ago. While I was working on a customer’s server running a VM on ESXi 5.0, the VM froze so I had to forcibly reset it. When I did so, the reset task got stuck at 95%. I did some digging and found few threads talking about the same issue but they were all for ESXi 4. I had to do some additional research and modify the commands in order to make them work on ESXi 5. Bellow are the steps that resolved my problem:

  1. With vSphere Client, connect to the host or the VC server that controls the host.
  2. Click on the host and go to the Configuration tab.
  3. Click on Security Profile.
  4. Click on Properties in the Services table.
  5. Start ESXi Shell and SSH services.
  6. Open a SSH session to the host.
  7. Execute /sbin/services.sh restart. This will restart all agents. The vSphere Client or the vCenter server will lose connection to the host. Reconnect! The VM may show as (invalid).
  8. Find the PID of the process by typing ps|grep “<VMName>”. The second number before the name of the VM is the PID.
  9. Kill the process by typing kill -9 <PID>.
  10. Go to /vmfs/volumes/<DataStoreName>/<VMName>.
  11. Delete the swap file by typing rm –r <SwappFileName.vswp>
  12. In vSphere Client right click the VM and select Remove From Inventory.
  13. Browse the data store, open the VM folder, right click on the .vmx file and select Add to Inventory.
  14. Power On the VM.

Hope this helps.

Ivailo Mitkov

11 thoughts on “VMware ESXi 5 VM reset stuck at 95%

  1. I was pretty pleased to discover this web site. I need to to thank you for your time for this fantastic read!! I definitely enjoyed every part of it and I have you book-marked to check out new things on your blog.

  2. I get up to the point where it says Invalid, but when i run your commands, my VM doesn’t show up. Still no way to remove it. Do you have any clue?

    • Hi John,

      Were you able to find the PID of the VM?

      ps|grep “VMName”

      For example if your VM is called VM1 the command would be:

      ps|grep “VM1”

      You should see screen similar to:

      577239 587476 vmx-vthread-4:VM1 /bin/vmx
      587480 587476 vmx-mks:VM1 /bin/vmx
      587481 587476 vmx-vcpu-0:VM1 /bin/vmx

      The PID is the second number in the table. In my example 587476.

      You will need the PID in order to kill the VM process:

      kill -9 PID

      …or in my example

      kill -9 587476

      Hope this helps!

      Ivailo

  3. I was unable to get VM unstuck even following these step on a ESXi 5.1 host. 2+ hours and was at wits end…
    I was fortunate enough to have a recent snapshot so after a full server reboot, I reverted to previous snapshot – machine booted right up after it was done.

    Thanks for these great tips – hope this one helps someone who is stuck at 95% like I was.

    • Hi Scott,

      I am glad you were able to fix your problem. Unfortunately not always a snapshot can be used. Even if a snapshot exists it can’t be used to restore an Active Directory Domain Controller for example. Also the problem I am describing in this post would have been fixed by the reboot alone. The problem was that this was a standalone production ESXi server. I couldn’t reboot the server in the middle of the day and the customer needed the hanging VM ASAP.

      Can you please share where exactly you got stuck? This information can help someone else.

      Thanks,

      Ivailo

Leave a Reply to GeorgeRiz Cancel reply

Your email address will not be published. Required fields are marked *