Essential Guide

Top tools and techniques for VMware automation

A comprehensive collection of articles, videos and more, hand-picked by our editors
Q

How to automatically consolidate VMware snapshots in vSphere 5

IT admins sometimes create and delete VMware snapshots for recurring tasks. Two experts suggest ways to consolidate VMware snapshots automatically.

Is there a way to consolidate VMware snapshots automatically?

IT Knowledge Exchange user MasterJohn has to generate snapshots for a specific task once a week. He recently asked if there is a way to automatically consolidate VMware snapshots in vSphere 5. Contributors Mike Nelson and Brian Knudtson suggest two options.

VMware snapshots copy a virtual machine disk file (VMDK), preserving the disk file system and system memory to prevent losses in the event that something goes wrong. IT admins initiate VMware delete snapshot operations, which consolidate snapshots back to the parent VMDK via the vSphere Client or the vmware-cmd command-line utility. If consolidations don't occur, snapshots can rapidly eat up space on a data store.

Knudtson doubts automation is an option within the VMware vSphere 5 client. He suggests using a scheduled script or an orchestration engine (e.g. vCenter Orchestrator) to accomplish the weekly automated snapshot consolidation. Nelson agrees, pointing to the commands and methods for vCenter Orchestrator in the "VirtualMachine" object of VMware's support documentation.

Consider using VMware vSphere PowerCLI, a command-line tool for controlling VMs, networking, storage and more, Nelson advises. PowerCLI from the client could be run as an automated, scheduled task once a week for MasterJohn's task. Nelson recommends using the command $VM.ConsolidateVMDisks_Task() for consolidating snapshots.

VMware users are an active community and, as Nelson points out, can "whip up a script" in no time at all. He suggests these additional resources:

  • VNoob blogs about consolidating disks and orphaned snapshots with PowerCLI; and
  • Members of the PowerCLI community on VMware's website can suggest smart scripts, such as in this thread about automating snapshot deletions.

Have your own answer? Share it with MasterJohn on the IT Knowledge Exchange (ITKE).

Have a question for our experts? Post it to ITKE or email the editor directly at editor@searchvmware.com.

Crash course on VMware snapshots

This was first published in October 2012

Essential Guide

Top tools and techniques for VMware automation

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

1 comment

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchVirtualDesktop

SearchDataCenter

SearchCloudComputing

Close