Snapshots are not backups

Posted On 2011-11-21 by FortyPoundHead
Tags: VMWare Products Tip Tutorial ESX
Views: 1162

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:

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
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 the Author

FortyPoundHead has posted a total of 1974 articles.


Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Recent Forum Posts

New security implemented
dwirch posted on July 23, 2017 at about 6:58 in Site News

Fold Code Manager into main KB?
VB6Boy posted on July 22, 2017 at about 14:42 in Site News

Fold Code Manager into main KB?
dwirch posted on July 22, 2017 at about 14:41 in Site News

Fold Code Manager into main KB?
dwirch posted on July 21, 2017 at about 22:46 in Site News

Fold Code Manager into main KB?
dwirch posted on July 20, 2017 at about 7:55 in Site News

Job Spammer: Sam Mallon
dwirch posted on July 18, 2017 at about 18:36 in Spammers