DiskShadow / Xcopy RESTORE of Hyper-V

In my last post I showed you how to create a consistent backup of a Hyper-V host using the no additional cost Diskshadow command and an attached USB drive (in contrast to the costly VMware Consolidated Backup).  Now I want to show you how to restore the VMs that you backed up to a separate host (what good is a backup of you can’t restore it!).

To recover the data, we’ll simply reverse the process on another Hyper-V host.  I attached the USB disk used for backup to a different system, and invoked the diskshadow script below using the command diskshadow –s HyperVrestore.txt.  HyperVrestore.txt looks like this:

set context persistent
#the backup.cab file mentioned below is the one created during backup.
load metadata G:\Hypervbackup\backup.cab
set verbose on
begin restore
exec C:\HypervRestore.cmd
end restore

It’s similar the HyperVBackup.txt script, except that it reads the metadata from backup.cab and uses Xcopy (in HypervRestore.cmd) to copy the files from the USB drive (G:) to the local system:

Xcopy g:\HyperVBackup\VMs\*.* C:\VMs\*.* /e /s /y /F /O /X /R /H

The command window looks pretty similar to the one I showed you in the backup posting.

clip_image002   clip_image002[4]    clip_image002[6]

The net effect of the restore is the important part. 

On the source system, I had two running VMs (an instance of Hannah Montana Linux and a Windows Server 2003 VM):

clip_image002[10]

Before I ran the diskshadow restore, Hyper-V manager on the "recovery” system only showed three VMs:

clip_image002[8]

Once the restore process completed, the recover host showed all 5 VMs!

clip_image002[12]

Let me know if you would like me to go into more complex recovery scenarios (like different drive letters or changed drive letters / directories).

In my next post, I’ll show you some of the detailed wicked coolness of backing up non-Windows VMs using the Hannah Montana Linux instance noted above.

-John