Restore a VM if it's still in datastore? Issue after restarting host to fix Removing Snapshot issue.

garryshape
garryshape used Ask the Experts™
on
I'm on esxi 5.5, vSphere 6.5. Something happened where a VM got stuck removing snapshot after a Veeam backup and been running for over 72 hours. We saw no file size changes on files in the VM folder on the host so we restarted management agent on the host.
After the host rebooted, this VM became invalid/inaccessible (it alternates between those two states continuously).
I removed it from Inventory and am not sure how to add it back. When I browse to the datastore and try to right-click the vmx file, the only options I see are Download, delete, copy, move, rename...
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017
Commented:
VMX file is corrupted, you will need to re-create.

This actually simpler than it sounds, just create a new VM (vmx configuration), following the wizard, and then select Add existing Virtual Hard Disk.

try and remember what hardware was present in existing VM, e.g. CPU, Memory, NICs, etc

OR Restore from backup, just the VMX file.

You have the OS/Data in the VMDKs, which may or may not be corrupted, and requires so additional effort to get correct, if snapshots are still hanging around.

VMs with snapshots, never a good idea to restart agents, restart host - basically mess around, hoping something good is going to come through.....

Author

Commented:
Am I supposed to see more options than that upon right-clicking?  
Because all of my other VMs are running fine yet I don’t see any options to Import when right clicking their VMX files.  
Is it maybe a permission issue? I’ve tried local Admin and another Admin.
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017
Commented:
If you right click a VMX file you should see Add to Inventory.

But if you look closely at the datastore, does it show it as a VMX file, if not it's corrupted or it could be in use and locked.

Screenshot please.

Author

Commented:
Ok yeah I think it’s locked then. I can’t copy the VMWare.log file either says it’s locked. Sorry don’t have screenshot now but can take in a few.
I’m not sure how it’d be locked after restarting services

Author

Commented:
Here is a screenshot  
And the VM is currently not in Inventory.
219B617E-F5B5-49E2-B282-92128BF8552B.png
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017
Commented:
the fact that it has no icon associated with it, looks like a corrupt VMX file, compare with a good VMX file, and you should see an ICON.

The icon should be three overlapping little blue squares!

vSphere/ESXi does not recognise it as a configuration (VMX) file to Register with Inventory.

It's corrupt.

Author

Commented:
Could it be not-corrupt but also "locked" somehow thus not revealing the "Register VM" menu item?
Because when I also try and copy the "vmware.log" that is residing in this same directory as the .vmx to another folder, I get "Unable to access file [Datastore] VMname/vmware.log"

Author

Commented:
There's a .lck file in the directory as well
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
Anything is possible, if that is the case you will need to search and try and find what is locking it.

Quickest solution is to restart host!

Veeam is still not trying to back it up! or have the parent virtual disk connected to the Veeam VM ?

Author

Commented:
Yeah something has it locked I couldn’t reboot host it was taking forever to go to maintenance mode.  
I created a new VM and added existing disks and got it backup. Not sure if that will create conflict again however
.
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
It will not cause any conflicts.

Author

Commented:
Ok thanks. I'll at least try maintenance mode on the host next later tonight.
Problem last night is it was getting to 17%, 18%, then 19% and stopped for abotu 30 mins. Not sure why. I cancelled it
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
what was getting to 17% etc ?

Author

Commented:
The Host's status of Entering Maintenance Mode
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
something is running on the host which is stopping it entering maintenance mode, like a VM running.... (ghost VM)

Author

Commented:
So if I reboot the host, it should automatically migrate off the VM's (like in maintenance mode) but still continue to reboot even if a ghost VM is running?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017
Commented:
You will need to move the VMs (migrate manually).

but it may still not go into maintenance mode, if it thinks something is running...

and you'll just have to power off or reboot the host.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial