VMware snapshot tools help admins keep a trim virtual environment

Snapshots in your vSphere environment weren't meant to last forever. Here's how to ferret them out before they drag your virtual infrastructure down.

Administrators have to be vigilant to ensure complex virtual environments run at required performance levels. While

a VMware snapshot file is handy for restoring a virtual machine if an update goes awry, letting a snapshot linger in your system means it will slowly eat away at storage space and VM performance. There are several tools are available for you as a virtualization administrator to find VMs in their vSphere environment that contain snapshots and their respective file sizes.

Uncover the anatomy of a VMware snapshot

First, let's look at a VM's snapshot files to identify what happens when creating a snapshot.

VM delta files and operating system disks
Figure 1. The two disks and their delta files on the VM.

The VM in Figure 1 has two disks: Win2008-02.vmdk is the operating system disk, a thin provisioned disk about 8 GB on the file system; and Win200802_1.vmdk is the data disk, which is also thin-provisioned and about 74 GB in size. At the bottom of the list are the two delta files for these disks. These delta files are the snapshots of your VM that are recorded when a change is made in the operating system disk or the data disk. For the operating system disk, the delta file size is 17 MB. For the data disk, the delta file is 246 MB.

While there is no problem currently with the VM, the snapshot should not be kept for too long or it will consume more space, leading to a loss in performance. VMware recommends that admins delete snapshots that are more than 72 hours old to prevent them from getting too large.

Use vSphere Web Client to display file sizes

You can verify how much disk space is being used by VMs for an entire data center in the Storage Reports menu in the vSphere Web Client.

VM snapshot space displayed in the vSphere Web Client
Figure 2. The vSphere Web Client storage reports menu.

You can configure the columns to show the disk space and the snapshot space. To enable or disable columns, right-click the column headers in the report (Figure 2). The bottom of the menu shows when the numbers were generated and is updated hourly. Click the refresh icon to get more accurate numbers.

Trigger alarms when snapshots grow

To configure an alarm when snapshots pass a threshold, go to vCenter or another object in the inventory in the vSphere Web Client, click the Manage tab and select Alarm Definitions. Click the plus icon to add a new alarm. Choose the default selection for VMs to monitor for specific conditions or state.

Next, add a trigger named VM Snapshot Size and specify a value for a warning or critical condition, or both. In this menu, you can set up an email to be sent when the critical threshold is reached. If you do not specify an action, the alarm just displays in the client.

Setting a warning for snapshot space
Figure 3. A warning is generated when the snapshot space passes 1 GB.

In this example, if the snapshot space passes the 1 GB threshold, a warning will be generated. Then an alert will be generated when the snapshot space crosses the 2 GB boundary. (Figure 3)

Finding VMs with snapshots in vCenter Operations Manager

The disadvantage of using storage reports to find VMs with snapshots is that it has to be done for each data center, which can be time-consuming for admins who maintain multiple data centers.

Heat map configuration in vCOps
Figure 4. Configuring a heat map for VM snapshots in vCenter Operations Manager.

With vCenter Operations Manager (vCOps), you can create a view of your entire virtual environment. That can be done by creating a custom heat map -- not available in the Foundation edition -- by logging into the vCOPs administration portal and browsing to the Analysis tab. Click the Customize button in the upper-right corner and create a heat map. (Figure 4)

Choose a free tool to find snapshots

In addition to the standard vSphere features for finding snapshots, there are third-party utilities that can do the job in a more streamlined fashion.

RVTools is a free utility to check snapshot details
Figure 5. RVTools displays details about the snapshot, including file size and when the snapshot was created.

One of the easiest utilities to use is the free RVTools. Connect the tool to your vCenter server, then click the vSnapshot tab to access a list of all the VMs with snapshots, along with such details as when the snapshot was created and its size. (Figure 5)

Use PowerShell to dig out snapshot information

Administrators who use scripting to monitor their environments can use PowerShell cmdlets to gather information about snapshots and manage them with PowerCLI.

In PowerCLI, connect to a vCenter server with the Connect-VIServer command, then use the following command to list all your virtual machine snapshots:

get-vm | get-snapshot | format-list

Using PowerShell to display VM snapshot details
Figure 6. A shell display of VM snapshot information.

The output -- shown at the top of Figure 6 -- is just a dump of all the information in your shell. In this example, it is only one snapshot, but if you have many VMs with snapshots, it might not be a useful thing to do without formatting. Use the following command to create a less verbose listing -- shown at the bottom of Figure 6 -- showing when the snapshot was created and its size:

get-vm | get-snapshot | format-table created,VM,@{label="Size in GB";Expression={"{0:N2}" -f (
$_.SizeGB)}}

Remember to delete snapshots

The task of deleting snapshots is straightforward. In either the vSphere Client or the vSphere Web Client, right-click the VM and select Manage Snapshots to access the SnapShot Manager and delete the snapshot.

Normally, you would create one or a few snapshots to restore a VM in case an upgrade or a patch caused problems. But there are some administrators who may create a daily snapshot, which will fill up disk space.

If you have a large number of snapshots or a very large delta file, it's faster to power off the VM, clone it to a new VM, then delete the old VM with the snapshots.

This was first published in December 2013

Dig deeper on Troubleshooting VMware products

0 comments

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:

SearchServerVirtualization

SearchVirtualDesktop

SearchDataCenter

SearchCloudComputing

Close