Microsoft Enterprise Platforms Support: Windows Server Core Team
EPS Team Blogs
Product Team Blogs
Disk alignment, partition alignment, offset alignment…whatever you like to call it, it was very important back in the Windows 2000/2003 days. Different storage configurations could make use of the Windows ability to align its volumes to predetermined sectors. The benefit was increased disk performance.
This became less of an issue in Windows Vista/2008 as we moved from aligning to sector63 by default to aligning to sector2048. This worked best for nearly all situations. And just like in the previous versions of Windows, you could see how you were aligned by doing a quick WMIC command.
wmic partition get BlockSize, StartingOffset, Name, Index
You’d get an output like this…
BlockSize Index Name StartingOffset
512 0 Disk #1, Partition #0 1048576
512 0 Disk #0, Partition #0 1048576
In my case this shows both my disks having partitions that are aligned to 1024KB…or sector2048.
(1048576 bytes)/(512 bytes/sector) = 2048 sector
For dynamic disks this becomes more difficult. This has to do with understanding the difference between ‘partition’ and ‘volume’. And as often as we use the term ‘partition alignment’ what is really important is ‘volume alignment’. Often these terms ‘volume’ and ‘partition’ are used interchangeably but they aren’t really the same thing.
To illustrate this, we can turn back the clock to Windows XP/2003.
This is a basic disk from Windows 2003. The MBR (Master Boot Record) is always at sector0. The boot sectors mark the start and end of the volume. In this case they ALSO mark the start and end of the partition. The starting point is sector63 (offset 31.5KB) by default. This was done to align to cylinder boundaries that aren’t really important anymore. Now we want to align to make best use of storage cache. But I’ll get to that. The point here is that the volume AND the partition boundaries on the same.
If we ran the WMIC command we could get an output like this…
512 0 Disk #1, Partition #0 32256
512 0 Disk #0, Partition #0 32256
This output tells us that the partition is aligned to sector 63. While this is not the optimum alignment, it is what our older operating systems defaulted to.
(32256 bytes)/(512 bytes/sector) = 63 sector
Next let’s convert to dynamic.
The whole area referred to by the Logical Disk Manager as ‘public length’ is marked off and the partition boundary is changed to include all the sectors that will now be the area usable to dynamic disks. The pre-existing volume does not move. It still starts at sector63 (offset 31.5KB).
If we used the WMIC command here, it would still tell us that the volume was aligned to sector63. No difference yet.
Now let’s see how this scenario plays out in Windows 2008. Here is a basic disk.
The notable thing here is that the start of the partition and volume is now defaulting to sector2048 (offset 1024KB). This properly aligns us to utilize cache for most storage solutions. Other than that, no real difference between Windows 2003 and 2008. But this IS the optimum alignment that we are after.
Our WMIC output would give us this…
The twist comes when we convert to dynamic.
Once again the partition boundaries are pushed out to encompass all sectors involved in the ‘public length’. The difference is that now we need to push both boundaries out. And while the pre-existing volume is still correctly aligned to sector2048 (offset 1024KB), the partition isn’t starting at the same location as the volume anymore.
What this means is that even though the volume will get the desired performance boost, the partition isn’t aligned correctly. But it doesn’t matter since it isn’t the partition we care about, it’s the volume.
However, if we ran the WMIC command now it would tell you that the alignment is NOT correct. This is because the command is checking the PARTITION instead of the VOLUME. And there isn’t a corresponding way to check volume alignment.
In fact ANY utility that is querying the starting point of the partition is going to appear to be wrong. But they aren’t. It just isn’t understood the hair splitting difference between ‘partition’ and ‘volume’.
Now there is still a way to use the DMDIAG tool from Windows 2003 to get the volume information we want. The last version of this tool will display volume information…and it works on Windows 2008 and 2008R2. You’d get an output that would include…
---------- LDM Volume Information -----------
Volume Volume Mnt Subdisk Plex Physical Size Total Col Plex Rel
Name Type Nme Name Name Disk Sectors Size Ord Offset Sectors
====== ====== === ======== ========== ========== ======= ======= === ====== =======
Volume1 Simple E Disk1-01 Volume1-01 Harddisk2 209709056 209709056 1/1 0 2048
The ‘relative sectors’ will tell you where the boot sector can be found and thus tells us how the volume is aligned. This tells us that the volume starts as sector2048 which is offset 1048576.
The DMDIAG tool is unfortunately not included in Windows 2008 or 2008R2. But you can copy it from a Windows 2003 system. Or you can trust me that we did the alignment correctly and stop using WMIC to test that it is correct.
I get questions about this subject two or three times a month, so I wanted to take a moment to create a blog entry to hopefully prevent some of these calls. Or at least a quick reference people can use to help explain what’s happening and why it seems that alignment isn’t working correctly with dynamic disks in Windows 2008 and Windows 2008R2.
I hope this helps to clear things up a bit.
Senior Support Escalation Engineer
Microsoft Enterprise Platforms Support
If you enjoyed my blog entry you can find others like it using the following links.
No love for Powershell and Get-WmiObject? :)
"I hope this helps to clear things up a bit."
It does help, thanks. I more or less understood this stuff, but these summaries are very handy.
I think DMDIAG is in the Win2K3 RK Tools collection, which is full of great stuff. Is it possible that toolkit will ever be updated and rereleased?
So can we not use newer versions of Windows to do the partitioning even if we want to put XP/2003 on it?
Also I heard wmic is being deprecated for Windows 8? WTF?
No, you can use newer versions of Windows to partition for downlevel Windows. The basics for how partitions operate hasn't changed.
Also, it is VDS that is getting deprecated. But its still in the Win8/Server2012 release. Microsoft is moving to SMAPI. So Win8/Server2012 will support both.
What about drives that are 3tb? Using the default offset and assigning the offset to 1024 isn't working. The offset is set to 135266304.
Then you are talking about GPT disks and 4k sector disks and that's two whole different subjects. However, if you do the math it will work out to being aligned. Again, you have to find the start of the volume, not the start of the partition. If it is a 4k sector disk, you have to take into account that the sectors are 4096bytes instead of the legacy size of 512 bytes.
Great info. Thanks for the post.
The example uses a single partition on a single drive. What if there are , say, two partitions in a single drive? Should there be some kind of #sectors offset from the beginning? Or does the alignment is only important for the fist one?
For the earlier post, I meant to ask 'should the *second* partition ( or volume) align to some sector numbers'.