The warning ‘Virtual Machine disks consolidation is needed’ in the Summary tab of a virtual machine in the VMware vSphere console means that when deleting a snapshot (using the option Delete or Delete All), the snapshot VMDK files or logs have not been deleted correctly (remain on the storage). This causes a virtual machine backup errors.
The most typical causes of the ‘Virtual Machine disks consolidation is needed’ error are:
- Poor storage performance, due to which snapshots cannot be deleted/consolidated due to a timeout or a large size of a snapshot;
- There is not enough space on the VMFS store to perform consolidation;
- vSphere or a third-party app (as a rule, it is a backup application, like HP DataPtotector, Veeam or Netapp VSC) has locked snapshot files. Make sure that there are no running processes of a virtual machine backup;
- Connection problems (possibly temporary) between the vCenter server and the ESXi host.
To fix the error ‘Virtual machine Consolidation Needed’, right-click on the virtual machine and select VM -> Snapshots -> Consolidate.
A window with the following request appears:Confirm Consolidate
This operation consolidates all redundant redo logs on your virtual machine. Are you sure you want to continue?
Confirm that you want to delete the redundant logs. Then vCenter will consolidate disks and clear the logs. The consolidation may take a few minutes and the VM performance may degrade.
After that the warning of the VM consolidation will disappear.
In some cases, during consolidation you may see this error in the vSphere console:Unable to access file since it is locked. An error occurred while consolidating disks: Failed to lock the file. Consolidation failed for disk node ‘scsi0:0’: Failed to lock the file.
In this case VMware recommends to restart Management agents on the ESXi server. To do it, connect to the host via SSH and run this command:
services.sh restart
However, you can try to unlock the VM files as follows:
- Shutdown the VM if it is possible;
- Create a new snapshot;
- Delete all the VM snapshots using the ‘Delete All’ option;
- Move the VM to another ESXi using vMotion;
- Try to consolidate snapshots as described above.
You can find all virtual machines that require consolidation using PowerCLI. To do it, connect to your vCenter server:
Connect-VIServer mun_vsphere.contoso.com
Get the list of all VMs with the status ‘Virtual machine disks consolidation is needed’:
Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded}
Now you can consolidate the disks of all machines in the list:
Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded} | foreach {$_.ExtensionData.ConsolidateVMDisks_Task()}