Virtualization: Understanding Hyper-V Virtual Disks

By Doug Lowe

Every Hyper-V virtual machine must have at least one virtual disk associated with it. A virtual disk is nothing more than a disk file that resides in the file system of the host operating system. The file has one of two file extensions, depending on which of two data formats you choose for the virtual disk:

  • .vhd: An older format that has a maximum virtual disk size of 2TB

  • .vhdx: A newer format that can support virtual disks up to 64TB

For either of these virtual disk formats, Hyper-V lets you create two different types of virtual disks:

  • Fixed-size disk: A virtual disk whose disk space is preallocated to the full size of the drive when you create the disk. For example, if you create a 100GB fixed-size disk using the .vhdx format, a .vhdx file of 100GB will be allocated to the drive. Even if the drive contains only 10GB of data, it will still consume 100GB of space on the host system’s disk drive.

  • Dynamically expanding disk: A virtual disk that has a maximum disk space, but that actually consumes only the amount of disk space that is required to hold the data on the disk. For example, if you create a dynamically expanding disk with a maximum of 100GB but only put 10GB of data on it, the .vhdx file for the disk will occupy just 10GB of the host system’s disk drive.

Actually, there’s a third type of disk called a differencing disk, which can be used to track changes made to another virtual disk. But this is an advanced topic that I don’t cover in this chapter.

Don’t be confused by the names fixed size and dynamically expanding. Both types of disk can be expanded later if you run out of space. The main difference is whether the maximum amount of disk space allowed for the drive is allocated when the drive is first created or as needed when data is added to the drive. Allocating the space when the drive is created results in better performance for the drive, because Hyper-V doesn’t have to grab more disk space every time data is added to the drive. Both types of drives can be expanded later if necessary.