page contents

About the Post

Author Information

HOW TO: Create a New Partition or Volume with SQL Server in mind

This article will show you how to create a new primary partition using Disk Management and Diskpart (preferred) in Windows from an empty unallocated partition or volume. This is in line with Disk Partition Alignment Best Practices for SQL Server article.

Partition Alignment in Windows Operating Systems

The way partition alignment works depends on the version of Windows being used and the version in which the partition alignment was created. The following sections describe how partition alignment works in Windows Server 2008, the Windows Vista® operating system, and Windows Server 2003 and earlier.

Windows Server 2008 and Windows Vista: New Partitions

In Windows Vista as well as Windows Server 2008, partition alignment is usually performed by default. The default for disks larger than 4 GB is 1 MB; the setting is configurable and is found in the registry at the following location:


However, if OEM setups are delivered (for example, with recovery partitions), even fresh installations of Windows Server 2008 having partitions with undesirable partition starting offsets have been observed.

Whatever the operating system, confirm that new partitions are properly aligned.

Windows Server 2008: Pre-existing Partitions

New partitions on Windows Server 2008 are likely to be aligned. Yet partitions created on earlier versions of Windows and become associated with Windows Server 2008 maintain the properties under which they were created. That is, in the absence of partition alignment being explicitly performed, these partitions are not aligned.

Windows Server 2003 and Earlier

Partitions created on versions of Windows up to and including Windows Server 2003 by default are not aligned. Partition alignment must be explicitly performed.

With that being said let’s get back on track to creating new volumes.

A primary partition is a type of partition created on a hard drive that can have an operating system installed on it. A primary partition functions as though it were a physically separate hard drive. By default on a basic MBR disk, you can create a maximum of 4 Primary partitions, or 3 Primary partitions and 1 Extended partition with up to 128 logical volumes in the extended partition on a single hard disk.

NOTE: You must be logged on in an administrator account for these commands to work.

If you disable the Disk Defragmenter service, then you will get the error below when you try to do anything in Disk Management. If you get this error, then make sure that the Disk Defragmenter service is set to only Manual.

To fix this issue, open services.msc and right-click on the Disk Defragmenter service to go to properties. Change the startup type and seen below:

OPTION ONE - Using Disk Management

Open Server Manager, in the left pane under Storage, click on Disk Management. As you can see I have 2 disks that are not formatted or assigned a drive letter. The first step to creating a volume, you will need to initialize your disk as seen below:

In the middle pane, right-click on the empty unallocated partition or volume and click on New Simple Volume.

This will launch the Wizard. Click on the Next button

Type in how many MB (1 GB = 1024 MB) you want to use from the unallocated partition to create the new partition with, then click on the Next button.
NOTE: If you want to use all of the unallocated partition to create the new partition with, then type all of the maximum disk space shown for the unallocated partition. If you do not use all of the maximum disk space, then you can use the left over space from the unallocated partition to create another partition.

Select an available drive letter that you want to be assigned to the new partition in Computer, then click on the Next button.

Type in a volume label name that you want for the new partition, check the Perform a quick format box, and click on the Next button.

Click on the Finish button.

The new primary partition or volume has now been created with the assigned unallocated partition space.

OPTION TWO - Using Diskpart in an Elevated Command Prompt
Open an Elevated Command Prompt by right clicking on your start menu’s command prompt:
In the elevated command prompt, type diskpart and press Enter, type list disk and press Enter. 
 In the elevated command prompt, type select disk # and press Enter.
NOTE: You would substitute # for the disk number listed that you want to create a new partition with the free unallocated space there. For example, I want to create a new partition with the 40 GB of free space, so I would type select disk 2 and press Enter.
In the elevated command prompt, type create partition primary and press Enter.
NOTE: This will create a new blank RAW partition with selected disk (#2) that contains the unallocated partition free space.
In the elevated command prompt, type assign letter=# and press Enter.
NOTE: This will set the drive letter for you and in my case I used assign letter=h. 
Caution: Realigning partitions using any tool is a destructive operation, because it wipes out existing data. Here is a template for using diskpart.exe to perform partition alignment, assign a drive letter, and format a partition.
In the elevated command prompt, type format fs=ntfs unit=64k label “SQL Data” nowait and press Enter.
NOTE: Having quick added at the end of the command will do a quick format instead of a full format on the new blank RAW partition (step 6) to make it a new partition.
NOTE: This option “nowait” initiates asynchronous formatting, so that the formatting of multiple partitions can begin one after another, allowing the operations to proceed in parallel. The format option is not available in Windows Server 2003.

Diskpart can be executed directly from the command line or scripted. The /s switch specifies an input script file.

Tags: , , , , ,

Comments are closed.

Copy Protected by Chetan's WP-Copyprotect.