WS2012 Hyper-V – Choosing Between Disk Types

The Performance Tuning Guidelines for Windows Server 2012 document is available and I’m reviewing and commenting on notable text in it.

There are 2 layers to this decision.  Question 1, which of the following disk formats do you want:

  • Passthrough: A raw LUN that is formatted and used by the VM.  It is immobile.  With the 64 TB VHDX around, there are only 2 valid reason to use this in the real world: you need to share a LUN via iSCSI/Virtual HBAs to create a guest cluster, or you are in a very rare situation where a 64 TB VHDX is not big enough.
  • VHDX: A 4K sector aligned virtual hard disk that gives great performance and can scale out to 64 TB.  It supports unmap on virtual SCSI controllers.  It has protection against data corruption during power outages thanks to built-in metadata structures.
  • VHD: The legacy virtual hard disk that you can use on Windows Server 2012. It supports RMW on WS2012, but moving that disk to W2008 R2 loses that functionality.

You can convert a VHD into VHDX and vice versa. The VM must be powered down.  You can use the Copy Content Of The Specified Virtual Hard Disk action to suck up the contents of a non-RMW VHD into a new VHD.  You can create a new VHD/VHDX by using the Copy The Contents Of The Specified Physical Disk in the same New Virtual Hard Disk Wizard.

Microsoft says:

When you upgrade to Windows Server 2012, we recommend that you convert all VHD files to the VHDX format due to these benefits. The only scenario where it would make sense to keep the files in the VHD format is when a virtual machine has the potential to be moved to a previous release of the Windows Server operating system that supports Hyper-V.

When you work with VHD or VHDX (both are virtual hard disks and both loosely can be referred to as VHDs) then you have 3 types of virtual hard disk:

  • Fixed: This is the best performing of the VHD types, running at nearly the speed (around 96-98%) of the physical disk beneath. In the VHD type, it is fully created and zeroed out.  This takes up the space and takes time.  Exceptions to this rule: VHDX with new functionality doesn’t actually create a full sized disk.  ODX enabled SANs will greatly accelerate the creation of Fixed virtual hard disks.
  • Dynamic: This is a file that starts out small and grows as you add data to it.  The VHDX format uses larger blocks for this growth, offering better growth performance. There are more IOPS when growing this type of VHD than you get with normal operations in Fixed VHD.  Because the disk is growing, it is also prone to fragmentation, further impacting performance.  These factors can reduce application performance; I and others have seen 20% hits on SQL reports.
  • Differencing: You create a parent disk (usually with a generalised OS) and create VHDs (usually in VDI VMs) that use the parent as their starting point.  Differences are stored in the differencing disk, which starts with no data, and grows to store the unique data.  This comes with a performance hit as with the Dynamic type.  The parent disk also will have lots of Input operations because it is the source or common denominator.  This type is how MSFT deploys pooled VDI VMs.  It is not suitable for personal/assigned VDI VMs or server VMs because you cannot upgrade/resize the parent and inherit the changes; you have to delete the lot and start again.  Note that snapshots (AKA checkpoints) use differencing disks known as AVHDs.  This is the worst performing of the VHD types.

Microsoft says:

When using the VHD format, we recommend that you use the fixed type because it has better resiliency and performance characteristics compared to the other VHD file types.

When using the VHDX format, we recommend that you use the dynamic type because it offers resiliency guarantees in addition to space savings

The fixed type is also recommended, irrespective of the format, when the storage on the hosting volume is not actively monitored

The only pro-Dynamic argument here is disk space.  We’ve been told that Fixed VHDX will save disk space anyway.  MSFT told us to use Dynamic after the release of W2008 R2, and many of us were stung, identified the fault in System Center, and converted to Fixed to successfully fix the issue.  I’m still leaning to Fixed over Dynamic, even in VHDX because of the fragmentation issue.  There is still an increase in IOPS when expanding Dynamic, which is not experienced in Fixed.  On Dynamic disk performance, Microsoft says:

When a block is first written to, the virtualization stack must allocate space within the VHD file for the block, and then update the metadata. This increases the number of necessary disk I/Os for the Write and increases CPU usage. Reads and Writes to existing blocks incur disk access and CPU overhead when looking up the blocks’ mapping in the metadata.

The choice between VHD types simple in a production environment:

  • If you are doing pooled VDI then use Differential disks
  • If you favour saved space over performance, then choose Dynamic VHD
  • If you favour performance over save space (unless you have VHDX on supporting h/w) then use Fixed VHD

5 thoughts on “WS2012 Hyper-V – Choosing Between Disk Types”

  1. With dedup becoming a standard, I don’t think space saving will be quite as critical. The stinging points for me are getting the fast VM deployment times that Dynamic disks give, whilst avoiding the disk-performance penalty that also comes with Dynamics disks.

    Windows VMs also allow partition resizing, so starting with small fixed VHDs and growing later on is not such an issue.

    Are you able to shrink VHDs natively now or would you still need 3rd party tools?

  2. Can you expand on your statement about Fixed disks: “Exceptions to this rule: VHDX with new functionality doesn’t actually create a full sized disk.”?

    We are currently a VMware/SAN shop, but we are looking at Hyper-V. We currently use VMware’s ‘Thick Provisioned, Lazy Zero’ and it works perfectly for us. So we’re trying to determine if Fixed disk is closer to the Eager Zero or can we get closer to the Lazy Zero.

    Thanks.

Leave a Reply to Ryan Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.