Virtualization has several significant benefits over a standard physical server. One of the beneficial features of virtualization with VMware is called snapshotting. The convenience of snapshots comes into play frequently when working with virtual machines. It allows software patching, configuration changes, and any change to the guest operating system while still allowing the user to revert back any changes that may have had an undesired effect on the virtual machine. It is an instant rollback plan to any problems that you may encounter after making changes.
How Does a Snapshot Work?
A snapshot keeps track of a point in time of the virtual disk. When a snapshot is created on a virtual machine it saves that point in time and keeps track of all changes made after that point in time. If it is decided that it is necessary to revert back for any reason, a simple click on “revert to previous snapshot” allows for continuation from the exact location where the snapshot had been created. It even has the option of taking a snapshot with memory. This allows for restoration of a virtual machine to its exact running state, and does not require a reboot. If the virtual machine has been running with no problems, and there is no reason to rollback, the snapshot may be deleted. Deleting the snapshot takes all of the changes that have been made since taking the snapshot and commits them to the virtual disk used by the virtual machine.
Snapshots versus Nightly Backups
The process of taking a snapshot does not interrupt the virtual machine at all. It simply takes a point in time and records any changes after it. However, there can be a small disk hiccup when removing the snapshot. This is completely dependent on the virtual machine and the amount of time the snapshot has been saved. The issue that makes snapshot removal potential disruptive is the amount of changes made. On write-intensive SQL servers, a snapshot is likely to cause a disruption because of the significant amount of changes on the machine. If the server has very little written to the disk from the time of the snapshot and the time of the removal, there will not be a noticeable disruption of the virtual machine. This is what makes snapshots so great for quick changes or updates! Having to rely on a nightly backup for your failback plan can turn a simple configuration change or update into a major headache. It requires verification that the backup is functional and that no data has been written to disk since the time of the last backup.
Getting the Most out of Snapshots
Keep snapshots to a minimum. Holding onto a snapshot for an extended period of time is not advised as a snapshot has to keep the virtual disk as it was during the time of the snapshot and it has to both save the initial data and the change data. This means that the longer the snapshot is there, or the more data that is written with a snapshot taken, the more storage space the virtual machine will consume. As mentioned before, it also causes more of a disruption to the virtual machine when removing it. It is recommended to keep a snapshot no longer than one week. Typically it is proven safe to remove after a business day or less, but there can be situations where a few days may be necessary to determine if it is safe to remove the snapshot. Keep in mind that at that point it should be expected there will be a small disruption of service when removing it. Also, keep in mind that a backup should be in place, perhaps nightly, that is available for a restore. If a successful backup has been completed after taking a snapshot, it is advised to remove the snapshot to save on storage space and snapshot removal time. While snapshots certainly have a few caveats to pay attention to, their usefulness for quick changes is a huge benefit to virtualization. Just remember to keep them a short time and be mindful of any disruptions that may be experienced during removal.