You are on page 1of 2

One of the reasons I like to use the SDCLI to create disks is that it takes care of all the little

details like
Disk Alignment for you. If you choose not to use SnapDrive, and instead map the LUN, create a
partition, and format it yourself, then one of the things you must consider is Disk Alignment. Microsoft
has made great improvements in Disk Alignment in Windows 2008. For prior Windows versions, or
hosts in VMs for that matter, you may want to check to see if your partitions are properly aligned. One
way to do that, of course, is the DiskPart utility at the command line. Navigating that beast to check
each partition when you have a hundred or so attached LUNs can be cumbersome to say the least.
Not to worry; you can easily use PowerShell to check the alignment of partitions on local or remote
hosts. I whipped up demonstration just this morning. It only took a few minutes.
I use the wmiobject win32_DiskPartition to get the information I want. I pipe that to Format-Table,
displaying the Name property and a hash table that includes the expression Ive evaluating:
Get-WmiObject Win32_DiskPartition | FT Name, @{Label="Aligned";
Expression={if($_.StartingOffset%4096 -eq 0){$True} else {$False}}} auto
You can run it on the local host,

Or you can add ComputerName to run it on a WinRM enabled remote host:

The choice is yours, but the result is the same. Here Ive intentionally created a misaligned LUN. Can
you spot it?

Happy Scripting
John

You might also like