Check for Orphaned Veeam Temporary Snapshots

0

For those using Veeam Backup & Replication in a vSphere environment perhaps backing up hundreds of virtual machines one of the important housekeeping items you may want to keep a check on is any Veeam temporary snapshots that may for whatever reason been left over from a backup run. I have seen cases where temporary snapshots get leftover for any number of reasons but typically there is a reason why the temporary snapshot doesn’t get deleted. This can cause issues down the road as any snapshot left running in production can deteriorate performance, and cause issues. It can also cause issues with future Veeam backups on a particular virtual machine. Thankfully, using PowerShell, we can quickly find a Veeam snapshot that might be leftover from a run that did not cleanly finish. Let’s look at how to check for orphaned Veeam temporary snapshots with PowerShell PowerCLI.

What causes the orphaned Veeam Temporary Snapshots?

When Veeam Backup & Replication starts the backup or replication job, it creates the “VEEAM BACKUP TEMPORARY SNAPSHOT”. According to an official Veeam KB article found here, In some cases the API command to remove the temporary snapshot is not received or not executed. This can be due to network connectivity issues between the Veeam Backup & Replication server and the vCenter Server or between vCenter and the ESXi host itself.  Whatever the case, there is some interruption in the chain of commands that get communicated that prevents the temporary snapshot from getting deleted.

As shown below, the temporary snapshot size can be quite large on large disk layout virtual machines.

Veeam-Temporary-Snapshot-on-a-virtual-machine Check for Orphaned Veeam Temporary Snapshots

Veeam Temporary Snapshot on a virtual machine

Check for Orphaned Veeam Temporary Snapshots

Make sure you are running the latest version of PowerCLI.  In case you haven’t heard, there is a new way to install PowerCLI.  Once you have PowerCLI loaded and current with the latest version, you should be good to go.  The script is fairly simple and is just a modified version of checking for any snapshots with PowerCLI.  You can set the “OlderThan” variable with the number of days that you want to count back.  Any Veeam temporary snapshots should not hang around very long as these are created and deleted with each backup run.  So, if you check for any Veeam Temporary snapshots that are older than a day even, you should be able to catch any that may have not been properly deleted.

The script currently just outputs to a txt file but the output can be formatted and customized as needed.  With the output file, the script also has a section included that will email an attachment which is more helpful if you are scheduling it via a scheduled task, however, you can customize it as needed.

Thoughts on how to Check for Orphaned Veeam Temporary Snapshots

Keeping a check on snapshots in general in a vSphere environment is something that as vSphere virtualization administrators we do on a daily basis or at least fairly often.  If you are like me, having an automated mechanism to proactively discover and be alerted of existing snapshots is a much better way of handling discovering snapshot issues in an environment.  Most of today’s modern data protection solutions utilize temporary snapshots to be able to copy data while the virtual machine is running.  Keeping a check on these temporary snapshots ensures things will continue running smoothly.  In the case of Veeam, it is always a good idea to check for orphaned Veeam temporary snapshots and using PowerCLI takes the heavy lifting out of the process.