VMware Snapshot Guide: 8 Tips & Tricks
Snapshots are a convenient way to get a “moment in time” copy of your virtual machines. They should not be used as a primary method of backup, as they generally work as a record of changes made—they depend on the original virtual machine in order to roll back. They’re great for testing as they save the virtual machine settings, the state of the virtual disks, and the contents of memory, if you choose.
Using snapshots as backups is risky because the longer the time period between snapshots, the more likely the change record will be too great for the restore to work properly. In addition, if your base disks are damaged or access is lost, the restore will fail. Keeping many snapshot copies is a great way to run up your cloud bill, to boot.
Snapshots are useful before you make significant configuration changes, upgrades, patches, or new software installations. Any time you’re adding or changing your virtual environment enough to think, “Hmm, I wonder if this will affect my production applications,” it’s probably an opportune moment to take a snapshot.
Here are eight tips to make the most of your snapshots.
1) Allocate at least 20-30% extra storage per snapshot
Snapshots don’t take up as much disk space as your complete VM, since they only record the state of the machine, but they can easily balloon in size as those changes proliferate. A solid starting point is to add 20-30% extra disk space for each snapshot—but you might want enough space for an entire second VM, or 100% of the original.
2) Delete old snapshots on a regular schedule
Every time you make a snapshot, the previous snapshots become read-only. Meanwhile, as changes are made to the VM, the snapshot file size increases. The larger the snapshot, the more at risk your virtual data center will be.
It is not recommended to keep snapshots longer than your regular backup window. Once your entire system is backed up, there is little need for your backup. Remember, backups are ideally used for short-term rollback situations.
3) Deleting snapshots takes up significant resources
Storing snapshots and keeping them in action obviously will use up disk space and processing and memory power. But deleting them is also a major I/O suck. When deleting snapshots, start with the oldest and delete the change files going forward in time.
If you are performing a bulk delete, try and schedule it during a period when you need less compute resources in your virtual data center or on the original VM, as bulk delete can add significant stress to your system.
4) Consider backing up before you take a snapshot
If you’re performing a risky operation like a major database upgrade, you probably want to go ahead and perform a complete backup before starting. Then take a snapshot as you begin maintenance. This is especially wise if you haven’t backed up recently. The change file will become quite large and place undue strain on your VM if you only use the snapshot while making significant changes, patches, upgrades, or installations.
5) Avoid using active snapshots while defragmenting
All of those disk changes during the defragmenting process will copy to the snapshot file, creating an I/O nightmare and chewing through your disk space. This could easily lead to a snapshot that is the size of your entire VM.
6) Draft a snapshot policy for your entire admin team
Snapshots can easily grow out of control and impact not only an individual VM’s performance, but the entire virtual datacenter. A snapshot policy can help your team avoid these issues. This should include a daily snapshot check that ensures snapshots do not run longer than 24 hours, or at least not longer than your backup intervals.
A snapshot policy should include what types of VMs should or should not have snapshots applied, which applications are higher or lower risk, the backup schedules for each VM, and alarm configurations to help avoid snapshot sprawl.
7) Set and configure vSphere alarms for snapshots
You can set custom alarms for snapshots to ensure they don’t grow too large, or to tip you off when they consume a certain amount of resources.
8) Be cautious snapshotting databases or mail servers
If you have to roll back on a snapshot of a database or mail server, it can very easy to lose the changes made in the interim. You may also lose configuration changes or have to reseed your database. If you must take a snapshot of your mail server, shut it down first.
Snapshots are handy, but should largely be used as a temporary archive of your VM settings and data. A complete cloud backup or disaster recovery plan is essential if you want to maintain availability of the entire VM, configurations, and storage. In the meantime, these tips will help you avoid performance issues while using snapshots in your VMware cloud environment.