Your ESXi server gives you warning that says “Virtual machine disks consolidation is needed”

Then you simply click on consolidate from snapshot – consolidate but does not work. Gives you error:

“Unable to access file <unspecified filename> since it is locked”



This happened most probably your backup system took a snapshot of your system and unable to remove.



1. Login to ESXi server from console,
2. Press F2 to login and from Troubleshooting options, Enable SSH console, 3. ALT F1, login from command line interface again and type your root password 4. Type this command below, this action wont affect your runing VMs on your host, it will just restart the services and release the locks that your host is holding. restart
Then simply go back to your VM and try to consolidate again. This should remove all snapshots. Another option could be take one more snapshot and delete all snapshots. Delete all is important here.

Solution 2:

If you do not want to go for restart 
Then go for steps below
1. SSH into the ESXi host using Putty or another SSH client.
2. Drilled down to the Datastore where the VM in question resides: cd /vmfs/volumes/<datastore>/<VMDIR>
3. Locate the vmware.log and open with a text viewer.  I used cat vmware.log to view the log.  Also, used putty and set my session to log all screen output but you could extract that log to better review.
4. After you open the log, see if you see any errors regarding locked files, etc. (These errors existed in my case)
5. If errors exist such as “Failed to lock the file” there is possibly a active process that didn’t stop correctly from a previous failed task.
6. Run # lsof +D | grep <name_of_locked_file>

lsof +D /path

That will recurse through the filesystem under /path, so beware doing it on large directory trees.Once you know which processes have files open, you can exit those apps, or kill them with thekill(1) command.

7. Next run Kill <PID> .  The <PID> should be at the begining from the output in step 6 which has been underlined in the following example. (EX:5303 vpxa-worker 12 29 /vmfs/volumes/4360c6cf-2fee4d90-2404-5ef3fc344abb/VM/<name_of_locked_file>)
8. The host may appear to have went offline for a few seconds if you happen to have a vSphere client open but should reconnect.
9. Next, select the VM which should still have a mesage of “Virtual machine disks consolidation is needed” and select Snapshot–>Consolidate.
10. The file should begin to consolidate and the error message should disappear.
Symptoms & Errors:
You cannot power on the VM, it gives error below:
Power On virtual machine
<servername> Cannot open the disk
14ce/servername/Servername-000007.vmdk’ or one of the
snapshot disks it depends on.
You cannot create a snapshot, error below:
Create virtual machine snapshot <servername> The virtual disk is either corrupted or not a supported format.
You cannot consolidate error below:
Consolidate virtual machine disk files servername Unable to access file  since it is locked