Data ONTAP PowerShell Toolkit - About Disk Alignment

by Frequent Contributor on ‎2010-06-09 10:23 AM
Comments

One thing to note is if you create a LUN using the CLI, Filer View, System Manager, or Provisioning Manager (basically anything accept SnapDrive) as long as you choose "Windows" as the LUN type your disk will be aligned to the OS even though the OS will report it as being not aligned.  The reason for this is NetApp adjusts the offset on the array side so it matches the alignment in Windows.

Frequent Contributor

Yeah, but then you have to online it, give it a type (GPT or MBR), create the partition, then format the partition and give it a drive letter (unless you created it with SDCLI that is).  I do have a sample of how to do this, but it's just so much easier with SDCLI.

J

Not disagreeing with you there!  Just stating that something like this:

Connect-VIServer yourVCsystem

$fileHeader = "System Name" + ";" + "Drive Info" + ";" + "Status"

$outFile = "diskAlignment.csv"

New-Item $outFile -Force -ItemType File

Add-Content $outFile $fileHeader

$allvms = Get-VM | where {$_.PowerState -eq "PoweredOn"} | Get-VMGuest | where {$_.OSFullName -like "*Microsoft*"}

Foreach

($computer in $allvms) {

write-host $computer.hostname  

$driveInfo = Get-WmiObject Win32_DiskPartition -ComputerName $computer.HostName

If ($driveInfo -eq $null) { Add-Content $outFile ($computer.HostName + ", NA, Could Not Connect") }

Foreach ($drive in $driveInfo) {

If (($drive.StartingOffset%4096 -eq 0) -eq $true) {

Add-Content $outFile ($computer.HostName + ", " + ($drive.Name.split(","))[0] + ", Aligned Drive")

}

Else {

Add-Content $outFile ($computer.HostName + ", " + ($drive.Name.split(","))[0] + ", Mis-Aligned Drive")

}

}

}

Could result in false positives since Windows sees the drive as not being alligned when in fact it is alligned on the NetApp array.

Frequent Contributor

Yes, its modulus division.  Divide by 4096 and if there's no remainder it's assumed aligned.  I have no error checking in the sample, so if you can't get the info it could return a false positive.  It's always a good practice to trap errors, and I have left that out of my samples for brevity.  Something to look at going forward.

J

There are two things to consider here.

First, a physical host connecting to a LUN, or a VM with an RDM will use the underlying LUN alignment specified in ONTAP when you create the LUN and will be aligned from that point (well, depending on OS, see below link). This does make me curious though, if I did try to align the LUN would I then cause the file system to have unaligned I/O? I'll have to test that in my spare time

For VMs, partitions on VMFS LUNs or NFS volumes still must be aligned. For the VMFS LUN, you specify VMFS to align VMFS to the array, but XP/2003/Linux will still put it's starting partition offset out of alignment with that. For RDMs (as well as physical), the answer evidently is, it depends on the OS type, see here -> http://blogs.netapp.com/storage_nuts_n_bolts/2010/03/lun-types-and-linux-partition-alignment.html.

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.