Why Disk Alignment is important (and how to fix a misaligned VM)

Your disk system and your Windows VMs may be running slower than necessary.  Some simple steps can help to improve disk performance by 9 – 13% in your virtual infrastructure.

By now many are familiar with the disk alignment issue but a quick recap.  DBA’s and Exchange admins are very familiar with this concept as they need to drive disk performance for their databases.  The same principle applies to virtualization.  Here we go…

UPDATE:  11/3/11 — Take a look at Nick Weaver’s free UBERAlign tool which can diagnose and correct alignment issues.

The graphic above shows the three layers at issue.  There are the SAN blocks at the bottom, then the VMFS blocks in the middle, and then the NTFS blocks used by the Windows VM.  If these three layers are not aligned, your SAN may be working harder than it needs to.  For example, a call to read a single NTFS block may require the SAN to read three blocks as shown below:

That’s not very efficient.  What would be ideal is for these layers to be aligned so that a single NTFS block requires only one SAN block to be read as illustrated below:

These graphics were taken from the ESX 3 whitepaper, Recommendations for Aligning VMFS Partitions

Let’s talk about how to fix this at both the VMFS and NTFS levels.

VMFS Alignment

When VMFS volumes are created by the vSphere client, they are aligned on a 64K boundary.  Check your SAN vendor’s documentation but in most cases the default 64K boundary will work.  For more details, consult the Performance Best Practices for vSphere 4.0 whitepaper.

NTFS Alignment

By default Windows 2003 and older will align on 32K which will not be aligned with the 64K VMFS layer.  Windows 2008 solves this problem by aligning on a 1024K boundary – this works because 1024K is divisible by 64K.   For example:

  • 32K (NTFS) / 64K (VMFS) = 0.5 = not aligned.
  • 1024K (NTFS) / 64K (VMFS) = 16.0 = aligned.

As long as there is no fractional remainder in this exercise, the two layers are aligned.

Now that we understand the problem and how it impacts performance, let’s focus on determining what VM’s have the problem and ways to fix it.

IDENTIFYING THE PROBLEM

VM’s running Windows 2008 or later should already be aligned as noted above.  If a VM is running Windows 2003 you can check for alignment by one of three ways:

1)      Use the list partition command within Microsoft’s DISKPART utility.

2)      Create a WMI query for the desired attributes by running the following command:

wmic partition get BlockSize, StartingOffset, Name

The output will be in bytes so just divide by 1024.  A 64K aligned partition will have a starting offset of 65536.

3)      Use Vizioncore’s free vOptimizer Wastefinder utility which can scan and identify all your VM’s for misalignment.

#1 or #2 will work fine if you just want to check a specific VM, but Vizioncore’s free utility may be the quickest way to scan your entire environment.

CORRECTING ALIGNMENT PROBLEMS

Once you create a Windows partition you can’t easily change the alignment.  If you are deploying a new Windows 2003 VM, you can use the DISKPART utility to force alignment on a 64K boundary (align = 64).

But what about existing Windows 2003 servers which are not aligned?  One way would be to create new aligned partitions in a new VM and restore/rebuild everything to the new VM, but that’s time consuming and risky.

Vizioncore offers two products which can solve this problem for non-aligned Windows 2003 VM’s:

1)       Vizioncore vOptimizer Pro

This is the full version of the free Wastefinder utility mentioned above.  This product can automatically re-align VM’s on a 64K boundary.  In addition it can resize VMDK’s on a reoccurring schedule in order to significantly reduce storage capacity.

2)      Vizioncore vConverter 5.0

This updated version of vConverter will now automatically align on a 64K boundary while performing either a P2V or a V2V migration.  You can use this tool to perform V2V migrations, which will result in aligned disks.  As far as I am aware this is the only P2V/V2V tool that will automatically realign the target VM on a 64K boundary.

And there you have it in a nutshell.  Two other issues I’d like to quickly point out.

First, you may have a number of Windows 2008 VMs, but if a misaligned VM of any OS is on the same VMFS volume, it could potentially be impacting disk performance for all the VM’s on that volume.

