Storm season is back, bringing with it the potential for significant weather events. If you have clients in areas prone to infrastructure disruption, visit the Disaster Recovery Resources guide for preparedness information. Datto recommends performing proactive disaster recovery testing to mitigate potential downtime. See our articles about the importance of disaster recovery testing and Preparing For A Cloud Virtualization Test: Policies, Procedures, And Partner Responsibilities to learn more. For live updates, follow @datto on Twitter.

Restoring Thin-Provisioned VHD Exports to Microsoft Hyper-V (Windows Server 2008 & Up)

Follow

Topic

This article describes the process for attaching a VHD export to a Windows host as a mounted volume, and exporting its data to a thin-provisioned Microsoft Hyper-V virtual drive.

To restore a VHD to Microsoft Hyper-V with thick provisioning, see Restoring Thick-Provisioned VHD Exports to Hyper-V (Windows Server 2008 & Up).

Environment

  • Datto SIRIS
  • Datto ALTO
  • Microsoft Hyper-V
  • Windows Server 2008
  • Windows Server 2008 R2
  • Windows Server 2012
  • Windows Server 2012 R2
  • Windows Server 2016

Description

During this process, you will mount a restore, attach the restored VHD as a drive on your Hyper-V-enabled Windows machine, create a new, dynamically-allocated virtual hard drive in Hyper-V, and then copy the contents of the exported VHD to the new drive.

The VHD copy functions require Hyper-V manager. Follow the steps in the article Export Image to mount the recovery point as a VHD on your Datto appliance before you proceed.

NOTE: This article uses screenshots from Windows Server 2008. Your user experience may vary slightly by platform.

Index

Part 1: Attaching the Volume as a Logical Drive

1. Before proceeding further, mount an image export on your Datto device by following the steps in the Exporting to a Network Share section of the Export Image article. Make note of the CIFS/Samba VHD Share path your appliance provides once the restore is mounted.

2. Launch Disk Management on your Hyper-V-enabled Windows machine.

Figure 1: Launching Disk Management

3. Click Action → Attach VHD.

Figure 2: Attach VHD (click to enlarge)

4. At the Attach Virtual Hard Disk prompt, select Browse.

Figure 3: Attach Virtual Hard Disk

5. In the Location field, enter the CIFS/Samba VHD Share you obtained in Step 1. Then, click Open.

6. When the share opens, select the hard disk image, and click Open.

Figure 4: Selecting a hard disk image (click to enlarge)

If boot.vhd and C.vhd are both present, select boot.vhd as the first drive, and attach C.vhd as the secondary drive. If only C.vhd is present, use C.vhd as the first drive.

NOTE: For Linux systems, C.vhd will be sda1.vhd.

There are two reasons to add a boot and a C volume:

  • For devices where UEFI is unsupported, adding a boot and C:\ volume is necessary to make GPT-formatted OS volumes readable.

  • It fixes virtualization failures for some MBR / BIOS agents. While a production Windows machine can still boot from its System Reserved partition if its NTFS bootstrap code is corrupted, virtualizations do not have this ability unless both the boot and C volumes are present.

7. At the Attach Virtual Hard Disk prompt, check the Read-only box, and click OK to mount the image.

boot2.jpgFigure 5: Attach Virtual Hard Disk

8. The VHD will mount as a volume in Windows.

Figure 6: VHD attached as Windows volume (click to enlarge)

9. To recover files from the virtual disk with their permissions intact, use Robocopy or Richcopy

10. To import the disk image into Hyper-V, see the next section of this article.

Part 2: Importing the Volume into Hyper-V Manager

1. Launch Hyper-V manager from Start → Administrative Tools → Hyper-V Manager.

2. From Hyper-V Manager, click Action → New Hard Disk.

Figure 7: VHD attached as Windows volume (click to enlarge)

3. If you see a Before You Begin dialog, click Next.

4. Select the destination Disk Format, and then click Next.

Figure 8: Choose Disk Format (click to enlarge)

5. Choose the destination Disk Type, and then click Next.

Figure 9: Choose Disk Format (click to enlarge)

6. Specify a name for the virtual disk and the location to save it to, and then click Next.

Figure 10: Specify Name and Location (click to enlarge)

7. Select the disk or disks to copy by clicking Copy the contents of the specified physical disk and selecting the PHYSICALDRIVE value that is the same disk number as the VHD that is mounted. Then, click Next. Repeat this step for all disks involved in the restore.

Figure 11: Disk number of mounted VHD (click to enlarge)

Figure 12: PHYSICALDRIVE path (click to enlarge)

8. Review the summary to ensure that the virtual hard disk is configured correctly. When you are ready to proceed with disk creation, click Finish.

Figure 13: Summary (click to enlarge)

9. A progress bar showing the status of the transfer will appear.

Figure 14: Creating the new virtual hard disk

10. After the transfer has completed, detach the VHD from Disk Management, as shown in Figure 14.

Figure 14: Detach VHD

Part 3: Finalizing the Restore

1. From Hyper-V Manager, click Action → New → Virtual Machine. When the New Virtual Machine Wizard launches, click Next.

2. If the Before You Begin page pops up, click Next.

3. Provide a name and (optionally) a storage location for the virtual machine, and then click Next.

Figure 15: Specify Name and Location

4. Specify the Generation of the VM. If you are using Hyper-V Manager 2008 or earlier, skip this step. Your Hyper-V Manager environment does not support Generation 2 virtual machines.

  • Generation 1 provides the same virtual hardware to the virtual machine as previous versions of Hyper-V. Any virtual machine over 2 TB must use a Generation 2 template.
    • Generation 1 VMs:
      • Can use VHD and VHDx disk formats
      • Only support the MBR boot type

  • Generation 2 provides support for features such as Secure Boot, SCSI boot, and PXE boot using a standard network adapter. Guest operating systems must be running at least Windows Server 2012 or 64-bit versions of Windows 8.
    • Generation 2 VMs:
      • Can only use the VHDx disk format
      • Only support UEFI; BIOS is unsupported 

5. Provide the amount of RAM to allocate the virtual machine. Then, click Next.

6. Select the NIC to use in the virtual machine. The default value is Not Connected (Hyper-V Manager 2008 or earlier) or None (Hyper-V Manager 2012).

7. On the Connect Virtual Hard Disk page, select Use an existing virtual hard disk. Provide the path to the datastore where the VHD(x) was copied to in the previous section, and then click Next. 

NOTE: Be sure to attach boot.vhd(x) first. 

8. On the Summary page, confirm all configuration settings are correct and click Finish.

Figure 16: Summary

9. In the Virtual Machines pane, right-click the VM, and then click Settings .

10. Click the storage controller your boot.vhd(x) disk is attached to. Then, click Hard Drive → Add.

Figure 17: Hard Drive → Add

11. Select Virtual hard disk if it is not already selected. Browse to the location of your C.vhd(x) (or sda1.vhd, on Linux systems), select it, and click Apply. Repeat this step for each additional disk you need attached.

Figure 18: Browsing to and selecting a virtual hard disk

12. When you finish configuring the virtual machine's settings, click OK, right-click the VM, and click Start.

  • If the VM boots, the restore is complete.
  • If the VM fails to boot:
    • Collect and research any errors thrown, if applicable
    • Ensure the right Generation and disk type was selected for your boot type. Remember: MBR = Generation 1, GPT = Generation 2.
    • Contact Datto Technical Support if you continue to experience bootability issues.

Figure 19: Starting the VM

Additional Resources


Was this article helpful?

1 out of 4 found this helpful

You must sign in before voting on this article.

Want to talk about it? Head on over to our Community Forum!