Search Tools Links Login

Snapshots are not backups


VMWare administrators everywhere are familiar with the concept of snapshots. Snapshots can be real life savers! Right before performing a big upgrade or patch, or some other maintenance, you can take a snapshot of the virtual machine. If things go awry, you simply revert to the snapshot, with no hard feelings.

However, some folks seem to think this snapshot business is a valid backup process. It's not! This was simply a way for you to cover your butt while performing maintenance. Backups should be used to safeguard your data. Using this as a backup is asking for trouble.

The first thing that you'll notice is the shrinking amount of space on your datastores. Snapshots take room! Each time you take a snapshot, the complete machine state is saved. This means memory, devices, and disks.

Remember the 10\% rule? Keep 10\% of each datastore free? If you have given your junior admins or application support personnel the ability to take snapshots, they may not have the knowledge of repercussions that will be experienced by low disk space issues, because they don't know about the 10\% rule.

So as time goes by, your stores are getting smaller, because people have been happily taking snapshots, and forgetting to remove them after upgrades or patches are verified. Space is getting tight.

The first thing you've got to do is find the snapshots. Virtual Center does not provide a very easy way to find which machines which contain snapshots.

One method is to SSH to one of your hosts, switch over to the VMFS\Volumes directory, and simply recursively search the folders for *.vmsn files. This might work well if you have a small number of volumes. Didn't work for me on ESXi, though. Seemed to take a super long time to search the directories.

So how do we get the list of what machines have snapshots, in an expedient manner?

Remember way back when you first installed Virtual Center? Think about it. One of the requirements of Virtual Center is SQL. Aha! As luck would have it, when you take a snapshot of a virtual machine, the information about that snapshot is stored within the Virtual Center database. It's just a simple matter of getting it out!

By carefully crafting a SQL query, you can get the snapshot information out in about one second. Here is mine:

select
ENT.Name as 'Name',
VM.FILE_Name as 'VMX location',
VMS.Snapshot_Name as 'Snapshot Name',
VMS.Snapshot_Desc 'Snapshot Description',
DateAdd(Hour, 10, VMS.Create_Time) as 'Snapshot Time' from vpx_vm VM
inner join VPX_ENTITY ENT on VM.ID = ENT.ID
inner join VPX_SNAPSHOT VMS on VM.ID = VMS.VM_ID
order by 'Snapshot Time' ASC;

By running this query against my Virtual Center database in SQL Management Studio, I get a nice little table that shows me which machines have a snapshot, what datastore holds that snapshot, the description of the snapshot, and the date/time of the snapshot with the oldest on top.

Nifty, eh? Armed with this information, I can quickly find the machine in Virtual Center, open the Snapshot Manager, and remove the snapshot. Booyah! Half a day recovered.

Got a better way? Please share!

About this post

Posted: 2011-11-21
By: FortyPoundHead
Viewed: 1,471 times

Categories

Tip

Tutorials

VMWare Products

ESX

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.