(For more resources related to this topic, see here.)
Hyper-V and Windows Server 2012 come with tools and solutions to make sure that your virtual machines will be up, running, and highly available. Components such as Failover Cluster can ensure that your servers are accessible, even in case of failures. However, disasters can occur and bring all the servers and services offline. Natural disasters, viruses, data corruption, human errors, and many other factors can make your entire system unavailable.
People think that High Available (HA) is a solution for Disaster Recovery (DR) and that they can use it to replace DR. Actually HA is a component of a DR plan, which consists of process, policies, procedures, backup and recovery plan, documentation, tests, Service Level Agreements (SLA), best practices, and so on. The objective of a DR is simply to have business continuity in case of any disaster.
In a Hyper-V environment, we have options to utilize the core components, such as Hyper-V Replica, for a DR plan, which replicates your virtual machines to another host or cluster and makes them available if the first host is offline, or even backs up and restores to bring VMs back, in case you lose everything.
This module will walk you through the most important processes for setting up disaster recovery for your virtual machines running on Hyper-V.
Backing up Hyper-V and virtual machines using Windows Server Backup
Previous versions of Hyper-V had complications and incompatibilities with the built-in backup tool, forcing the administrators to acquire other solutions for backing up and restoring.
Windows Server 2012 comes with a tool known as Windows Server Backup (WSB), which has full Hyper-V integration, allowing you to back up and restore your server, applications, Hyper-V, and virtual machines. WSB is easy and provides for a low cost scenario for small and medium companies.
This recipe will guide you through the steps to back up your virtual machines using the Windows Server Backup tool.
Windows Server Backup does not support tapes. Make sure that you have a disk, external storage, network share, and free space to back up your virtual machines before you start.
How to do it…
The following steps will show you how to install the Windows Server Backup feature and how to schedule a task to back up your Hyper-V settings and virtual machines:
To install the Windows Server Backup feature, open Server Manager from the taskbar.
In the Server Manager Dashboard, click on Manage and select Add Roles and Features.
On the Before you begin page, click on Next four times.
Under the Add Roles and Features Wizard, select Windows Server Backup from the Features section, as shown in the following screenshot:
Click on Next and then click on Install. Wait for the installation to be completed.
After the installation, open the Start menu and type wbadmin.msc to open the Windows Server Backup tool.
To change the backup performance options, click on Configure Performance from the pane on the right-hand side in the Windows Server Backup console.
In the Optimize Backup Performance window, we have three options to select from—Normal backup performance, Faster backup performance, and Custom, as shown in the following screenshot:
In the Windows Server Backup console, in the pane on the right-hand side, select the backup that you want to perform. The two available options are Backup Schedule to schedule an automatic backup and Backup Once for a single backup. The next steps will show how to schedule an automatic backup.
In the Backup Schedule Wizard, in the Getting Started page, click on Next.
In the Select Backup Configuration page, select Full Server to back up all the server data or click on Custom to select specific items to back up. If you want to backup only Hyper-V and virtual machines, click on Custom and then Next.
In Select Items for Backup, click on Add Items.
In the Select Items window, select Hyper-V to back up all the virtual machines and the host component, as shown in the following screenshot. You can also expand Hyper-V and select the virtual machines that you want to back up. When finished, click on OK.
Back to the Select Items for Backup, click on Advanced Settings to change Exclusions and VSS Settings.
In the Advanced Settings window, in the Exclusions tab, click on Add Exclusion to add any necessary exclusions.
Click on the VSS Settings tab to select either VSS full Backup or VSS copy Backup as shown in the following screenshot. Click on OK.
In the Select Items for Backup window, confirm the items that will be backed up and click on Next.
In the Specify Backup Time page, select Once a day and the time for a daily backup or select More than once a day and the time and click on Next.
In the Specify Destination Type page, select the option Back up to a hard disk that is dedicated for backups (recommended), back up to a volume, or back up to a shared network folder, as shown in the following screenshot and click on Next.
If you select the first option, the disk you choose will be formatted and dedicated to storing the backup data only.
In Select Destination Disk, click on Show All Available Disks to list the disks, select the one you want to use to store your backup, and click on OK. Click on Next twice.
If you have selected the Back up to a hard disk that is dedicated for backups (recommended) option, you will see a warning message saying that the disk will be formatted. Click on Yes to confirm.
In the Confirmation window, double-check the options you selected and click on Finish, as shown in the following screenshot:
After that, the schedule will be created. Wait until the scheduled time to begin and check whether the backup has been finished successfully.
How it works…
Many Windows administrators used to miss the NTBackup tool from the old Windows Server 2003 times because of its capabilities and features. The Windows Server Backup tool, introduced in Windows Server 2008, has many limitations such as no tape support, no advanced schedule options, fewer backup options, and so on. When we talk about Hyper-V in this regards, the problem is even worse. Windows Server 2008 has minimal support and features for it.
In Windows Server 2012, the same tool is available with some limitations; however, it provides at least the core components to back up, schedule, and restore Hyper-V and your virtual machines.
By default, WSB is not installed. The feature installation is made by Server Manager. After its installation, the tool can be accessed via console or command lines.
Before you start the backup of your servers, it is good to configure the backup performance options you want to use. By default, all the backups are created as normal. It creates a full backup of all the selected data. This is an interesting option when low amounts of data are backed up. You can also select the Faster backup performance option. This backs up the changes between the last and the current backup, increasing the backup time and decreasing the stored data. This is a good option to save storage space and backup time for large amounts of data.
A backup schedule can be created to automate your backup operations. In the Backup Schedule Wizard, you can back up your entire server or a custom selection of volumes, applications, or files. For backing up Hyper-V and its virtual machines, the best option is the customized backup, so that you don’t have to back up the whole physical server. When Hyper-V is present on the host, the system shows Hyper-V, and you will be able to select all the virtual machines and the host component configuration to be backed up. During the wizard, you can also change the advanced options such as exclusions and Volume Shadow Copy Services (VSS) settings. WSB has two VSS backup options—VSS full backup and VSS copy backup. When you opt for VSS full backup, everything is backed up and after that, the application may truncate log files. If you are using other backup solutions that integrate with WSB, these logs are essential to be used in future backups such as incremental ones. To preserve the log files you can use VSS copy backup so that other applications will not have problems with the incremental backups.
After selecting the items for backup, you have to select the backup time. This is another limitation from the previous version—only two schedule options, namely Once a day or More than once a day. If you prefer to create different backup schedule such as weekly backups, you can use the WSB commandlets in PowerShell.
Moving forward, in the backup destination type, you can select between a dedicated hard disk, a volume, or a network folder to save your backups in.
When confirming all the items, the backup schedule will be ready to back up your system.
You can also use the option Backup once to create a single backup of your system.
To check whether previous backups were successful or not, you can use the details option in the WSB console. These details can be used as logs to get more information about the last (previous), next, and all the backups.
To access these logs, open Windows Server Backup, under Status select View details. The following screenshot shows an example of the Last backup.
To see which files where backed up, click on the View list of all backed up files link.
Checking the Windows Server Backup commandlets
Some options such as advanced schedule, policies, jobs, and other configurations can only be created through commandlets on PowerShell.
To see all the available Windows Server Backup commandlets, type the following command:
Get-Command –Module WindowsServerBackup
The Restoring Hyper-V and virtual machines using Windows Server Backup recipe in this article