Overview for VM snapshot vs backup
Virtual machine (VM) provides a secure sandbox environment for testing programs or accessing virus-infected data, the ability of not affecting physical machines has made it popular with businesses.
When using VMs, protecting data is one of the most important tasks. Virtual machine backups and snapshots are both common measures to ensure data security. But what is the difference between a snapshot and a backup, and how to use them properly? Many users have been troubled by this question. This article is mean to answer it.
What is virtual machine snapshot (VM snapshot)
A VM snapshot is an image that captures the complete state and data of a virtual machine at a specific point in time. The state includes the power state of the VM (powered-on, powered-off, or suspended), and the data includes all the files that make up the VM (disk, memory, and other devices). It is a quick and efficient way to roll back VM to a specific point in time, just like the undo function.
*In Microsoft Hyper-V environments, snapshots are also called checkpoints since Windows Server 2012 R2.
How do VM snapshots work
How do snapshots work exactly? When taking a VM snapshot, all writable data will become read-only. You can take multiple snapshots for restoring the VM to multiple points in time. VM snapshots are not standalone, but depend on the parent VM disk or snapshot chain, and incrementally record changes since the last snapshot.
When you create a snapshot for the first time, the first child disk is created from the parent disk. Successive snapshots generate new child disks from the last child disk on the chain. The relationship can change if you have multiple branches in the snapshot chain.
Creating a VMware snapshot, for example, you will create these files:
.vmdk file: a virtual disk file that contains the raw data in the virtual disk.
-delta.vmdk file: an incremental disk file that captures all changes made to the VM since the last snapshot was taken. It grows as the snapshot stays open and changes.
.vmsd file: a centralized file for storing information and metadata about snapshots.
.vmsn file: the snapshot state file that stores the current configuration and optionally the running state of a virtual machine.
These files are placed on the same storage infrastructure as the parent disks.
Note: Creating a Hyper-V checkpoint, you will create the following files:
- .vmcx file: the binary configuration file, that replaces the XML file found in 2012 R2 and earlier.
- .vmrs file: contains various information about the state of the running virtual machine.
- .vmgs file: used to store the virtual machine guest state in version 8.2 and higher Hyper-V virtual machines.
- .avhdx file: the differencing disk saves a specific state of virtual hard drive, used to make up a timeline with other .avhdx files in the chain. Once a checkpoint is deleted, the differencing .avdhx file is merged with the .vhdx file.
- .rct file: tracks change between backup operations, allows backup solutions to only have to copy the changes since the last backup.
- .mrt file: helps to provide resiliency in case of a host crash or BSOD of the host.
What is virtual machine backup (VM backup)
A VM backup is an independent copy of part or all of the data in VM, that is not dependent on the original VM. Therefore, VM backups can be safely stored offsite, to the cloud, or other locations. This is the most commonly used measure for VM data protection.
How do VM backups work
VM backups can be divided into 2 types depending on how they work: image-based and file-based backup.
Image-based backup is an image that captures the current state of the entire virtual machine, backing up the virtual machine's operating system, configuration files, and all data on disk.
File-based backups back up a virtual machine as if it were a physical machine by configuring an agent on the guest machine. You can choose what to back up yourself, but it only protects the operating system and applications, you can't restore the virtualized environment.
VM snapshot vs backup: what's the difference?
VM backup and snapshots can both be used to secure virtual machine data, but they work very differently. Many users have been confused by them. Therefore, in this section, I will analyze what are the differences between a snapshot and a backup.
|VM Snapshot||VM Backup|
|Data security||Snapshots depend on the parent disk. If the parent disk is deleted, the snapshot itself is not sufficient for VM restore.||VM backups are independent of the original VM, and can be safely stored offsite, to the cloud or other locations|
|Performance affecting||Not suitable for long-term preserve, for the incremental disk file grows and can take a lot of space, affecting the VM performance.||VM backups can be safely stored for long time without affecting VM performance.|
|VM Recovery||VM snapshots can only be used to roll back the original VM to the point of time the snapshot was taken||Backups can be used to create single or multiple new VM to original or different location, without the original VM.|
|Creating speed||Faster. It only captures the state and data at a specific point in time.||Slower. The more data is backed up, the longer the process takes.|
Can VM snapshot be used as backup?
The answer is NO. Snapshots can be used to roll back VMs, but cannot be used as backups.
As described above, a VM snapshot is dependent on the parent disk. If the parent disk is deleted or the virtual or physical infrastructure fails, the snapshot itself is not sufficient to restore the entire VM. A VM backup, on the other hand, is a complete copy independent of the parent disk, it will not be affected and can be used to restore the VM.
Besides, after taking a VM snapshot, all changes made to the VM will be stored in the incremental disk file. Therefore, the snapshot size can grow very large and take up a lot of disk space, and keeping them for a long time will affect the VM performance. You will need to perform snapshot consolidation to avoid performance penalties. Meanwhile, VM backups can be kept for a long time without affecting the original VM.
Based on these VMware snapshot disadvantages, we do not recommend it as regular backup means.
Proper use of VM snapshot & backup
◆ VM snapshots can work as quick failsafe before performing development or testing.
With them, you have the restore points to quickly roll back in case of any problem. Note that keeping snapshots for long time can affect the VM performance. VMware recommends using only 2-3 snapshots in a chain, and for single snapshots no more than 72 hours.
◆ VM backup is a comprehensive data protection measure for every situation.
While file-based backup is appropriate when you only need to back up a small amount of data on the VM, image-based backups are more complete and safer for disaster recovery. Implementing a proper automated backup strategy can maintain your business continuity, and go a step further in securing your VM.
◆ In practice, it is recommended to use VM snapshots in combination with backups.
VM snapshot can be used as a short-term, temporary rollback measure before unsafe operations, while VM backup can work as a long-term, stable VM protection for disaster recovery.
VM snapshots best practices (create, restore and delete)
After knowing what VM snapshots and backups are and their proper usage, now you can create them according to your actual needs. In this section, I will demonstrate the specific steps to create, restore and delete VMware ESXi VM snapshots as an example.
How to create VMware ESXi VM snapshots
1. Access VMware ESXi Web Client, and navigate to Virtual Machines. Right-click on the VM name and select Snapshots > Take snapshot.
2. Provide a Name and Description for this snapshot. And select to Snapshot the virtual machine’s memory, or Quiesce guest file system (needs VMware tools installed).
- Snapshot the virtual machine’s memory: record the VM’s memory, allowing you to roll back the VM to the exact running state when the snapshot was taken, but takes longer. If you leave this option unchecked, then the VM will be powered-off after you roll back.
- Quiesce guest file system (needs VMware tools installed): pause the state of the processes that are running, or may modify the information stored on disk when the snapshot was taken, to guarantee the consistency. Quiescing and Memory snapshots are mutually exclusive.
3. Click Take Snapshot to start. You can check the progress in Recent Tasks.
How to restore VMware ESXi VM snapshots
1. Right-click on the VM name and select Snapshots > Manage snapshots.
2. Select the target snapshot and then click Restore snapshot.
Tip: If you want to restore to the latest snapshot, right-click on the VM name and select Restore snapshot.
How to delete VMware ESXi VM snapshots
Deleting a snapshot will consolidate the changes to the VM and remove the snapshot. You should always remember to delete snapshots, when you want to keep the changes after the snapshot and will not restore to it.
1. Right-click on the VM name and select Snapshots > Manage snapshots.
2. Select the target snapshot and click Delete snapshot.
Tip: If you want to delete all snapshots you can click Delete all next to Delete snapshot, and click Remove on the pop-up alert.
VM backup best practices (scheduled backup and fast restore)
Actually, there is no real native backup feature for VMware ESXi VMs. The closest option may be exporting or downloading VM files in datastore, but they all require manual operations and can only copy one VM at a time.
Therefore, I introduce you to a free virtual machine backup software -- AOMEI Cyber Backup, to help you automatically backup multiple VMs at once. It supports both paid and free versions of VMware ESXi 6.0 and above, as well as Hyper-V of Windows Server 2012 R2 / Windows 8 and later versions.
✤Enjoy the following benefits:
Agentless Backup: create complete and independent image-level backup for VMware ESXi and Hyper-V VMs.
Multiple Storage Destinations: backup to local or network share destinations.
Automated Execution: create backup schedules to automate virtual machine protection.
Perpetual Free: you can use AOMEI Cyber Backup Free Edition with no time limit.
Next I will demonstrate how to backup and restore VMware ESXi VMs as an example. You can click the following button to download the freeware.
*You can choose to install this VM backup software on either Windows or Linux system.
3 simple steps to backup and restore VMware ESXi VMs
1. Bind Devices: Access to AOMEI Cyber Backup web client, navigate to "Source Device" > "VMware" > "+ Add VMware Device" to add vCenter or Standalone ESXi host as the source device, and then click "Bind Device".
2. Create Backup Tasks: Navigate to "Backup Task" > "+ Create New Task", and set "Task Name", "Backup Type", "Device", "Target", and "Schedule".
- Device: Select the VMs on the host that you want to backup.
- Target: You can select to back up to a local path, or to a network path. Used paths will be saved in Favorite Storage for handy selection.
- Schedule: You can choose to perform full, differential or incremental scheduled backup, and automate execution according to the frequency you specified.
Click "Start Backup" and select "Add the schedule and start backup now", or "Add the schedule only".
3. Restore VM from Backups: Click "…" > "Restore" on the left of the backup task to open the restore wizard, click "Select Content" to specify a recovery point, and then select to "Restore to original location". Click "Start Restore".
While the Free Edition covers most of VM backup needs, you can also upgrade to Premium Edition to enjoy:
▶ Batch VM Backup: batch backup large numbers of VMs managed by vCenter Server or standalone ESXi hosts.
▶ Backup cleanup: Configure a retention policy to auto delete old backup files and save storage space.
▶ Restore to new location: Create a new VM in the same or another datastore/host directly from the backup, saves the trouble of re-configuring the new VM.
Being able to roll back virtual machines after failures, VM snapshots can also be used for data security. However, they still cannot replace VM backups. In this article I compared VM snapshot vs backup, analyzed the differences between them, and demonstrated how to properly use them. Hope this could be helpful to you.
Except for the basic operations I introduced, there are more about snapshots you can explore, for example, schedule VMware snapshots. Backing up your VMs regularly and you can enjoy them freely.