Problem
You have a virtual machine in your vSphere environment that you would like to expand one of the hard disks but as you browse to the hard disk that needs to get expanded, you see that it is locked:
You’ve checked to confirm that there are no snapshots on the virtual machine:
Reviewing the files for the virtual machine show that there are CTK files for the disks that are locked and unable to be expanded in capacity:
Reviewing the disk for the VM in the vSphere Web Client displays the same behavior:
Shutting down and reviewing the VM’s summary tab indicate that the disks need to be consolidated:
Configuration Issues
Virtual machine disks consolidation is needed.
Attempting to consolidate the disks throws the following error:
Consolidate virtual machine disk files
Unable to access file since it is locked
See the error stack for details on the cause of this problem.
Error Stack
An error occurred while consolidating disks: msg.snapshot.error-DISKLOCKED.
Solution
One of the reasons why this error would be thrown is if you have this virtual machine configured to be backed up by a VMware VDP appliance and the appliance hasn’t released the disk at the end of a backup job or perhaps it did not complete properly. To determine whether this is the case, open the settings of the VDP appliance and review whether this virtual machine’s disk is attached to it as such:
You can verify the disks that belong to the VDR appliance by reviewing the administration console as such:
To correct the problem, simply remove the disk from the VDP appliance and select the Remove from virtual machine when prompted with the Removal Options (this does not delete the disk):
Note that the disk will still be locked at this point:
Proceed to consolidate the disks:
The disk should be unlocked once the consolidation task completes.