Managing Virtual Hard Disk data with encapsulation

Encapsulating Virtual Hard Disk data may seem like the best way to manage Hyper-V storage. Pass-through disks, however, offer backup and restoration advantages over huge VHD files.

Encapsulation. It's the feeling you get when the airline attendant announces "arm doors for departure and crosscheck." It's what quickly occurs to an ice cream cone after it's dunked into a molten vat of liquid chocolate. And it's what happens to your files and folders when you turn them into Hyper-V Virtual Hard Disk (VHD) data.

In plenty of cases, encapsulation is a good thing. Taking off when the airplane doors aren't fully closed will be the start of a very bad day. Also, encasing vanilla in a crust of milk chocolate adds flair to an otherwise plain dessert.

Most important, encapsulating Virtual Hard Disk data is a primary reason why most of us have made the jump to virtualization -- but there are some instances where it's a hindrance.

Why encapsulating Virtual Hard Disk data is beneficial
Encapsulating the thousands of Windows operating system files into a single virtual disk file offers several benefits:

  • backing up a single disk file is extremely easy;
  • with the right software, Microsoft's Volume Shadow Copy Service provider and a backup location, a Virtual Hard Disk backup provides a point-in-time copy of a virtual machine's exact state; and
  • restoring a virtual machine (VM) to that exact state requires resurrecting a single file from your backup tapes.

Hyper-V storage resources
Installing Hyper-V storage disks: Best practices

Live Migration: Troubleshooting storage and network configurations

Virtual disk performance and VM snapshot issues in Microsoft Hyper-V  
Additionally, managing a single file is substantially easier. With 10 VMs, for example, you have only 10 or so virtual disk files to manage. As a result, storing these files in a single location on your storage area network (SAN) allows multiple hosts to access them. This multiple-host configuration allows advanced technologies, such as Hyper-V's Live Migration, to function. Even without Live Migration, relocating a disk file from one host to another involves copying only one file rather than the thousands that make up an OS instance.

Also, storing a single file is easy. A thin-provisioning configuration, for example, requires only as much storage as the file needs. Because the dollars-per-gigabyte cost of today's SANs are more expensive than traditional storage, thin provisioning on SANs and within Virtual Hard Disk files is the most efficient use of your available space.

With all these benefits, you'd probably think that encapsulation is the best method for managing VM disk space. If so, then why does Microsoft tout the ability to create pass-through disks in Hyper-V?

Pass-through disks: An unencapsulated VHD format
A pass-through disk in Hyper-V is a disk that has been exposed to a Hyper-V host, as part of an iSCSI logical unit number or a Fibre Channel connection. They are called pass-through disks because they aren't exposed to VMs by default. Instead, they are exposed to a Hyper-V VM host then "passed through" a host to a specified VM.

To complete the process, a connection is created in the VM's properties through the Hyper-V Manager console. After that, a VM can initialize, format and use the disk as though it were local.

The most important characteristic of pass-through disks (and in many ways, why it exists) is that Virtual Hard Disk data is stored in an unencapsulated format. Essentially, a pass-through disk operates like a run-of-the-mill local disk: Data is stored as individual files and folders on its volume.

At first, this method may seem counterintuitive to connect storage to VMs. By attaching an unencapsulated volume to a VM, you revert to a time when you couldn't enjoy all the benefits of virtualization discussed at the beginning of this article. But an encapsulated Virtual Hard Disk data format is not always advantageous.

A file system's disk drive, for example, is a great candidate for encapsulation. You probably want the ability to restore from point-in-time backups when the server experiences a problem or crashes. But the data associated with that file server is usually on a different volume. As a result, if you want to restore the file system's data, it's probably easier to restore the individual files than perform a full point-in-time recovery.

Therefore, encapsulating the file server data into a Virtual Hard Disk file will actually add an extra step to your regular backups. First, you must recall the exceptionally large Virtual Hard Disk file, then find and restore the individual files, which are usually small.

Under these circumstances, it's easier to use pass-through disks. Because pass-through disks are exposed to the host before they're attached to a VM, you can easily change the disk's exposure to another computer -- either physical or virtual -- if its primary home experiences a problem. With a failed file server, your disk files could be quickly repositioned to another file server while you fix the problem.

Similarly, pass-through disks are beneficial for Exchange and SQL databases, as well as other data drives that connect to VMs. Generally, with these data sets, your backup and restoration needs are at the item level and do not require an entire point-in-time recovery. As a result, creating enormous Virtual Hard Disk data files could be your biggest Hyper-V implementation mistake.

Ultimately, decisions about encapsulating Virtual Hard Disk data should be based on your needs and circumstances. Typical organizations, however, might find that storing certain types of data in a more "raw" format will prevent additional data restoration steps.

Greg Shields
Greg Shields is an independent author, instructor, Microsoft MVP and IT consultant based in Denver. He is a co-founder of Concentrated Technology LLC and has nearly 15 years of experience in IT architecture and enterprise administration. Shields specializes in Microsoft administration, systems management and monitoring, and virtualization. He is the author of several books, including Windows Server 2008: What's New/What's Changed , available from Sapien Press.

Dig Deeper on Virtual server backup and storage