Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / Virtualization / VMware / VMWare: Virtual Machine Disks Consolidation is Needed

March 12, 2024

VMWare: Virtual Machine Disks Consolidation is Needed

The warning ‘Virtual Machine disks consolidation is needed’ in the Summary tab of a virtual machine in the VMware vSphere Client console means that when deleting snapshots (using the Delete or Delete All options), there were files left on the disk that could not be merged (committed) with the main virtual disk file (vmdk). As a result, you cannot backup such a virtual machine, and its performance is degraded.

vmware virtual machine disks consolidation is needed

Virtual machine Consolidation Needed status.
Virtual Machine disks consolidation is needed.

Contents:
  • How to Consolidate Disks in VMware?
  • Disk Consolidation File Lock Errors
  • Consolidate VM Snapshots with PowerCLI

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 free space on the VMFS datastore to perform consolidation, there must be at least 1 GB free (see how to increase VMFS datastore capacity in VMware ESXi);
  • Snapshot files are locked by vSphere or a third-party app (typically by a backup app, such as HP DataPtotector, Veeam, or Netapp VSC). Make sure there are no running VM backup processes;
    The problem can be caused by adding VM disks (hot-add) to the backup appliance when performing backups. In some cases, you need to manually disconnect the virtual disks of problematic VMs in the backup appliance settings (this happens in Veeam Backup Proxy, Symantec NetBackup, and CommVault Media Agent).
  • A VM has more than 32 snapshots (the maximum number recommended by VMware);
  • The background process of large snapshots consolidation has been launched;
  • Connection problems (possibly temporary) between the vCenter server and the ESXi host.

How to Consolidate Disks in VMware?

To fix the error ‘Virtual machine Consolidation Needed’, right-click on the virtual machine and select VM -> Actions -> 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 process can take a long time depending on the size of the VM, the number of snapshots, and the current host/datastore load. During consolidation, VM performance may degrade. Wait for the “Consolidate virtual machine disk files” task to complete.

consolidating vmdisks vsphere

When consolidation is performed, data from the delta disks are merged with the main disk and unnecessary files on the storage are removed. After that, the warning of the VM consolidation will disappear.

Disk Consolidation File Lock Errors

In some cases, when performing a 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.

or

Consolidate virtual machine disk files - Unable to access file since it is locked.

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 restarting Management agents on the ESXi server. To do it, connect to the ESXi host via SSH and run this command:

services.sh restart

restart Management agents on esxi: services.sh restart

If this doesn’t help, check who has locked the virtual machine files.

  1. Go to the VM directory on the VMFS datastore: # cd /vmfs/volumes/xxxxxx-xxxxxx-xxxx-xxxxxxx/WINSRV1
  2. List locked VM files and which ESXi hosts hold these files: # for i in `ls`; do vmfsfilelockinfo -p $i ;done|grep 'is locked in\|Host owning the lock\|Total time taken' | sed 's|Host owning the lock on file is||g'|sed 's|Total time|---|g' | awk '{print $1}' |uniq
  3. The previous command will return something like this:
    ---
    "WINSRV1-bf11abd3.vswp"
    Esxi01,
    ---
    "WINSRV1-flat.vmdk"
    Esxi02,
    Esxi01
  4. In this example, you can see that the WINSRV1-flat.vmdk file is locked by two hosts. To release the file lock from the second host, connect to Esxi02 via SSH and run the commands:
    # /etc/init.d/hostd restart
    # /etc/init.d/vpxa restart
  5. Run the consolidation from the vSphere Client interface.

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

  1. Shutdown the VM if it is possible;
  2. Create a new snapshot;
  3. Remove all the VM snapshots using the ‘Delete All’ option;
  4. Move running VM to another ESXi host using vMotion;
  5. Try to consolidate snapshots as described above.

vmware vm: delete all snapshots

If the Consolidate option is inactive in the VM menu (grayed out button), and there are still a large number of delta snapshot files in the datastore, the integrity of the snapshot chain is most likely broken (error: Unable to enumerate all disks).

consolidate option grayed out (inactive) in vmware virtual machine

Try to manually remove the VM from the list (Remove from Inventory) and re-register the VMX file of the virtual machine from the Datastore Browser. If this doesn’t help, check and fix the errors in the snapshot chain as described here: The parent virtual disk has been modified since the child was created (https://kb.vmware.com/s/article/1007969).

Consolidate VM Snapshots with PowerCLI

You can find all virtual machines that require consolidation using PowerCLI (this module allows you to manage VMware infrastructure). To do it, connect to your vCenter server or ESXi host:

Connect-VIServer mun_vsphere.woshub.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 virtual machines in the list:

Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded} | foreach {$_.ExtensionData.ConsolidateVMDisks_Task()}

ConsolidateVMDisks using vmware powercli

You can automatically consolidate VM snapshots older than 30 days using the following PowerShell script:

$VMName = Get-VM | Get-Snapshot |
Where {$_.Created -lt (Get-Date).AddDays(-30)} | select VM |
ForEach-Object {
$VMName.ExtensionData.ConsolidateVMDisks()
}

0 comment
5
Facebook Twitter Google + Pinterest
PowerShellVMware
previous post
How to Fix the ‘Too Many Open Files’ Error in Linux
next post
How to Enable and Configure SSH Server on Windows with OpenSSH

Related Reading

How to Fix ‘An Operating System Wasn’t Found’...

August 24, 2023

Configuring iSCSI Datastore (LUN) on VMware ESXi

March 15, 2024

Adding Drivers into VMWare ESXi Installation Image

March 13, 2024

How to Install Free VMware Hypervisor (ESXi)

March 17, 2024

Windows Cannot Find the Microsoft Software License Terms

April 19, 2023

Unmounting an NFS Datastore from VMware ESXi

March 12, 2024

How to Access VMFS Datastore from Linux, Windows,...

March 11, 2024

Using iPerf to Test Network Speed and Bandwidth

March 12, 2024

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Encrypt Any Client-Server App Traffic on Windows with Stunnel

    June 12, 2025
  • Failed to Open the Group Policy Object on a Computer

    June 2, 2025
  • Remote Desktop Printing with RD Easy Print Redirection

    June 2, 2025
  • Disable the Lock Screen Widgets in Windows 11

    May 26, 2025
  • Configuring Windows Protected Print Mode (WPP)

    May 19, 2025
  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)
  • How to Download Offline Installer (APPX/MSIX) for Microsoft Store App
  • How to Delete Old User Profiles in Windows
  • Fix: Remote Desktop Licensing Mode is not Configured
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • Configuring Port Forwarding in Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top