Table of ContentsView in Frames

Hyper-V VHD requires alignment for best performance

On a Windows Server 2003, Windows 2000 Server, or Linux virtual machine, a Hyper-V virtual hard drive (VHD) partitioned with a master boot record (MBR) needs to be aligned with the underlying LUN for best performance. Use the Data ONTAP PowerShell Toolkit to check and correct MBR partition alignment on VHDs.

If the data block boundaries of a disk partition do not align with the block boundaries of the underlying LUN, the storage system often has to complete two block reads or writes for every operating system block read or write. The additional block reads and writes caused by the misalignment can cause serious performance problems.

The misalignment is caused by the location of the starting sector for each partition defined by the master boot record. Partitions created by Windows Server 2003, Windows 2000 Server, and Linux are usually not aligned with underlying NetApp LUNs. Partitions created by Windows Server 2008, 2008 R2, 2012, and 2012 R2 should be aligned by default.

Use the Get-NaVirtualDiskAlignment cmdlet in the Data ONTAP PowerShell Toolkit to check whether partitions are aligned with underlying LUNs. If partitions are incorrectly aligned, use the Repair-NaVirtualDiskAlignment cmdlet to create a new VHD file with the correct alignment. The cmdlet copies all partitions to the new file. The original VHD file is not modified or deleted. The virtual machine must be shut down while the data is copied.

You can download the Data ONTAP PowerShell Toolkit at NetApp Communities. Unzip the DataONTAP.zip file into the location specified by the environment variable %PSModulePath% (or use the Install.ps1 script to do it for you). Once you have completed the installation, use the Show-NaHelp cmdlet to get help for the cmdlets.

Note: The PowerShell Toolkit supports only fixed-size VHD files with MBR-type partitions. VHDs using Windows dynamic disks or GPT partitions are not supported.

The PowerShell Toolkit requires a minimum partition size of 4 GB. Smaller partitions cannot be correctly aligned.

For Linux virtual machines using the GRUB boot loader on a VHD, you must update the boot configuration after running the PowerShell Toolkit.