Mistakes to Avoid When Backing Up Your VMware Virtual Machine
Tags: webdev, programming, devops, security
Published: 2022-11-17 15:13:07

Backing up a virtual machine (VM) is a complex process that requires knowledge and preparation. In this post, we are not going to discuss how to back up your VMware VM, but rather about basic mistakes that you need to avoid while backing up your VMware VM. 

## Using the Guest OS to Back Up Your VMware VM
Guest OS backup is not the best choice to back up your VMware VM and it should be avoided. But what is a guest OS backup? Guest OS backup requires installing special VMware backup software or an agent on the operating system (OS) of every VM. The agent is responsible for creating copies of the entire file system when you do a full backup, or individual files or objects when you perform an incremental backup. Agents run inside the guest OS and they establish connections with the servers on which you manage your backups. Guest OS backup is not the best choice for backing up your VM since the data that you need to back up is located at the physical hardware level. The guest OS, however, does not have direct access to the hardware level. Therefore, the backup agent has to interact with the virtualization layer to be able to back up data. This method takes up a lot of resources, especially if several backups run on the same host simultaneously. Thus, using a backup agent is impractical and not recommended. Instead, backup servers can refrain from using the guest OS backup by accessing the virtualization level directly with host-level or image-level backup. An image-level backup backs up data at the block rather than file-level. It can back up VMs with all types of operating systems along with virtual disk and configuration files (CPU, memory, networks, disks). A proper VM ware backup requires a VMware backup solution that can backup your VM at the host [level](https://www.nakivo.com/blog/host-level-vs-guest-level-hyper-v-backup/). 				

## Treating Your VMware Snapshots as Backups
A common misconception is that a snapshot can be used as a backup. True, you can create multiple snapshots with different recovery points. However, if you use a snapshot from a previous point in time, you won’t be able to come back to your initial VM state. The only thing you can do is to use yet another snapshot from a previous point. Another problem is that snapshots can grow if they are retained for a long time. This happens due to the changes in your system, such as new installations or deletions. Your original snapshot may even end up bigger than a disk. In addition, your Logical Unit Number (LUN) is locked when your snapshot is growing. Because of this, other hosts cannot write to the LUN. A LUN is a number that identifies a logical disk, the storage area of your data. Locking down the LUNs can decrease the performance of your VM. In addition, because every snapshot is a separate file, having too many of them can quickly cause a reduction of space in your datastores. There are occasions when snapshots become useful, though. You can use snapshots when you expect your system to go back to a previous state. This is necessary when you need to do upgrades or apply patches. 

## Failing to Quiesce Your VMware VMs
Not only is it important to back up your data at the host level, but it’s also critical to make sure that your data remains consistent when you back it up. During the backup, your VMware Backup software does not see what’s happening inside the guest OS, mainly because the backup process takes place at the virtualization level. To ensure consistent backups, you need to quiesce your VMs. Quiescing means pausing or stopping your VM to achieve app consistency. Quiescing involves capturing all pending transactions at the time the quiescent snapshot is taken. New or unfinished transactions are rolled back to preserve a consistent state. Quiescing takes place inside the guest OS and utilizes the Volume Shadow Copy Service (VSS) to create a snapshot of the VM. However, since the backup takes place at the hypervisor level, you need an application that tells the guest OS to quiesce the VM. VMware Tools is an application that can establish a connection between the guest OS and virtualization layer and instruct the VSS to quiesce the guest OS.

The VSS works only with Windows VMs. VMs that run on Linux can’t use VSS services. However, the VMware Tools can provide a functionality similar to VSS for Linux environments. That’s why it’s essential to install and frequently update the VMware Tools. If VMware Tools isn’t compatible with your guest OS, use another agent that can coordinate the quiescing process.

## Scheduling Multiple Backups on a Host and Shared Data Stores
Generally, you use less VM resources when you back up at the virtualization level. However, a great amount of resources are still used at the host and storage device level. Multiple concurrent backups increase your VM’s Input/Output (I/O), thereby lowering the performance of the VM. In addition, multiple backups on the same host can be strenuous for all VMs running on that host and cause bottlenecks. Therefore, always monitor and analyze your backups at the hypervisor level. Look up statistics and decide whether you need to add another VM to your backup job. 

## Limiting the Number of Your VMware backup Resources
 
To run sufficient backups, your backup server must have powerful resources. The amount of available resources determines how much data your server can back up. In addition to backups, your backup server is also responsible for handling such operations as compression and deduplication. To avoid bottlenecks, always monitor the resources available on your server. If you analyze your resources and see that they have reached their maximal potential, you need to think about getting additional resources for your backup server. Overall, the more resources you have, the better it is for running backup jobs. Currently, there are multiple useful features that can help you back up your data at the virtualization level. Your VMware backup solution can utilize these features to leverage fast and efficient backups:
vStorage APIs for Data Protection (VADP) - allows for direct host and storage backup;
Changed Block Tracking (CBT) - a part of VADP that allows faster incremental backups by intersecting with a VM’s kernel to determine which blocks have changed since the previous backup. 
Think about all of the available resources and newest features to produce fast and reliable backups at the virtualization level. 

## Not Verifying Your Backups
 
Once you have created a backup, you need to verify that your backup is suitable for recovery. There is nothing worse than finding out during an emergency, right when you need it the most, that your backup is corrupted. An efficient VMware backup solution should allow you to run instant verifications of your backups to verify that your backups are good for recovery. You can verify your backups by running screen or boot verification. Screen verification allows you to run the VM from your backup with networking turned off. Your VMware backup solution can verify that the VM’s OS is booted, create a screenshot, and then discard the test-recovered VM. You can see the results on the solution’s dashboard or obtain them via email. Boot verification allows you to verify your backups by checking whether your VMware tools are successfully running. After the backup is complete, you can check whether the guest OS is running and you can see the results displayed on a dashboard or obtain them via email. You can run backup verifications on demand or set up the automatic checks.

## Not Encrypting Your Backups 
Data encryption helps to protect your VM backup in flight and in rest by using AES 256 encryption, a worldwide encryption standard. Data encryption deciphers your data and prevents unauthorized users or cyber criminals from accessing it. Backups traveling over a wide area network (WAN) should be encrypted at all times. When data arrives at its final destination and settles in the backup repository, it should also remain encrypted. 

## Failing to Follow VMware Backup Best Practices
Remember to adhere to the following VMware backup best practices to make sure your backup process runs smoothly and your backed up data is available for recovery any time.

- Follow the 3-2-1 rule: Create multiple backup copies and keep them at different storage locations to ensure instant availability if one of the locations becomes compromised. 
- Create replicas: Keep a replica of your VM at a Disaster Recovery Site to fail over and quickly restore your production in case of disaster. 
- Encrypt your backups: Secure your backups in flight and at rest to ensure complete data protection. 
- Verify your VMs: Ensure that your backups are viable by testing them after the backup job is complete. 

To learn more about VMware backup - [visit this page](https://www.nakivo.com/vmware-backup/).