KB
Virtualization

VMware Snapshot Management

6 min read1211 words14 code blocks

At a glance#

  • Purpose: Take, verify, consolidate and remove VM snapshots safely, and recover from snapshot-related datastore problems.
  • Applies to: VMware vSphere 7.0 and 8.0.
  • Risk: High — forgotten snapshots fill datastores and can halt every VM sharing them.
  • Time: 10 minutes to take; consolidation can run for hours.

Overview#

A snapshot freezes a VM's disk at a point in time and redirects all new writes to a delta file. It is the standard safety net before a patch, upgrade or risky change.

It is not a backup. A snapshot depends on the original base disk — if that is lost or corrupted, the snapshot is worthless. It protects against a bad change, not against storage failure.

Warning: Snapshots grow without limit until the datastore fills. A full datastore suspends every VM on it, not just the one with the snapshot. This is the most common self-inflicted production outage in a virtual estate.

Key facts:

  • Delta files grow with write volume, not VM size. A busy database can add hundreds of GB in a day.
  • Performance degrades as the chain lengthens. Never exceed 2–3 snapshots per VM.
  • Snapshots of VMs with independent or RDM disks do not capture those disks.
  • Deleting a snapshot commits its changes — it does not discard them. Reverting discards.

Policy#

RuleValue
Maximum age72 hours
Maximum per VM3
Memory snapshotsOnly when a rollback must preserve running state
NamingCHANGE-REF - purpose - your name
Before takingConfirm the datastore has free space of at least the VM's provisioned size

Before you start#

  • vCenter access with snapshot privileges.
  • Datastore free space checked.
  • A named reason and a planned removal time.

Check free space first:

powershell
Get-VM 'web01' | Get-Datastore |
  Select-Object Name, @{N='FreeGB';E={[math]::Round($_.FreeSpaceGB,1)}},
                      @{N='FreePct';E={[math]::Round(($_.FreeSpaceGB/$_.CapacityGB)*100,1)}}
Warning: Do not take a snapshot when the datastore is below 20% free. Consolidation itself needs working space, so a low-space datastore can leave you unable to remove the snapshot you just created.

Taking a snapshot#

vSphere client#

Right-click the VM → Snapshots → Take Snapshot

  • Name: CHG-1042 - pre kernel patch - anup
  • Description: what is being changed and how to roll back
  • Snapshot the virtual machine's memory: usually unticked
  • Quiesce guest file system: ticked if VMware Tools is installed and the VM runs a database

PowerCLI#

