Share via


How to Back Up Hyper-V VMs from the Host Using Windows Server Backup

APPLIES TO

  • Windows Server 2008 Enterprise
  • Windows Server 2008 Datacenter
  • Windows Server 2008 Standard
  • Windows Web Server 2008
  • Windows Server 2008 R2 Datacenter
  • Windows Server 2008 R2 Enterprise
  • Windows Server 2008 R2 Standard
  • Windows Web Server 2008 R2

KB958662 lists the procedures, and includes a FixIt script, can you help expand this article with additional information, screenshots, demonstrations?

Use the FixIt on the KB page to register the Microsoft Hyper-V VSS writer.

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base: 322756  (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows.

NOTE:

  • Virtual machines not running Windows Server 2003 or Windows Server 2008 are put into a saved state before backup. The VM down time for these VMs is dependent on the time to save the state.

  • The VSS Writer treats all VMs the same, regardless of what workload is running within it. This may or may not be the behavior you want, for example if your VM is running as a Domain Controller. Plan accordingly.

  • The Hyper-V VSS Writer does not work on passthrough disks.

  • The steps in this article are for all VMs on the host. To back up only specified VMs on the host use your enterprise backup software of choice.   

To register the Hyper-V VSS writer with Windows Server Backup, follow these steps:

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate the following registry key:
    1. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
  3. Right-click CurrentVersion, point to New, and then click Key.
  4. Type WindowsServerBackup, and then press ENTER.
  5. Right-click WindowsServerBackup, point to New, and then click Key.
  6. Type Application Support, and then press ENTER.
  7. Right-click Application Support, point to New, and then click Key.
  8. Type {66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}, and then press ENTER.
  9. Right-click {66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}, point to New, and then click String Value.
  10. Type Application Identifier, and then press ENTER.
  11. Right-click Application Identifier, and then click Modify.
  12. In the Value data box, type Hyper-V, and then click OK.
  13. On the File menu, click Exit.

Check whether the problem is fixed. If the problem is fixed, you are finished with this article. If the problem is not fixed, you can contact support (http://support.microsoft.com/contactus) .

Back up the virtual machines by using Windows Server Backup

  • When you perform a backup of the virtual machines, you must back up all volumes that host files for the virtual machine. For example, if the virtual machine configuration files are stored on the D: volume, and the virtual machine virtual hard disk (VHD) files are stored on the E: volume, you must back up both the D: and E: volumes.
  • Virtual machines that do not have Integration Services installed will be put in a saved state while the VSS snapshot is created.
  • Virtual machines that are running operating systems that do not support VSS, such as Microsoft Windows 2000 or Windows XP, will be put in a saved state while the VSS snapshot is created.
  • Virtual machines that contain dynamic disks must be backed up offline.

Note: Windows Server Backup does not support backing up Hyper-V virtual machines on Cluster Shared Volumes (CSV volumes).

Restore virtual machines by using Windows Server Backup

To restore the virtual machines, follow these steps:

  1. Start Windows Server Backup in Administrative Tools.
  2. On the Actions menu, click Recover.
  3. Select the server that you want to recover data from, and then click Next.
  4. Select the date and time that you want to restore from, and then click Next.
  5. Select the Applications recovery type, and then click Next.
  6. Select Hyper-V, and then click Next.
  7. Select the restore location, and then click Next.
  8. Click Recover to start the restore process.

Note All volumes that host files for the virtual machine will be restored. Individual virtual machines cannot be restored by using Windows Server Backup.

Virtual machines that contain two or more snapshots will not be restored. To work around this issue, follow these steps:

  1. Start Hyper-V Manager in Administrative Tools.

  2. Delete the virtual machine that was not restored.

  3. Start Windows Server Backup in Administrative Tools.

  4. On the Actions menu, click Recover.

  5. Select the server that you want to recover data from, and then click Next.

  6. Select the date and time that you want to restore from, and then click Next.

  7. Select the Files and folders recovery type, and then click Next.

  8. Select the directory where the snapshots are stored, and then click Next.

    Note By default, the snapshots are located in the following directory: C:\ProgramData\Microsoft\Windows\Hyper-V\Snapshots

  9. Select the location where the snapshots should be restored, and then click Next.

  10. Click Recover to start the restore process.

  11. After the restore has finished, perform another restore. However, use the Applications recovery type, and select Hyper-V to correctly restore the virtual machines.

You should test that your backups are good. Tore Lervik gives a PowerShell script to monitor your backups on his blog. His script below checks the last successful backup, and script sends email if the last successful backup is older a designated time period (24 hours by default). It will also send a "backup succeeded" mail.

$maxHours = 24
$email = "your@mail.net"
$smtpServer = "stmp.mail.net"
$sendSuccess = $true

## Script ------------------------------------------------------------

Add-Pssnapin Windows.serverbackup
$summary = Get-WBSummary
$timeBetween = [DateTime]::Now - $summary.LastSuccessfulBackupTime
$computerName = get-content env:computername

if ($summary -eq $null)
{
 $smtp = new-object Net.Mail.SmtpClient($smtpServer)
 $smtp.Send($email, $email, "BackupCheck.ps1 failed on $computerName", "BackupCheck.ps1 failed with unknown error.")
}
elseif ($timeBetween.TotalHours -gt $maxHours)
{
 $smtp = new-object Net.Mail.SmtpClient($smtpServer)
 $smtp.Send($email, $email, "Windows Server Backup on $computerName failed", "Last successful backup on $computerName was at " + $summary.LastSuccessfulBackupTime)
}
elseif ($sendSuccess)
{
 $smtp = new-object Net.Mail.SmtpClient($smtpServer)
 $smtp.Send($email, $email, "Windows Server Backup on $computerName was successful", "Last backup on $computerName was successful at " + $summary.LastSuccessfulBackupTime)
}

 

 

Resources:

Blog: DPM for data backup/recovery of virtualized apps and environments

TN Library: Protecting Hyper-V with DPM 2007 SP1