Skip to main content
VMWare

VMWare: Virtual Machine Disks Consolidation is Needed

By November 20, 2019No Comments

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.

vmware warning: Virtual Machine disks consolidation is needed’

The most typical causes of the ‘Virtual Machine disks consolidation is needed’ error are:

  1. Poor storage performance, due to which snapshots cannot be deleted/consolidated due to a timeout or a large size of a snapshot;
  2. There is not enough space on the VMFS store to perform consolidation;
  3. 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;
  4. 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.

consolidate snapshots in the vcenter console

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?

This operation consolidates all redundant redo logs on your virtual machine

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.

consolidating vmdisks vsphere

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.

vm consolidate: Unable to access file since it is locked. An error occurred while consolidating disks: Failed to lock the file. Consolidation failed for disk node

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

restart Management agents on esxi: services.sh restart

However, you can try to unlock the VM files as follows:

  1. Shutdown the VM if it is possible;
  2. Create a new snapshot;
  3. Delete all the VM snapshots using the ‘Delete All’ option;
  4. Move the VM to another ESXi using vMotion;
  5. 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()}

ConsolidateVMDisks using vmware powercli

Leave a Reply