Provision a Windows Server Storage Spaces Mirrored Volume with PowerShell

Last Update: Sep 04, 2024 | Published: Nov 30, 2014

SHARE ARTICLE

In this easy Ask the Admin, I’ll show you how to quickly set up a Storage Spaces mirrored volume on Windows Server 2012 R2 with the help of PowerShell.

Storage Spaces debuted in Windows Server 2012, and provides storage virtualization capabilities offering flexibility, durability, and scalability once only available in expensive hardware-based storage solutions. While previous versions of Windows Server included software RAID, it was considered inferior to enterprise-grade hardware alternatives.

In contrast, Storage Spaces utilizes advances in Windows Server to provide software RAID that can in many configurations match the performance of hardware RAID, assuming the disks and connecting interfaces are up to the job. If performance isn’t a key consideration, Just a Bunch of Disks (JBOD) can be used to provide fault-tolerant storage.

Storage Spaces doesn’t just do resiliency, but also tiered storage and continuous availability among other things. But in this article, we’ll look at how to mirror a pair of locally attached disks, and create a volume accessible to Windows. For more information on Storage Spaces, see Windows Server 2012: Is Storage Spaces the Killer Feature? and New Features in Windows Server 2012 R2 Storage Spaces on the Petri IT Knowledgebase.

Prepare the Disks

I’m going to use an Azure virtual machine for this demonstration. You can easily perform the following instructions on a server in your home or office lab. Start by attaching two disks to your server. To attach a disk in Azure:

  • Log in to the Azure management portal and click VIRTUAL MACHINES in the menu on the left.
  • Under virtual machines on the right, click the VM you want to add a disk to.
  • Make sure DASHBOARD is selected at the top of the portal, click ATTACH in the grey bar at the bottom of the window, and then click Attach empty disk in the menu.
  • In the Attach an empty disk dialog box, enter the size for the new disk in GB, select NONE under HOST CACHE PREFERENCE and click OK.
  • Wait for the attach operation to complete and then repeat the process to attach a second disk of the same size.

Configure a Mirrored Volume

Now that we have two disks attached to the server, we can configure a mirrored volume using Storage Spaces. Log on to the server and open a PowerShell console with administrative privileges.

First we’ll scan the system for disks that are available for use in a storage pool, and write the array to the $PhysicalDisks variable. Disks available for use in a storage pool belong to what Windows Server calls the primordial storage pool by default. In principal, we could omit the get-storagesubsystem cmdlet here, as it’s likely that Storage Spaces will be the only storage subsystem present on your server.

​
Now we’ll create a new storage pool (StoragePool1) and add the available disks ($PhysicalDisks).
Windows Server Storage Spaces Mirrored Volume with PowerShell
Create a new storage pool using the available disks (Image Credit: Russell Smith)
Because everything in Storage Spaces is software defined, we need to create a virtual disk. The disks I attached to the server are 50GB each in size, but thin provisioning allows me to specify a larger capacity, and add extra disk space later as needed.
Create a new virtual disk and volume (Image Credit: Russell Smith)
Create a new virtual disk and volume (Image Credit: Russell Smith)
The new-virtualdisk cmdlet creates a mirrored pair by default. To create a simple volume with no fault tolerance, add –ResiliencySettingName Simple to the above command. Finally, initialize the disk, create a new volume and format it.
​
 

SHARE ARTICLE