Disk Alignment Partitioning: The Good, the Bad, the OK and the Not So Ugly

Lately I’ve been reading about the disk alignment partitioning and performance degragaton that occurs in Windows 2003 when using the wrong partition NTFS partition offset. There is an I/O performance impact of 30 – 40% when disk partitions are not properly aligned. So, this starting me thinking, what is good offset anways and how can I write a Powershell script to verify disk are configurated correctly?
It turns out Windows 2003 uses a 64KB  or 128 sectors (64KB = 128 sectors) so you want to choose 64 or a multiple of 64. However different storage arrays use varying offsets (4, 64, 256, 512) and not only do you have to consider the Windows offset you should also take into account the storage array offsets to ensure they are aligned. Because of the need to consider the storage array offsets, Microsoft KB artcle 929491 recommends a starting offset of 2,048 sectors (1 megabyte). The 2,048 offset cover most storage arrays including EMC Symmetrix and CLARIION which may use a setting other than 64KB depending on the configuration. An offset of 63 which is the detault offset for MBR, is a bad setting. For the boot partition 63 is OK,  but for a SQL Server data and log drive 63 is bad always.
With the question of a good offset answered; 64 might be OK, but 2,048 will cover almost any SAN configuration, I created a Powershell script to verify disk settings. I want to report the system name, logical disk name, partition name, blocksize starting offset, and finally the start sector. The start sector is calucated by dividing the StartingOffset by the value of BlockSize as described in the "More Information" section of KB article 929491. The WMI classes Win32_LogicalDisk and Win32_DiskPartition provide the needed information, however we’ll need to use the association class Win32_LogicalDiskToPartition to link logical disks with partitions. .
Save the script below as a ps1 file, partalign.ps1, and run by specifying the computer name as a parameter ./partalign.ps1 Z002

param ($computer)

$partitions = Get-WmiObject -computerName $computer Win32_DiskPartition

$partitions | foreach { Get-WmiObject -computerName $computer -query "ASSOCIATORS OF {Win32_DiskPartition.DeviceID=’$($_.DeviceID)’} WHERE AssocClass = Win32_LogicalDiskToPartition" |
                add-member -membertype noteproperty PartitionName $_.Name -passthru |
                add-member  -membertype noteproperty Block $_.BlockSize -passthru |
                add-member  -membertype noteproperty StartingOffset $_.StartingOffset -passthru |
                add-member  -membertype noteproperty StartSector $($_.StartingOffset/$_.BlockSize) -passthru } |
Select SystemName, Name, PartitionName, Block, StartingOffset, StartSector


Using the WMI assocation classes is something you won’t have do very often, but its not too ugly. You could construct the Powershell WMI query as one statement, but I found it easier to understand to break up the statments in two parts (Partition, and LogicalDisk). The Win32_LogicalDiskToPartition class returns a Win32_LogicalDisk WMI object which I then add the partition information to using add-member.

I have a few servers with mount points and use the Win32_Volume class for returning space usage information. I haven’t figured out a way to associate mount points to partitions and I don’t think the WMI association classes exist to do so. If anyone knows how to associate mount points with partitions using WMI please post a comment

This entry was posted in PowerShell. Bookmark the permalink.

7 Responses to Disk Alignment Partitioning: The Good, the Bad, the OK and the Not So Ugly

  1. Will says:

    Hi Chad,
    You wrote that “For the boot partition 63 is OK”. Is there any performance difference should it be 64 instead? Having a boot of 63 will not affect any partitions after it will it? Such as the OS/Data partitions.


    • cmille19 says:

      Normally the boot partition should do very little I/O and you’ll have your data on other volumes for things like a database server or Exchange. This is why I say the boot paritition isn’t as important. Each volume has their own offset so the boot partition offset will not effect other volumes.

  2. Will says:

    Thanks for you reply Chad. The above image was taken from a VM Machine, I actually have a 6 HDD Server. I am planning to do a RAID 10 on it. Say, does partitioning Raid improve performance? Or is it purely for management tasks (defrag, virus scan etc.)?

    Also I know the recommended stripe size is 64KB. Is there any performance gains if I higher this to lets say 256KB?
    url referenced: http://msdn.microsoft.com/en-us/library/dd758814(v=sql.100).aspx

  3. cmille19 says:

    I’d suggest checking out this ServerFault post for details on stripe size and RAID level recommendations:


    BTW ServerFault and StackOverFlow are two of my favorite forum sites.

  4. Will says:

    Thanks for the suggestions Chad, great blog man!

Comments are closed.