Microsoft – SQL Server – Storage – Disk Alignment (via DiskPart Scripting)


As part of a Storage I/O review, discussions whether our disks are properly aligned came back up.

The specific Knowledge Base article that I was pointed to is :

How to diagnose misaligned I/O on Windows hosts

It is a recently published NetApp article; as its publish date is 2013.02.27.

Though a short article, there is a lot in it.

There are two areas that I will like to cover in this posting; those areas are StartingOffset and Partition Style.

Starting Offset:

Depending on the Version of Windows (OS Version) , Partition Style, and your LUN size, your gold standard for “Starting offset” appears to vary a bit.

Here are the Numbers published by NetApp:

  • For Windows MBR, this number should be 32256, 31.5kb offset is used when the LUN is created with the Windows LUN type (31.5 * 1024 = 32256).
  • For Windows GPT, this number should be 65535 bytes for LUNs smaller than 4GB or 1048576 bytes for LUNs that are 4GB or larger.
  • For Windows 2008+, this number should be 65535 bytes for LUNs smaller than 4GB or 1048576 bytes for LUNs that are 4GB or larger

In summary:

  • Windows MBR, 32556
  • Windows GPT, disk size < 4 GB, then 65535 : else disk size >=  4GB, then 1048576


There are a couple of procedures you can employ to determine your Starting Offset:

  • Windows Management Interface (WMI)



wmic partition get BlockSize, StartingOffset, Name



OS version

Starting Offset

  • On the disk we are most interested in, Disk 4, our Starting Offset is 1048576.  That number matches up with NetApp guidance.

Partition Style:

Microsoft supports a couple of partition styles, MBR and GPT.

  • MBR — Legacy partition
  • GPT – new partition

There a couple of ways to determine your partition style:

  • GUI – Disk Management
  • DiskPart / list disk

Partition Style – Detect via Disk Management

Here are the steps:

  • Launch “Computer Management”
  • On the left panel, transverse to “Storage” \ “Disk Management”
  • The list of available disks are displayed on the right panel
  • On the right panel, select the disk you are interested in — make sure you select the physical disk, and not logical disk
  • Right click on your selected physical disk, and select “Properties” from the drop-down  menu
  • Notice that the name of the window that shows up will very based on whether this is a local disk, a SAN disk and the Disk Vendor
  • Proceed to the “Volumes” tab

Here is what shows up for us:

NetApp Device Properties

Partition Style – Via DiskPart / listdisk

Here are the steps:

  • Launch OS Shell
  • Start diskpart interactively (diskpart)
  • Issue “List Disk

DiskPart - List disk


To determine which disks are GPT, follow the GPT column.

If a disk has the asterisk symbol, then it is GPT. Else, it is not…

The two checks we performed conclusively affirm that our “Disk 4” is in fact MBR.  How could this be:

So went back and looked at our scripts:

select disk 4
create partition primary align=1024
assign letter=V
format fs=ntfs unit=64k label="Disk - Temp" quick

The script looks good:


Googled some more and found out what is wrong:

  • The Create partition syntax does not allow us to directly set the Partition Style


To correct your script for the future, have it resemble something along the likes of:

select disk 4
convert gpt
offline disk
online disk
attribute disk clear readonly
create partition primary align = 1024
assign letter=V
format fs=ntfs unit=64k label="Disk - Temp" quick

Please show and demonstrate extraordinary care when preparing to issue the script above:

  • Make sure you have selected the right disk (Select disk 4)
  • Notice the use of “clean” — It destroys the disk
  • Convert gpt –> Converts the partition to gpt; the default is mbr
  • Notice the use of “attribute disk clear readonly”; It says to the disk remove the armor you place on formatted and in-use disk

Why GPT:


Is there a performance penalty with choosing either MBR or GPT as your Partition Style. Googled for help, and there does not appear to be.

Please keep in mind that the partition style does not affect the way your data is written out, it has more to do with your partition table.

And, Microsoft will not let you get away with a wrong choice (ie MBR) for disks bigger than 2TB.




References – GPT ( Processing)

References – Vendor

References – Vendor – NetApp:

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s