Why Windows Server 2012 Hyper-V VHDX 4K Alignment Is So Important

Back in 2009, ZDNet asked if we were ready for 4K sector drives.  That was because the storage industry is shifting from 512 byte sector drives to 4K sector drives.  And that is going to cause a problem for operating systems and virtualisation that are not ready for 4K sector disks.

To smooth the shift, the storage industry is giving us Advanced Format 512e disks that are physically 4096 byte (4K) sector aligned but emulate 512 byte disks in their firmware.  This wiki page describes how this emulation works.  Note that the read process should not cause performance issues (but might) but the emulated read-modify-write (RMW – 4K is read in, 512 bytes are modified in the 4K, disk is spun, and old 4K is overwritten) process could actually have a significant performance price (Microsoft say 30% to 80%).

4K Physical Sector is shown with 8 chunks of 512 each. Step 1: Read 4K Sector into Cache from Media. Arrow. Step 2: Update 512-byte Logical Sector in Cache (one of 512 blocks highlighted). Step 3: Overwrite previous 4 K Physical Sector on Media.

The following OS’s support 512e drives:

  • Windows 8
  • Windows Server 2012
  • Windows 7 w/ MS KB 982018
  • Windows 7 SP1
  • Windows Server 2008 R2 w/ MS KB 982018
  • Windows Server 2008 R2 SP1
  • Windows Vista w/ MS KB 2553708
  • Windows Server 2008 w/ MS KB 2553708

Eventually we’ll start to see native 4K disks with no emulation.  Microsoft says:

The current VHD driver assumes a physical sector size of 512 bytes and issues 512-byte I/Os, which makes it incompatible with these disks. As a result, the current VHD driver cannot open VHD files on physical 4 KB sector disks. Hyper-V makes it possible to store VHDs on 4 KB disks by implementing a software RMW algorithm in the VHD layer to convert the 512-byte access and update request to the VHD file to corresponding 4 KB accesses and updates.

RMW is bad, mmm-kay!  If you’re on 4K disks (either native or 512e) then you’re going to want 4K aligned virtualised storage to maintain performance.

Only Windows Server 2012 and Windows 8 support native 4K disks (with no 512 emulation) with no emulation.  They also offer us the 4K aligned VHDX file.  That means if you’re using 4K disks (native or 512e) and you want performance, then you should use VHDX files.

Note that vSphere 5.0 does not support 4K disks yet.

Leave a 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.