Alignment changes in Windows 2008 and 2008 R2

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.

 

clip_image001

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…

 

BlockSize Index Name StartingOffset

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.

 

clip_image002

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.

 

clip_image003

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…

 

BlockSize Index Name StartingOffset

512 0 Disk #1, Partition #0 1048576

512 0 Disk #0, Partition #0 1048576

 

 

The twist comes when we convert to dynamic.

 

clip_image004

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.

 

BlockSize Index Name StartingOffset

512 0 Disk #1, Partition #0 32256

 

 

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.

 

Robert Mitchell

Senior Support Escalation Engineer

Microsoft Enterprise Platforms Support

 

If you enjoyed my blog entry you can find others like it using the following links.

 

https://blogs.technet.com/askcore/archive/2010/02/18/understanding-the-2-tb-limit-in-windows-storage.aspx

https://blogs.technet.com/askcore/archive/2009/10/16/the-four-stages-of-ntfs-file-growth.aspx

https://blogs.technet.com/askcore/archive/2009/12/30/ntfs-metafiles.aspx

https://blogs.technet.com/b/askcore/archive/2010/08/25/ntfs-file-attributes.aspx

https://blogs.technet.com/b/askcore/archive/2010/10/08/gpt-in-windows.aspx

https://blogs.technet.com/b/askperf/archive/2010/12/03/performance-counter-for-iscsi.aspx

https://blogs.technet.com/b/joscon/archive/2011/01/06/how-hard-links-work.aspx

https://blogs.technet.com/b/joscon/archive/2011/08/26/more-on-hard-links.aspx

https://blogs.technet.com/b/askcore/archive/2011/04/07/gpt-and-failover-clustering.aspx