powershell
New-Snapshot -VM 'web01' `
             -Name 'CHG-1042 - pre kernel patch - anup' `
             -Description 'Rollback point before kernel 5.15 upgrade. Remove by 2026-08-05.' `
             -Quiesce

With memory state, for a rollback that must resume mid-operation:

powershell
New-Snapshot -VM 'web01' -Name 'CHG-1042' -Memory
Note: Memory snapshots take much longer, briefly stun the VM, and consume space equal to its allocated RAM. Only use them when the guest cannot be cleanly restarted.

Finding and reporting on snapshots#

The report that prevents outages. Run it weekly at minimum:

powershell
Get-VM | Get-Snapshot |
  Select-Object VM, Name, Created,
    @{N='AgeDays';E={[int]((Get-Date) - $_.Created).TotalDays}},
    @{N='SizeGB';E={[math]::Round($_.SizeGB,2)}},
    Description |
  Sort-Object AgeDays -Descending | Format-Table -AutoSize

Only those breaching the 72-hour policy:

powershell
Get-VM | Get-Snapshot |
  Where-Object { $_.Created -lt (Get-Date).AddHours(-72) } |
  Select-Object VM, Name, Created, SizeGB |
  Sort-Object Created

Total space consumed by snapshots:

powershell
$total = (Get-VM | Get-Snapshot | Measure-Object -Property SizeGB -Sum).Sum
"Total snapshot space: {0:N1} GB" -f $total

Removing a snapshot#

Removing commits the delta into the base disk. The VM keeps all changes made since the snapshot was taken.

vSphere client#

Right-click VM → Snapshots → Manage Snapshots → select → Delete

Delete All consolidates every snapshot in the chain and is normally what you want once a change is confirmed good.

PowerCLI#

powershell
# one snapshot
Get-VM 'web01' | Get-Snapshot -Name 'CHG-1042*' |
  Remove-Snapshot -Confirm:$false

# all snapshots on a VM
Get-VM 'web01' | Get-Snapshot | Remove-Snapshot -Confirm:$false

# everything older than 7 days - review first
Get-VM | Get-Snapshot |
  Where-Object { $_.Created -lt (Get-Date).AddDays(-7) } |
  Remove-Snapshot -WhatIf
Warning: Run bulk removal with -WhatIf first, every time. Removing snapshots across the estate simultaneously generates heavy storage I/O and can affect production performance.

Removal is not instant. A large delta can take hours, and the VM may become sluggish while it runs. Schedule it outside business hours.

Reverting to a snapshot#

Reverting discards everything since the snapshot was taken.

powershell
Set-VM -VM 'web01' -Snapshot (Get-Snapshot -VM 'web01' -Name 'CHG-1042*') -Confirm:$false
Warning: Every change since the snapshot is lost — including database writes, log entries and received mail. On a mail or database server, reverting is almost never the right answer. Confirm with the service owner first.

The VM is powered off during a revert unless the snapshot included memory state.

Consolidation#

vSphere sometimes leaves orphaned delta files after a failed removal. The VM summary then shows a "Virtual machine disks consolidation is needed" warning.

Find affected VMs:

powershell
Get-VM | Where-Object { $_.ExtensionData.Runtime.ConsolidationNeeded } |
  Select-Object Name

Consolidate:

powershell
(Get-VM 'web01').ExtensionData.ConsolidateVMDisks()

Or in the client: Right-click VM → Snapshots → Consolidate.

Note: Consolidation warnings are easy to ignore and should not be. The delta files are still growing, and the snapshot manager shows nothing — so the space disappears with no visible cause.

Verification#

After taking a snapshot:

powershell
Get-VM 'web01' | Get-Snapshot | Select-Object Name, Created, SizeGB

After removal, confirm none remain and no consolidation is pending:

powershell
Get-VM 'web01' | Get-Snapshot
(Get-VM 'web01').ExtensionData.Runtime.ConsolidationNeeded

The first should return nothing; the second should return False.

Confirm the datastore recovered its space:

powershell
Get-VM 'web01' | Get-Datastore | Select-Object Name, FreeSpaceGB

Check within the guest that the application is healthy after consolidation — heavy I/O occasionally upsets latency-sensitive services.

Emergency: datastore full because of snapshots#

If a datastore has filled and VMs are suspended:

  1. Identify the largest offenders.
powershell
Get-Datastore 'DS01' | Get-VM | Get-Snapshot |
  Sort-Object SizeGB -Descending |
  Select-Object -First 10 VM, Name, Created, SizeGB
  1. Free space immediately — migrate a powered-off VM to another datastore, or delete a known-disposable VM. Consolidation itself needs headroom.
  2. Remove the largest snapshot first. It reclaims the most and takes the longest, so start it early.
  3. Resume suspended VMs once free space is comfortable.
  4. Afterwards, set a datastore alarm at 80% and schedule the weekly snapshot report.

Troubleshooting#

SymptomCause and fix
Removal appears to hangNormal for large deltas. Check task progress in vCenter; do not cancel.
"Unable to access file since it is locked"Another task or a backup job holds the disk. Wait for it, then retry.
Consolidation needed but failsInsufficient free space. Free space on the datastore first.
Snapshot missing from Snapshot Manager but deltas exist on diskOrphaned deltas. Run consolidation.
VM very slow with a snapshot presentExpected — all writes go through the delta. Remove the snapshot.
Quiesce failsVMware Tools missing, outdated, or the guest has no VSS writer. Snapshot without -Quiesce, accepting a crash-consistent copy.
Snapshot did not capture a diskThat disk is independent or an RDM. Those are excluded by design.
Datastore full, VMs suspendedFollow the emergency procedure above.