How to Schedule VMware Snapshot via vSphere Scheduled Task
Snapshots are commonly used for VM protection. Creating a scheduled snapshot task means to take snapshots automatically at a given point. Here I will explain the detailed steps.
Schedule VMware snapshot to save your effort
🔎What is snapshot: VMware snapshot records the state and data of a virtual machine at a given point in time. The snapshot file is a copy of the original virtual disk, it creates a place holder disk, virtual_machine-00000x-delta.vmdk, to store data changes since the time the snapshot was created. With it, you can roll a virtual machine back quickly when a failure or system error occurs, which is especially useful in a testing environment.
🔎Why schedule snapshot: It's a pain to take every snapshot manually. Imagine you have many VMs with frequent data changes - just taking snapshots of them one by one can take a lot of time and effort. Therefore, you may want to schedule VMware snapshot to capture the state of the virtual machine in time automatically.
To do this, you can use PowerShell, PowerCLI, or the guest OS's built-in scheduler. But if you want to do this via an easier-to-understand GUI, vCenter Server's task scheduling feature may be the most straightforward option.
In this article, you will learn how to create a scheduled snapshot task via vCenter in vSphere Web Client.
How to schedule VMware snapshot (step-by-step)
Is there a convenient way to create a scheduled snapshot task for VMware virtual machines? Yes, you can schedule snapshot in vSphere Web Client or vSphere Client via vCenter scheduled tasks feature.
This part explains how to create automatic scheduled snapshots step by step.
Steps to schedule, reschedule and remove snapshot task in vSphere
The following guide of using scheduled tasks is based on vSphere 6.7, and the steps to schedule VMware snapshot are nearly the same in vSphere 6.5. If you are using vSphere 7, the procedure will be different, but only slightly.
🔹How to create scheduled snapshot task in vSphere Web Client
1. To use vCenter schedule snapshot, you can first login vCenter Server using the vSphere Web client, then navigate to the object for which you want to schedule a task.
2. Select Monitor > Tasks & Events > Scheduled Tasks > Schedule a New Task.
💬To use vSphere 7 scheduled tasks, navigate to Configure > Scheduled Tasks > New Scheduled Task.
3. From the Schedule New Task drop-down list, select Take Snapshot...
4. In the Edit Setting page, type a name and add a description for the task.
5. In the Scheduling options page, configure the required settings for the task.
- To configure the scheduling settings for the task, click Change next to Configured Scheduler.
- The most important settings in the snapshot scheduling process are in the Change menu. There, you can set when and how often operations are performed.
- After setting up the date, press OK to finish this step.
6. Enter the email addresses to receive an email notification which is optional and press OK when when it's all set.
7. This is how to create vCenter 6.7 scheduled tasks. If you schedule the snapshots successfully, the task will be displayed on the Scheduled Task List.
🔹How to reschedule VMware snapshot
For the 3 buttons on the right of the Schedule a New Task, the green logo is Run Button which means the scheduled task is executed once you click it. And the yellow pencil logo is for Editing the scheduled task.
When you want to modify the scheduled plan, just click on the pencil icon, or right-click the task and select Edit. Change the task attributes as necessary, and click OK.
🔹How to remove a scheduled task in VMware
When you want to stop a scheduled snapshot, removing the task is necessary. Similarly, you can click the red logo is to Remove the task. Or, right-click the task and then select Remove.
Can you schedule snapshot deletion in VMware?
Since it is not advisable to keep snapshots for too long, is there a way to automatically delete old snapshots (e.g. delete snapshots from X days ago)?
Unfortunately, the Scheduled Task feature in vSphere does not include this function. You can use PowerCLI commands instead. For example, if you want to delete VMware snapshot older 3 days, this command could be used:
Get-Snapshot | `
Where-Object { $_.Created -lt (Get-Date).AddDays(-3) } | `
Remove-Snapshot
If you only want to delete a snapshot of a specific virtual machine, you can use the following command:
Get-VM -Name VMName | `
Get-Snapshot | `
Where-Object { $_.Created -lt (Get-Date).AddDays(-3) } | `
Remove-Snapshot
Deleting VMware snapshots will merge them to the original virtual disk. But if you delete snapshots incorrectly, things can be dangerous. So please take snapshot deletion action carefully.
Other concerns about scheduled VMware snapshot
In the above section, we discussed how to create or edit scheduled task of VMware snapshots, and it doesn't look very difficult. However, due to the specificity of how snapshot works, you may have some concerns during use.
Will snapshots affect VM performance? How long should we keep them?
When taking a snapshot, the state of the virtual disk is preserved. The guest OS stops writing to it, and a delta or child disk is created. Large amounts of data are subsequently recorded into child disk, and the snapshots size in production environment can run out of memory and cause insufficient memory errors, which can affect performance of VM.
VMware's recommendation is not keep a single snapshot for more than 72 hours, and a snapshot chain should not exceed 32 snapshots.
If you create a scheduled snapshot task, you should keep monitoring the VMware snapshot size to avoid poor performance of VM. You can also get snapshot report from vCenter for investigation.
Is it necessary to power off VM before snapshot?
Some users may wonder if snapshots can be taken while the virtual machine is powered on. In fact, you can take snapshots when a VM is powered on, powered off, or hung. However, when using independent (non-persistent or persistent) disks, you are not allowed to take snapshots of a powered-on machine.
At this point you can also change the disk to non-independent mode to allow snapshots to be taken at power on.
First power off the VM and delete the existing snapshot. Select the virtual machine and choose VM > Settings. On the Hardware tab select the drives to include and click Advanced. Then you can uncheck the Independent option.
Caution: scheduled snapshot ≠ regular VMware backup
Snapshot and backup are different from each other, and scheduled VMware snapshot cannot be used as one of the common methods of backup for the following reasons:
1. One VM requires one separate scheduled task. If you own a wide range of VMs, it is complicated to create and manage snapshot tasks.
2. The snapshot file is just a changelog of the original virtual disk, which creates a placeholder disk to store the data changes since the snapshot was created. If the base disk is deleted, the snapshot file is not sufficient to recover the virtual machine.
3. Snapshot is for short-term rollback instead of long-term backup. VMware suggests not to use a single snapshot for more than 72 hours, and a snapshot chain should not exceed 32 snapshots (better use only 2 to 3).
Therefore, VM snapshots can work as quick failsafe before performing development or testing, but it cannot replace a regular VMware backup solution. In fact, you can combine it with backup solution for better data protection.
Seamlessly protect VMs with scheduled VMware backup (free)
A scheduled backup is more secure for VM data protection than a scheduled snapshot in VMware. So this part introduces an easy-to-use tool to schedule virtual machine backup.
AOMEI Cyber Backup is a free VMware backup program to run automatic VM backups securely. It offers flexible backup strategies to protect VM data seamlessly and backup VMs to different places to fulfill the 3-2-1 backup rule. With its retention policy, you can also save a lot of costs on storage.
Auto Backup: Run VM backups automatically every day, every week, or every month and notified by email.
Agentless Backup: Backup multiple VMs at host-level without installing agent on each VM, and use the centralized console to simplify the VM management.
Restore from Any Point: With scheduled backups in hand, you can easily restore VMs to any backed up version.
Support Free ESXi: AOMEI Cyber Backup supports both paid and free versions of VMware ESXi.
Simple steps to back up VM using AOMEI Cyber Backup:
1. Access to AOMEI Cyber Backup and add vCenter or Standalone ESXi host as the source device.
*You can choose to install this VM backup software on either Windows or Linux system.
2. Click Backup Task >> Add New Task to create the complete and secure backup task.
- In the configuration page, enter a name for the task and select the backup type as VMware ESXi or Hyper-V. Then select the virtual machines you want to back up. Click OK.
- Select the Backup Target to store the backups, such as local path or network path.
- Schedule backup with flexible strategies (full / incremental / differential backup) and set up a data from daily / weekly / monthly (by date) / monthly (by week).
- Set up Backup Cleanup*(optional function that requires Premium Edition): select the retention period for backup. It helps to schedule VMware backup deletion and free up storage space automatically.
- Click Start Backup. You can monitor the whole backup process. Meanwhile, after backup, the recovery is rather secure once unpredictable events happen to your original VM.
3. Click Restore to recover a virtual machine from any point. It’s more secure to restore entire VM from the backups than snapshots.
While the Free Edition covers most of the VM backup needs, you can also upgrade to enjoy Restore to new location. Easily make a clone of a virtual machine in the same or another datastore/host, without reinstalling or configuring a new VM.
AOMEI Cyber Backup provides a secure recovery solutions of VMware virtual machines. It will continuously prevent your business data from threats. You can benefit from the reliable data protection strategy in the scenario of software-testing or disaster recovery.
Summary
This article introduced how to schedule VMware snapshots via vSphere Web Client and what we need to pay attention to while using it as backup.
As we know, snapshot cannot replace backup. For VMware data security, you’d better choose reliable VMware backup solution instead of snapshot.