One of the common abuse of language in Virtualisation is the use of the term snapshot to designate a backup. Let me explain the fundamental difference between a virtual machine snapshot and backup.
Virtual machine snapshot
Both VMware and Hyper-V snapshots capture the state (eg. powered-on, powered-off, suspended), data (virtual disks, memory), and hardware configuration (eg. virtual network interface cards) of a running virtual machine.
What happened when a virtual machine is reverted to a previous snapshot?
The virtual machine is exactly as it was when the snapshot was taken: for example, it can be started with the RAM fully loaded. Applications which were running at the time the snapshot was taken, continue to run as before. This is one of the reasons why snapshot should not be used as a substitute for backup.
When should I use snapshot?
Taking a snapshot involves the creation of a file which records all the deltas (changes) of the virtual machine. This has an impact on performance. Basically, performance degrades as more snapshots are taken.
Virtual machine Snapshots should only be taken in a non-production environment where the software can be run from one single virtual machine which is not part of a farm. What I mean is that, depending on the application (Exchange, SharePoint, SQL Server…etc), reverting a virtual machine to a previous snapshot can cause the application to not being able to adjust to other tiers.
Every software has a different “adherence” between each of its tiers:
- web front-end
- applicative middle tiers
- database back-end
If everything is contained in one single virtual machine (eg. SharePoint and SQL Server), then this non-production environment can be snapshotted without any real inconvenient.
The ideal condition is to power off the virtual machine before taken the snapshot. On top of having a non-changing state, you will also save a lot of space as the RAM will not be saved.
Virtual machine backup
The most fundamental difference between virtual machine snapshot and backup is that:
- A virtual machine restored from a backup has to be started.
- A virtual machine reverted from a snapshot can already have a power on state.
The Microsoft Shadow Copy technology, also called Volume Snapshot Service (VSS), is a Windows Server data backup feature for creating consistent point in time copies of data.
Hyper-V has its own VSS writer while VMware uses its vSphere Data Protection.
Any third party backup product will use the APIs of one of those technologies in order to perform a virtual machine backup.
The backup should include the configuration, VM snapshots and virtual hard disks used by the virtual machine.
In the case of VMware, here are the main operations performed by a 3rd party backup product:
Backing up a VMware Virtual Machine
- Contact the server machine containing the target virtual machine.
- Command that server to produce a snapshot of the target virtual machine.
- Use the server to gain access to the virtual disk(s) and files in the snapshot.
- Capture the virtual disk data and virtual machine configuration information (vim.vm.ConfigInfo).
- Command the server to destroy the backup snapshot.
Restoring a VMware Virtual Machine
You can choose one of two restore scenarios:
To bring an existing virtual machine to a particular
- Contact the server and command it to halt and power off the target virtual machine.
- Use the server to gain access to the virtual disk(s).
- Transfer the image(s) of the disk(s) from the backup program.
To completely re-create a virtual machine
- Contact the server.
- Command the server to create a new virtual machine and its virtual disks using the configuration information in step 4 of the backup process above.
- Transfer the virtual disk data to the newly created virtual disk(s). This includes the virtual disk formatting information, so it is unnecessary to build any kind of file system on the virtual disk(s).
What’s important to remember?
Performing a VMware or Hyper-V virtual machine backup involves the use of the VM snapshot technology, however when it comes to restoring from a backup or reverting to a snapshot, things are different.
- Virtual machine restored from a backup will systematically need to be power on after restore.
- Virtual machine reverted to a previous snapshot can already have the power on state.
VMware VM snapshot: http://kb.VMware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1015180
Hyper-V VM snapshot: http://technet.microsoft.com/en-us/library/dd560637(v=WS.10).aspx
VMware backup: https://www.VMware.com/support/developer/vddk/vcb_vsphere_backup.pdf
Hyper-V backup: http://technet.microsoft.com/en-us/library/dd252619.aspx