Are you getting the warning error "VMWare: virtual machine disks consolidation is needed"?
This guide will help to fix it.
The warning error "VMWare: virtual machine disks consolidation is needed" error is triggered in the process of deleting a snapshot, its VMDK files or logs which have not been properly deleted.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our customers to solve VMWare related issues.
In this context, we shall look into what causes this error and the best method to fix it.
Some of the factors which leads to this VMWare error are outlined below;
i. When the Storage is not performing properly, deleting a snapshot will not go through. The main reasons why this happens is due is either if the snapshot's size is too Large or when the deletion process experiences a timeout.
ii. Lack of disk space on the VMFS store to perform consolidation can trigger this error.
iii. If the snapshot files is locked by the vSphere or a third-party application. It is recommended that that there are no running processes of a virtual machine backup.
iv. When there is a connection issue between the EsXi host and the vCenter Server.
To start with, right click on the virtual machine and then select "VM" followed by "Snapshots" and then "Consolidate".
Then you will see a new windows where you will be prompted to "Confirm Consolidate".
Here, click on the "Yes" button to confirm that you want to remove the redundant log files. This will consolidate disks and clear the logs of the vCenter. This action could take a few minutes for the Consolidation to happen and the VM performance may degrade.
After this, the warning of the VM consolidation will go off.
Sometimes, you might get an error during this process such as this;
Unable to access file since it is locked
Unable to access file since it is locked
An error occurred while consolidating disks;
Failed to lock the file.
Consolidation fails for disk node 'scsi0:0':
Failed to lock the file.
If this is the case, VMWare recommends that you simply restart the Management agents on the ESXi server. Do this by running the command as shown below via an ssh tool such as putty;
services.sh restart
Additionally, you can also try to unlock the VM files by following the following steps;
i. You can shut down the VM.
ii. If possible, create a new Snapshot.
iii. You can use the option "Delete All" to delete all the VM snapshots.
iv. With the vMotion, you can move the VM to another ESXi.
v. You can try consolidating the snapshots as advised above.
Alternatively, you can find all the virtual machines which requires consolidation via PowerCLI. To do this, make a connection to your vCenter server like this;
Connect-VIServer mun_vsphere.woshub.com
This will display the list of all the VMs having the status "Virtual machine disks consolidation is needed". Use this;
Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded}
Then, consolidate the disks of all machines in the list with the command;
Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded} | foreach {$_.ExtensionData.ConsolidateVMDisks_Task()}
This article will help you to fix the warning error "VMWare: virtual machine disks consolidation is needed" experienced when trying to delete a snapshot, the snapshot VMDK files or logs have not been deleted correctly.