I wanted to write up a quick post concerning an error I received recently with consolidating disks on a few VMs. Disk consolidation is needed when snapshot disks fail to compact after a Delete or Delete All operation or if the disk did not consolidate. Sometimes a snapshot deletion doesn’t commit back to the base disk. I had this warning in the summary of a particular VM I was working with recently. However, when running the consolidate operation an ominous error presented – VMware disk consolidation unable to access file since it is locked. Let’s take a look at this issue and how it was resolved in my case.
VMware Disk Consolidation unable to access file since it is locked
As mentioned above, in logged into the web client recently I saw a virtual machine that was presenting with the warning that Virtual machine disks consolidation is needed. In looking at the issue initially my suspicion is the deltas were not committed in a backup software run that went down dirty perhaps.
Most know where to find this, but in case you didn’t know, you have the Consolidate option under your Snapshots menu. Here you see it greyed out as this particular VM doesn’t need disk consolidation.
The error I ran into was the below error. When I kicked off the Consolidate process, it came back with a Unable to access file since it is locked error.
There is a pretty helpful VMware KB article on Unable to delete the virtual machine snapshots issue. One of the troubleshooting steps therein was to restart the management agents on the particular host the VM is running on. It can be that the host has a lock on the disk files in question. Thinking this could be the culprit, this is exactly what I did. You can do this from the command line of the ESXi host itself by running the command:
After restarting the management agents of the host the particular VM was running on, I was able to successfully run the consolidation process and delete the delta disks.
Snapshot delta disks are definitely a great tool to have when you need them and also the common way that most modern VMware backup software applications are able to grab quick and effective backups. However, they can also be a sticky situation as well if you have a situation where you have orphaned delta disks as in my situation here. This can happen as it did with me if you have a backup go down dirty or not commit snapshot changes correctly. If you try and consolidate the delta disks and see the VMware Disk Consolidation unable to access file since it is locked error, restarting the management agents may do the trick as the host can have a lock on the files and prevent consolidation.