Windows 7 / Getting Started

Understanding Virtual Hard Disks

Virtual hard disks are binary files that use the VHD extension. Hyper-V VMs use these files to store all the data associated with a volume. If you want to create a VM that has two simulated hard-disk drives, you create two separate VHD files. VHD files aren't just used by Hyper-V but can also function as:

  • The default format in which Windows Server Backup 33 writes backup files
  • A bootable device on which you can install the Windows Server 2008 R2 or Windows 7 OS
  • A device that can be mounted as a disk drive on computers running Windows Server 2008 R2 or Windows 7

When you create a virtual hard disk, you can choose between creating a fixed disk, a dynamically expanding disk, or a differencing disk.

Creating Fixed Disks

When you create a fixed virtual hard disk, a file that is the same size as the hard disk is created and stored on the target volume. The benefit of a fixed virtual hard disk is that, at creation, all virtual hard-disk space is allocated. While this takes longer than creating other forms of virtual hard disks, it also minimizes the chance that the VHD will become fragmented. Another benefit of fixed disks is that they always remain the same size and do not expand to the point where they consume all space on the host volume.

Creating Dynamically Expanding Disks

The drawback of dynamically expanding disks is that, as they grow only when new space is required on the VM, they tend to be substantially more fragmented than virtual hard disks of a fixed nature. Substantial fragmentation can reduce overall performance. Another drawback of dynamically expanding disks is that, if insufficient care is taken, the dynamically expanding disk may continue to grow until all space on the host volume is consumed. This can be problematic if you don't regularly monitor the volumes on which you host VHD files.

Creating Differencing Disks

A differencing disk records all the changes made to a parent disk without applying those changes to that parent disk and instead applying them only to the differencing disk. Differencing disks are a special type of dynamic disk. Hyper-V snapshots use chains of differencing disks to allow you to use the computer as it was configured at different points in time. A differencing disk hierarchy that has multiple levels is also called a chain. A single parent disk can have multiple children. The properties of a differencing virtual disk, including the disk's parent disk.

If a differencing disk's chain is broken, you can reconnect the differencing disk to its parent, assuming the parent disk still exists. To accomplish this goal, perform the following steps:

  1. Open the Hyper-V Manager console, select a VM, and then click Inspect Disk in the Actions pane.
  2. Locate the virtual disk that you wish to reconnect to the parent and then click Open.
  3. On the Virtual Hard Disk Properties dialog box, click Reconnect. This launches the Edit Virtual Hard Disk Wizard.
  4. In the Edit Virtual Hard Disk Wizard, click Browse to navigate to the location of the parent virtual hard disk.

When using differencing disks, you should configure the parent disk as read- only to minimize the chance that changes can be made that will cause corruption.

You can use the Edit Virtual Hard Disk Wizard to merge a child disk with its parent hard disk. You accomplish this goal in one of two ways. The first involves merging the child disk into its parent, which effectively applies all the changes recorded in the child VHD to the parent VHD. The other option is to use the merge operation to create a brand new VHD while retaining the original child and parent VHDs.

One way of rapidly deploying VMs is to create a VM, install the OS, run the sysprep.exe utility, and then shut the OS down. Take the VHD file from that VM, make it readonly, and then deploy new VMs by creating VMs that use a differencing disk that uses the sysprepped VHD as a parent.

Connecting Pass-Through Disks

Pass-through disks allow you to connect a physical disk directly to a VM, rather than connecting the VM to a virtual hard-disk file hosted on a physical disk. Pass-through disks can also be connected to the server running Hyper-V as an LUN on a storage area network (SAN). The main benefit of pass-through disks, as opposed to virtual hard disks, is that pass-through disks are not subject to the 2040-gigabyte size limitation. The drawback of pass-through disks is that they do not support Hyper-V's snapshot functionality.

Microsoft does not recommend using differencing disks on VMs hosted on clusters.

To configure a VM to use a pass-through disk, first take the disk offline using Disk Management. After this is done, you will be able to select either an IDE or SCSI controller, click Add Hard Drive, select the Physical Hard Disk drop-down, and then choose the offline disk that you want to allocate to the VM.

[Previous] [Contents] [Next]