Second, just because a VM is running Windows 2008 it may still be unaligned.  If you did an in-place upgrade of Windows 2003 to Windows 2008 the disk partitions were never modified.  You’ll need to either rebuild the VM or use one of the methods above to correct it.

41 Responses to Why Disk Alignment is important (and how to fix a misaligned VM)

  1. Pingback: Good reasons to upgrade to Windows 2008 R2 | Blue Shift

  2. Pingback: Blog Notes | Blue Shift

  3. asley simp says:

    Great post!!!, thanks

  4. Vision Solutions Double-Take Availability Virtual Recovery Assistant and Double-Take Move all have this functionality. Virtual recoveries made from images backed up using the Double-Take RecoverNow disk-to-disk backup are also realigned during recovery.

  5. Hussain says:

    Hello,
    Great Post. But I have a question, just to understand the requirement of the VMFS/VMDK alignment.

    By default, if VMFS created using vCenter, it will give you an options to change the block size. Default block size is 1 MB. Does it mean that in any VMFS formatted with 1 MB block size, maximum vmdk can hold is 256 GB?

    What if an admin created all the VMFS with the default block size which is 1 MB and on that VMFS he stored 400 and 800 GB of VMDK. Does those VMDKs needs to be moved to another vmfs datastor formatted with higher block size, such is 4 MB block size?

    Thanks,

  6. mvoss18 says:

    If a VMFS is formatted with a 1MB block size, the max size of a single VMDK file is 256GB. If you wanted to have anything bigger, you’d need to move the VMDK to a VMFS with a bigger block size to expand the VMDK beyond 256GB.

    1MB: max 256GB
    2MB: max 512gb
    4MB: max 1024gb
    8MB: max 2TB-512b

    Although, this has nothing to do with alignment.

  7. Pingback: Seminar: Storage for Virtual Environments, Cleveland OH – Stephen Foskett, Pack Rat

  8. Pingback: My Bookmarks » Tintri’s Spiffy and Pricey Storage Array

  9. Pingback: Tintri’s Spiffy and Pricey Storage Array | Kaiusee.com

  10. Pingback: Tintri’s Spiffy and Pricey Storage Array | مطالب جالب|موتور جستجوگر|بهترین ها

  11. Pingback: Tintri’s Spiffy and Pricey Storage Array | TechDiem.com

  12. Pingback: eXactBot Hosting Solutions » Tintri’s Spiffy and Pricey Storage Array

  13. Pingback: Tintri’s Spiffy and Pricey Storage Array | All about Android And

  14. Pingback: Tintri’s Spiffy and Pricey Storage Array | Scripting4U Blog

  15. sina88 says:

    This is a smart blog. I mean it. You’ve so much understanding about this issue, and so much passion. You also know how you can make individuals rally behind it, clearly from the responses. Youve got a style here thats not too flashy, but makes a statement as big as what youre saying. Fantastic job, indeed.

  16. cwjking says:

    Is there anyway to do change this offset with diskpart without having to blow away the system drive?

    I got alot of windows 2003 templates I will have to do this on – after I was told everything was fine…..

    I would like a good workaround even if I have to boot into PE and run disk part that is still better then starting from groundzero… anyways here is a to a way out of this mess…

  17. Pingback: Free UBERAlign Tool for Identifying and Correcting VM Disk Alignment Issues | Blue Shift

  18. Pingback: Align Virtual Machines with VMware Converter 5.0 » Another Day In IT

  19. Ritesh Parab says:

    Great Article  🙂
     
    I have created a basic script to find dirty unaligned disk from list of server.
     
    # Writer = Ritesh Parab# Aim = To find dirty disk alignments from list of servers# Version = 1.0 cls$comps = gc “D:WintechDisk Alignmentserverlist.txt” foreach ($comp in $comps){ $rtn = Test-Connection -ComputerName $comp -Count 1 -Quiet     IF($rtn -match ‘True’){ $partitions = Get-WmiObject -Class Win32_DiskPartition -ComputerName $comp foreach ($partition in $partitions){  $Detail = New-Object PSObject                                                   $Detail | add-member Noteproperty SystemName $partition.SystemName -Force                             $Detail | add-member Noteproperty DiskName $partition.Name  -Force                 $Detail | add-member Noteproperty DiskOffset $partition.StartingOffset -Force    $result = $partition.StartingOffset / 4096 if ($result -eq “0”){    $resultOK = “OK” $Detail | add-member Noteproperty Align $resultOK -Force   $Detail  $resultOK = $null   }  else{  $resultKO = “KO” $Detail | add-member Noteproperty Align $resultKO -Force   $Detail  $resultKO = $null }  } } Else { Write-host “$comp Offline” -ForegroundColor Red }}
     
    -Ritesh
     

  20. Pingback: Dynamic Disk Offset Does Not Favor Alignment « Wahl Network

  21. Pingback: Windows Server 2012 Native 4K Disk Sector Support | vm360degree

  22. Pingback: Why Disk Alignment is important (and how to fix a misaligned VM) « Rui Abel Blog

  23. We enter detail to spell out each an individual and a lot of the benefits that all offers.

  24. Pingback: Aplicaciones útiles para entornos VMware

  25. Pingback: Advaned Format, hyper-v, Hyper-v Storage, Native 4K, Windows Server 2012 | win2012

  26. オメガ アンティーク ベスタル 時計 http://www.dg81.com/

  27. Hello, I еnjoy reading all of your article. Ilike
    to write a little сomment to sսpport you.

  28. Edna says:

    Fantastic beat ! I wih to apprentice while you amend your
    site, how ccan i subscribe for a blog web site?
    The account aided me a acceptable deal. I were tiny bit familiar of this your broadcast offered bright clear idea

    my homepage … quote (Edna)

  29. Mike says:

    Can anyone confirm the md5 or sha-1 of the uberalign console and ova downloads? The download links from here no longer work
    http://nickapedia.com/2011/11/03/straighten-up-with-a-new-uber-tool-presenting-uberalign/
    but I found the files elsewhere. Can someone confirm these are legit and not a malware loaded version?

    fciv -both UBERAlign-Console_v1.1.10.zip
    //
    // File Checksum Integrity Verifier version 2.05.
    //
    MD5 SHA-1
    ————————————————————————-
    f4c961d02acc19242b9a262bb321f545 b0f2610fa4152ff999e9612a7d9e135e2b39a373 uberalign-console_v1.1.10.zip

    fciv -both valigner_base_.5.110.ova
    //
    // File Checksum Integrity Verifier version 2.05.
    //
    MD5 SHA-1
    ————————————————————————-
    9e75027512c43f2899c4971f9629ac44 37754eb4fccd196186620bbde89f5e5693aaf740 valigner_base_.5.110.ova

  30. It’s perfect time to make some plans for the future and it’s time to be happy.
    I’ve read this post and if I could I wish to suggest you some interesting
    things or suggestions. Maybe you could write next articles referring to this article.
    I wish to read even more things about it!

  31. twitter says:

    Very nice post. I just stumbled upon your weblog and wanted to mention that I’ve really loved browsing your blog posts.
    After all I’ll be subscribing for your rss feed and I
    hope you write once more very soon!

  32. What’s Going down i am new to this, I stumbled upon this I have
    found It positively useful and it has helped me out loads.
    I am hoping to give a contribution & aid different customers like
    its aided me. Great job.

  33. There is an advantage to a personal meeting because it causes
    the representative to have a personal interest
    that is lacking in internet communications.

  34. Pingback: Anonymous

  35. Farmacologica cialis disfunzione acquisto rx farmacia italia sicura posologie terapia pillole singole erettile levitra

  36. proxy list says:

    Hi there,I log on to your new stuff named “Why Disk Alignment is important (and how to fix a misaligned VM) | Blue Shift” daily.Your writing style is witty, keep doing what you’re doing! And you can look our website about proxy list.

  37. wp.pl says:

    When someone writes an piece of writing he/she retains the thought of a user in his/her mind that how a user can know it.
    So that’s why this piece of writing is outstdanding. Thanks!

  38. doctor says:

    It’s a shɑme you don’t have a donate button! I’d most
    certainly donate to thіs brilliant blog! I suppose for now i’ll settle for bookmarkіng and adԀing your RSS feed to my Google account.

    I look foгward to brand new updateѕ and will
    shɑre this sitе with my Facebook group. Chat soon!

Leave a Reply

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