Initialize, labeling, formatting and mounting disks in windows 2012 R2 for a SQL Server installation

Goal

To check for the available disks and the server /node and to choose the one that will be used for the SQL Server instance.

My way of achieving it

Using powershell. The script requires 2 arguments, one is the instance name and the other is the installation type. I am using Get-Disk to check all available disks which have a partition style of RAW or which don’t have any partitions on them. After the discovery the script is prompting the user to choose the disks and inform him how the disks will be used.

Select the disks for your instance:

– first disk will be used for sql_data_drive

– second disk for the Data01 MP

– third one for Log01 MP

– the fourth one for the Data02 MP

– the fifth one for the Data03 MP and so on

– Example: 1,2,3,4

: 2,3,4,5

Disk 2 with the size of 0.5 GB will be used for SQL Data Drive

Disk 3 with the size of 0.9765625 GB will be used for Data01 MP

Disk 4 with the size of 4.8828125 GB will be used for Log01 MP

Disk 5 with the size of 6.8359375 GB will be used for Data02 MP

After that the disks will be formatted and configured as mount points. Script will check for first available letter and will use the first disk as the base drive for all the other disks that will be mounted on that drive.

The script and a log of an execution are attached here and here