commands

^

Test-DbaDiskAlignment

Author Constantine Kokkinos (@mobileck), constantinekokkinos.com
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Test-DbaDiskAlignment on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaDiskAlignment.

Synopsis

Verifies that your non-dynamic disks are aligned according to physical constraints.

Description

Verifies that your non-dynamic disks are aligned according to physical constraints.

Returns one row per computer, partition and stripe size with.

Please refer to your storage vendor best practices before following any advice below.

By default issues with disk alignment should be resolved by a new installation of Windows Server 2008, Windows Vista, or later operating systems, but verifying disk alignment continues to be recommended as a best practice. While some versions of Windows use different starting alignments, if you are starting anew 1MB is generally the best practice offset for current operating systems (because it ensures that the partition offset % common stripe unit sizes == 0 )

Caveats:

  • Dynamic drives (or those provisioned via third party software) may or may not have accurate results when polled by any of the built in tools, see your vendor for details.
  • Windows does not have a reliable way to determine stripe unit Sizes. These values are obtained from vendor disk management software or from your SAN administrator.
  • System drives in versions previous to Windows Server 2008 cannot be aligned, but it is generally not recommended to place SQL Server databases on system drives.

Syntax

Test-DbaDiskAlignment
    [-ComputerName] <DbaInstanceParameter[]>
    [[-Credential] <PSCredential>]
    [[-SqlCredential] <PSCredential>]
    [-NoSqlCheck]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Test-DbaDiskAlignment -ComputerName sqlserver2014a

Tests the disk alignment of a single server named sqlserver2014a

Example: 2
PS C:\> Test-DbaDiskAlignment -ComputerName sqlserver2014a, sqlserver2014b, sqlserver2014c

Tests the disk alignment of multiple servers

Required Parameters

-ComputerName

The target computer or computers.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-Credential

Specifies an alternate Windows account to use when enumerating drives on the server. May require Administrator privileges. To use: $cred = Get-Credential, then pass $cred object to the -Credential parameter.

Alias
Required False
Pipeline false
Default Value
-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential). Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported. For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-NoSqlCheck

If this switch is enabled, the disk(s) will not be checked for SQL Server data or log files.

Alias
Required False
Pipeline false
Default Value False
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False