Exploring .VHD configurations and why/when to use them.

When it comes to Hyper-V virtualization, the .VHD file is all important. It is the virtual equivalent of your entire physical storage system. Fortunately for us, we don’t have the dizzying array of protocols, devices, and formats to worry about. No debate over SCSI vs SATA vs PATA. No concerns over where this file type or that file type should be stored. It is all stored in one place – the .VHD file. There are of course considerations to be made about where you store the .VHD file itself, but we are going to focus on the .VHD file itself for the time being.

A .VHD file can be created during the create virtual machine wizards in Hyper-V management, System Center Virtual Machine Manager and also through PowerShell. We will mostly limit our discussion to using the Hyper-V manager since it is sufficient to cover all the necessary aspects of the .VHD configurations.

The .VHD is again, the virtual representation of what would be the physical storage on a server or PC. When you create a new virtual machine and begin the process of installing an operating system, all of the files that would normally be placed on a physical drive are stored inside of the .VHD file. It is not unlike a .ISO file in that is essentially a wrapper for a bunch of other files contained therein. In fact, with Windows 7 and Windows 2008 R2, you can mount a .VHD file in the Disk Management MMC. (you can also create VHD’s here!) Study Guide!

image

There are several ways you can create a VHD file.

 

When creating a .VHD, it is important to create the appropriate kind of .VHD file for your needs. There are 3 basic types of .VHD files and 1 special case that we will look at here.

Dynamic –

This is the default disk type that gets created when user the Disk Manager MMC and when using the Create Virtual Machine wizard in the Hyper-V MMC

When you create a Dynamic Disk .VHD, you will specify a maximum size for the Dynamic Disk in the wizard. This the maximum amount of data that can be stored in this .VHD file before you are unable to store any additional data. This is similar to partitioning a physical drive. When partitioning a physical drive, you set aside a fixed amount of space and assign a drive letter. You can then add data up to the maximum size of the partition. A .VHD file is essentially a virtual partition in the form of a file that has a maximum size.

When initially created, they will be very small, usually only 256k in size. As you load an operating system or data to the drive, it will increase in size up to it’s maximum. They do not shrink on their own but can be compacted to reduce the amount of space they take up on the physical location where they reside.

Usually, a Dynamic Disk is selected when storage space is at a premium, or when doing testing. It can be leveraged for production works loads where there is not a lot of disk I/O within the .VHD file itself. For many production server work loads, it may be better to select a Fixed Disk for performance gains.

Fixed -

When you create a Fixed Disk .VHD you will specify a maximum size for the Fixed Disk in the wizard. unlike the Dynamic Disk that starts out small and grows as data is added, a Fixed Disk will immediately be the size the size that you specify in the wizard. Actually, “immediately” isn’t entirely accurate. When you click “Finish” the file will get created and then is essentially “formatted” to the size you specified. The larger the size of the Fixed Disk, the longer it will take for the wizard to complete. You will see a progress bar indicating how far into the process you the system is.

If you anticipate a lot of .VHD based disk I/O, you will likely choose fixed disk for performance.

Differencing -

This is a unique configuration and one that confuses many people. It relies on a parent/child relationship between two or more .VHD files. Special care has to be taken with Differencing disks to avoid rendering data unusable. For this one, I think another video is on order.

I hope this post helps you out with the different .VHD file types you can create and when you will want to use them.

There are a couple of other special disk access options that I will address in a future post (Pass-Through disks, Compact/Convert/Expand)

 

Passing the Windows Server 2008 R2 Server Virtualization Exam (70-659) – Part 1

Passing the Windows Server 2008 R2 Server Virtualization Exam (70-659) – Part 2

Passing the Windows Server 2008 R2 Server Virtualization Exam (70-659) – Part 3

Installing and Configuring Host and Parent Settings

Passing the Windows Server 2008 R2 Server Virtualization Exam (70-659) – Part 4

Creating a new Guest Virtual Machine and available configuration options

Passing the Windows Server 2008 R2 Server Virtualization Exam (70-659) – Part 5

I’m a Developer! Why Virtualize?

Passing the Windows Server 2008 R2 Server Virtualization Exam (70-659) – Part 6 – This Post!

Exploring .VHD configurations and why/when to use them

 

Cheers!