Please try the below steps, in order -
1) Right click the invalid VM entry and remove it from inventory. Check if this has released the lock.
2) If only the vmx file is locked, you can create a new VM and attach the existing disk.
3) If you are unable to remove the invalid entry, clear the contents of the vminventory.xml file -
- Take a backup - <cp /etc/vmware/hostd/vmInventory.xml /etc/vmware/hostd/vmInventory.xml.backup>
- Clear the contents - <cat /dev/null > /etc/vmware/hostd/vmInventory.xml>
- Restart the services - </sbin/services.sh restart>
- Register the VM to the inventory
Please consider marking this answer as "correct" or "helpful" if you think your questions have been answered.
Thanks for your reply. I already registered and removed the vm from inventory several times. (through UI)
But that doesn't seem to release the lock. I also tried your suggestion to clear the vmInventory.xml but the problem still exists.
The most important problem is that both files (*.vmdk - VMFS6 formatted and *.vmx) have a lock. Otherwise I would just create a new vm and attach the old *.vmdk, but this is also not working because of the existing lock of the *.vmdk file... I'm also not able to copy or move this file.
Any other suggestions? I really need to get the data from this *.vmdk file.
Are you sure that the lock is from the host that has been decommissioned already? The decommissioned host is in powered state right?
yes, I'm sure. There is only one host in my environment.
Yes, the host is in powered state. Other vm's from before the crash are running without any problems.
Just one from has this problem with locked files...
Is there any other way where I could copy or get read access to the *.vmdk from the locked virtual machine / files.
I would like to copy the file to a different datastore or external drive so that I can re-create a new VM with the already existing disk...
Already tried the following:
- using FTP program
- using WinSCP --> Error code: 4
- using ESXi/vSphere web interface
- mount the datastore disk in a different linux system. --> Tried to mount the VMFS6 formated disk in Linux Ubuntu with vmfs-tools. But this is also not working for VMFS6.
All these ways failed because of the still locked *.vmx and *.vmdk files. And I am not able to get rid of that lock
> Tried to mount the VMFS6 formated disk in Linux Ubuntu with vmfs-tools. But this is also not working for VMFS6.
My next suggestion would be:
use a Linux helper VM while running ESXi as usual.From the Linux VM mount the complete datastore via sshfs in READONLY mode.
Mount another datastore in Writeable mode.
Use ddrescue to copy the flat.vmdk to the datastore that you can write to.
Use normal copy for the small files.
If that also fails try to get the mapping of the locked flat.vmdk via
vmkfstools -p 0 name-flat.vmdk > mapping-file.txt
If that works we can create a dd-script to extract the flat.vmdk in a raw mode that does not check for locks.
Are you still booted into Linux ?
If you dump the first 1536 MB of the VMFSvolume in question to a file with a command like
dd if=/dev/sdXY of=/tmp/schmid.1536 bs=1M count=1536
and provide the dump I can suggest the best next steps.
Feel free to call me via skype - ich spreche deutsch ...
many thanks for your reply.
I followed all of your steps with no success :-(
1. Mounted datastore via sshfs (with and without readonly mode | parameter: -o ro)
There was an error copying the file into ...
Error opening file: Operation not permitted
2. Tried to get the mapping. But this was also failing.
Could not open file...
3. Uploaded the VMFS-Header-Dump here: <removed wrong link>
Many thanks again for your time. Hope you get some more details from that dump...
just checked the dump - the file is good but I need to know which flat.vmdk you need.
Please specify the name of the directory and the name of the flat.vmdk.
If possible call me via skype - I probably have follow-up questions.
Tried to register for a skype account but they like to know a lot of information.
And I need to verify that I am an adult via credit card number. But I don't like to give them that information...
I need this *.vmdk:
Thanks in advance.
Are you sure you created the dump for the correct datastore ?
I dont see the directory HO-APP-SRV
I see for example HO-VCSA.
Check your private messages.
Got the correct dump now.
Can you explain the file HO-APPSRV-flat.vmdk you created or last modified yesterday.
There is no descriptor-vmdk for this one.
Is this the result of an accident ?
yes, this was an result of an accident during mounting, copying, etc...
This file can be safely ignored.
I'm not at home at the moment. I will try to call you in about 2 hours.
I already prepared a bootable usb-stick with the iso image provided via pm.
Many thanks in advance for your time and assistant.
The datastore is back and running after two live remote sessions together with continuum.
It was a very strange and deep problem. But continuum was able to find a for me magic solution.
He solved the problem very fast. Amazing guy with a great knowledge about VMWARE products!
I can absolut suggest to contact him if you have any problems with restoring files from your datastore.
Thanks again for your assistance.
I wanted to thank you for how tremendously useful this thread was!!
A sudden crash left every vmx and vmdk on one datastore locked, and hours of searching only to find that none of the current tools seem to actually fix stale locks - just let you know the mode and who holds the lock, I came back to this thread.
Pulling the first 1.5G from the datastore as you mentioned, and working with a hex editor, I was able to use that information to clear the mode and lock entity in a single find and replace. You were so tremendously helpful pointing the right direction with this thread!!