Hyper-V recovery: Top tips for restoring Hyper-V virtual machines
Good backups are only one half of a solid data protection plan. Check out our best tips for solving common Hyper-V recovery problems.
What you will learn in this tip: In my last article, you learned troubleshooting tips for common Hyper-V backup problems. But that's only one half of a sound data protection strategy. Your backups are useless unless you can recover them. In this tip, learn the best workarounds to avoid some of the stumbling blocks that can arise with Hyper-V virtual machine (VM) restores.
The process of restoring Hyper-V virtual machines allows you to restore whole systems, or even single files in a very short period of time. What took hours or days with a physical server restore can take minutes when paired with the right tools. However, as with any technical process, there are tips that are learned along the way that will save you valuable time. I will share Hyper-V recovery tips with you in this article.
Shutdown first
There are various backup applications that support seamless backups and restores utilizing the Hyper-V VSS Writer. A few of the major players in this area are Acronis Backup & Recovery 10, Microsoft Data Protection Manager (DPM) 2010 and Symantec Corp. Backup Exec 2010. These types of applications can restore a VM back to its original location on the original host server, and coordinate the injection of the files associated with the VM being restored.
This restore request from the backup software is supposed to coordinate the shutting down of the VM before the injection of the restored VHD, but due to the VM failing to adhere to the shutdown request, this process is inconsistent, resulting in a failed restore.
Solution: The simple fix to this is to make sure you shut down the VM before the restoration process. This will allow for much more consistent restore jobs. This works with all backup products that use VSS.
Tip: On a clustered VM, use Failover Cluster Manager or System Center Virtual Machine Manager to shut down the VMs that need to be restored.
I only need a file or folder restored
In my last article, I pointed out the benefits of host-level whole VM backups. This is a great method for recovering whole systems that became corrupt, or as a fast disaster recovery method for many of your workloads throughout your organization. But what if you only need a single file, or folder from a backup? With traditional backup methods that rely on agents on each system that is backed up, it's fairly easy to browse through the restore options in your backup software, pick the file and folder and restore, but since you most likely performed a host-level backup, how do you get to these single files?
Solution: First, you'd restore the VHD from the VM that has the file needed. Then you would restore to a location on the backup server or a remote server that has spare diskspace. In this case, you aren't restoring the whole VM, but just the particular VHD that has the files or folders you want to restore. When it is in this location, you can use a utility like WinImage or Windows 7/Windows Server 2008 R2 to mount the VHD as an explorable hard drive attached to your system. Below are the steps to perform this procedure. This can either be done locally where you restored the file or remotely. The whole process can be done from within the Windows 7 or Windows Server 2008 R2 Disk Management section. (See image below; click on image for full size.)
Then, follow these steps:
1. Select Attach VHD (see image below, click on image for full size).
2. Choose the local (C:\restore\SERVERX.vhd) or remote location (\\ServerName\c$\Restore\SERVERX.vhd) of the restored vhd and choose OK.
3. Right click on the newly attached VHD and choose Explore.
This will open an explorer window where you can find the files or folders you wish to restore and move them to any other location you choose.
Tip: Remember, when you are done to right-click on the drive you attached and choose “Detach VHD.”
In my virtual environments, this type of restore happens much more frequently than whole system restores and even though it takes a full restore of the original VHD file to a holding location, in most instances this is much faster than traditional file and folder restores due to the transfer speed of large VHD files vs. the searching process that usually accompanies restores from the media of your choice.
Note: When utilizing DPM 2010 disk-to-disk backups, file- and folder-based restores can be completed within the console. Look for more vendors to supply this method in the future and make the above manual process obsolete.
Alternate host restores
Alternate host restores can be performed using many of the same backup applications mentioned above. If a host is lost or storage subsystem is corrupt, the ability to restore whole VMs in an automated fashion to alternate hardware can help avoid downtime. One problem seen in this process is when restoring a system from a backup application, the restored VM may show that it is in a saved state. Many times, this state does not allow you to resume the newly restored VM or power it on. From my experience this happens when restoring to an alternate host with different hardware characteristics. For More information on this, see this Microsoft Support document -- KB2502233.
Solution: To work around this, you can right click on the VM within Hyper-V Manager and choose Delete Saved State.
Whether full system or single file restores, the ability to recover your VMs quickly and efficiently is critical to your data protection strategy. Having the right tools and procedures in place may not be enough if you have not exercised this process. Like the backup process itself, restoring Hyper-V VMs still has a few shortcomings that can be solved with a few tips. I hope some of my favorite workarounds will be helpful. If you have any of your own, feel free to share them at VirtuallyAware.com.
About the author: Rob McShinsky is a senior systems engineer at Dartmouth Hitchcock Medical Center in Lebanon, N.H., and has more than 12 years of experience in the industry -- including a focus on server virtualization since 2004. He has been closely involved with Microsoft as an early adopter of Hyper-V and System Center Virtual Machine Manager 2008, as well as a customer reference. In addition, he blogs at VirtuallyAware.com, writing tips and documenting experiences with various virtualization products.