VMware Snapshot Consolidation | What, When & How

Do you know that you still need to perform VMware snapshot consolidation after the failure of reverting or deleting a snapshot? Do you know what’s the difference between snapshot consolidation and deletion? This article will introduce it to you in details.

By @Crystal Last Updated March 8, 2023

What is snapshot consolidation

Snapshot consolidation is used to merge the snapshot delta disk files to the VM base disk.

In vSphere 5, VMware introduced the Consolidation option, which is used when the associated disks are not committed back to the base disk after you revert or delete VMware snapshots.

If the option “consolidate snapshots” is greyed out, you may have an active task running on the VM now.

 VMware consolidate snapshot vs delete snapshot

Deleting a snapshot: You will merge the data written to the snapshot’s delta disk files to the VM base disk, and remove the snapshot from the snapshot chain.

Consolidating a snapshot:

You will remove redundant delta disk files that are left over from failed snapshot restore, delete, or delete all operations. It can improve the VM performance and save storage space.

Space & time requirements of snapshot consolidation

  • Snapshot consolidation space requirement

Snapshot consolidation does not require additional free disk space if all VM disks are thick provisioned. But if your VM disks are thin provisioned, it may require up to the same size of free space as the snapshot size.

  • How long does snapshot consolidation take

In general, the larger the snapshot is, the longer the snapshot consolidation process will take.

But it is not easy to determine exactly how long it will take. Many other factors may affect it directly or indirectly, including the depth of the virtual disk snapshot chain, the type of data, the storage array performance, etc.

You can estimate the time required for snapshot consolidation by monitoring the throughput on the datastore, monitoring throughput for snapshot consolidation only, or estimating the time on a test VM. For more you can refer to VMware’s official tutorial: Estimate the time required to consolidate virtual machine snapshots

When to perform snapshot consolidation

If a VM requires snapshot consolidation, you will get a VMware error: virtual machine disks consolidation is needed to inform you that there are redundant delta disk files.

The most typical reasons for ‘virtual machine disks consolidation is needed’ error:

  • Snapshots failed to be consolidated after completing backups.
  • There is no free space on the datastore to perform consolidation.
  • Third-party backup application is performing backups thus locked snapshot files.
  • vCenter server and the ESXi host connectivity issues.
  • You have too many snapshots (up to 32 recommended by VMware).
  • You have one large snapshot is consolidating now.

How to perform snapshot consolidation

To solve the VMware error: virtual machine disk consolidation is needed, you just need to perform the snapshot consolidation as required. In addition, it can further save storage space and improve VM performance.

In this section, I will introduce 3 different ways to consolidate snapshot.

How to perform snapshot consolidation via ESXi web client

1. Access the VMware ESXi web client, and navigate to Virtual Machines tab.

2. Right-click on the VM name and select Snapshots > Consolidate disks.

How to consolidate snapshot via PowerCLI

  • Check which VM needs snapshot consolidation:

Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded}

  • Consolidate snapshot of a specific VM:

(Get-VM -Name "MyVM").ExtensionData.ConsolidateVMDisks()

  • Consolidate snapshots of all VMs that need it:

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

How to monitor snapshot consolidation status

1. Open an SSH shell session to the host that is performing the consolidation and snapshot deletion task by running the following vim-cmd command:

vim-cmd vimsvc/task_list

2. Run the following command in the SSH shell:

vim-cmd vimsvc/task_info haTask-9-vim.VirtualMachine.removeAllSnapshots-304060994

If the snapshot consolidation is successfully completed, it will show the text: state = "success".

The reasons why snapshot consolidation failed and solutions

If you encounter the VMware error: An error occurred while consolidating disks. Here are the possible reasons and their solutions:

  • Failed to lock the file or one or more disks are busy – identify the existing locked file and remove the lock
  • A required file was not found – you may rename the specified file or accidentally deleted snapshot, you can rename the file back, or recover the deleted snapshot
  • Input/output errortroubleshooting connectivity of LUN, fibre channel storage, iSCSI arrays, and NFS datastore.
  • The content ID of the parent virtual disk does not match the corresponding parent content ID in the childcorrect the CID of the disks reference each other using text editor.
  • The free space is not enoughfree space on the datastore
  • msg.snapshot.error-FALL – consolidate the disks manually

Backup VMs to protect data, instead of taking snapshots

As you can see, taking too many snapshots, or keeping them for long can both lead to many errors, even data loss. This is because the snapshots are dependent on the parent disks.

Therefore, snapshots are often used as quick failsafe before performing development or testing, capable of rolling back in case of any problem. But if you want a VM data protection measure in production environments, it is much better to take a VM backup than a snapshot.

A virtual machine backup is an independent copy of the VM that can be safely stored offsite, cloud, or other locations. By restoring from a VM backup you will get an instantly usable VM.

Here I recommend you a professional and free VM backup software, AOMEI Cyber Backup for the following benefits:

3-Step Quick Backup: with 3 easy steps you can quickly create a complete automatic backup task of multiple, or even all VMs on the host. Backup Schedule: capable of auto backup virtual machines on a daily, weekly, monthly schedule. Restore Entire VM: capable of restoring the entire VM from any backed up history versions.

It supports both paid and free versions of VMware ESXi and Hyper-V. You can click the following button to download and enjoy this perpetual free edition:

Download FreewareVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

Summary

If you encountered the VMware error: virtual machine disks consolidation is needed, it is informing you that you need to perform snapshot consolidation manually after the snapshot revert, delete, or delete all operations.

In this article, I introduced what is VMware snapshot consolidation, when and how you can perform it on your VMs, analyzed the reasons why the snapshots consolidation fails and the relevant solutions.

Snapshot consolidation often fails because of the improperly usage of VM snapshots. therefore, please do not keep snapshot for long, or take too many snapshots. Most importantly, please do not take VM snapshot as backup.