Peter Hinchley

Learning in Public

✪ Creating a Striped Volume using DiskPart

I recently installed Windows Server 2012 R2 on a Mac Mini with two solid state hard drives. The operating system was installed on the first drive (using all available space after the required recovery, system and reserved partitions were created). The second drive contained a single data volume from a previous installation (also comprising all available space).

To summarise, I started with 2 disks and 4 volumes. The disks looked like this:

Disk 0  233 GB  GPT  Basic
Disk 1  233 GB       Basic

The volumes looked like this:

Volume 0  C  233 GB  Partition  Boot
Volume 1     300 MB  Partition  Hidden (Recovery)
Volume 2     100 MB  Partition  System
Volume 3  D  233 GB  Partition

And the partitions on disk 0 looked like this (where the final column refers to the boundary offset):

Partition 1  Recovery  300 MB    1 MB
Partition 2  System    100 MB  301 MB
Partition 3  Reserved  128 MB  401 MB
Partition 4  Primary   233 GB  529 MB

A couple of points:

My goal was to reduce the size of the operating system partition, and to use the remaining space on disk 0, and the corresponding allocation of disk 1, to create a single striped volume (i.e. RAID 0).

The first task was to shrink the C: drive to 40 GB. From an elevated command prompt, I ran diskpart, and then used the shrink command, specifying the size in MB by which the volume should be reduced (197632 = 193 GB).

select volume 0
shrink desired=197632

The next task was to wipe the second disk (which held the existing Data volume). I also switched the disk to GPT.

select disk 1
clean
convert gpt

The next step was to reconfigure both drives as dynamic disks (a requirement for creating a striped volume). Unfortunately, there is a catch, for if I were to run the convert dynamic command, a new reserved partition would be created on disk 1 with an offset of 17 KB (instead of 1024 KB). To avoid the misaligned offset, and the associated performance implications, I did the following:

select partition 1
delete partition override
create partition msr size 128

This created the reserved partition required for a dynamic disk with the correct offset. I then configured both drives as dynamic:

convert dynamic
select disk 0
convert dynamic

I then created the striped volume across both disks, using all available space on disk 0 (the same quantity of space will be allocated from disk 1 - leaving 40 GB unused).

create volume stripe disk=0,1

I then formatted and assigned a drive letter to the new volume:

format fs=ntfs quick
assign

As the space allocated to a striped volume must be identical on each disk, and 40 GB of disk 0 was already consumed by the operating system, 40 GB was left unused on disk 1. I created a simple volume to use this remaining space:

select disk 1
create volume simple
format fs=ntfs quick
assign

The disks now look like this:

Disk 0  233 GB  GPT  Dynamic
Disk 1  233 GB  GPT  Dynamic

The volumes look like this:

Volume 0  C  40  GB  Simple     Boot
Volume 1     300 MB  Partition  Hidden (Recovery)
Volume 2     100 MB  Partition  System
Volume 3  D  386 GB  Stripe
Volume 3  E  40  GB  Simple

The partitions on disk 0 look like this:

Partition 1  Recovery          300 MB    1 MB
Partition 2  System            100 MB  301 MB
Partition 5  Dynamic Reserved    1 MB  401 MB
Partition 3  Reserved          127 MB  402 MB
Partition 4  Dynamic Data       40 GB  529 MB
Partition 6  Dynamic Data      193 GB   40 GB

And finally, the partitions on disk 1 look like this:

Partition 2  Dynamic Reserved    1 MB    1 MB
Partition 1  Reserved          127 MB    2 MB
Partition 3  Dynamic Data      233 GB  129 MB

In summary: