Condividi tramite


Step-by-Step for Mirrored Storage Spaces Resiliency using PowerShell

 
0 - Overview

 

This blog post is a walkthrough of the resiliency offered by Storage Spaces when using mirrored spaces.
For this exercise we have a single virtual machine with multiple data disks used to create the spaces.
The idea is to simulate a number of different failure and recovery scenarios, reviewing the behavior.
It includes the procedure to replace a disk and repair a degraded Space.

Notes and disclaimers:

  • Obviously, putting all virtual disks on a single physical disk won't provide real resiliency.
  • The specific Storage Spaces configuration shown in this blog post is not supported. Microsoft Support will only answer questions and assist in troubleshooting configurations where Storage Spaces uses a physical machine (not a VM) and uses one of the certified JBOD hardware solutions (see https://www.windowsservercatalog.com/results.aspx?bCatID=1573&cpID=0&avc=10&OR=1)
  • Because of the two items above, the configuration described here should only be used for demos, testing or learning environments.

 

1 - Two-way mirror with 3 disks

 

Part 1 of this post focuses on testing the resiliency of a two-way mirrored virtual disk (storage space) on a storage pool with 3 physical disks.
For each section you have the steps to perform (useful if you want to cut/paste), the actual output of the cmdlets on my test system and finally some notes explaining what happened.

 

1.1 - Attach 3 disks to a VM

 

Steps to perform on the host:

 

1..3 | % { New-VHD –Path D:demodisk$_.VHDX –Dynamic –SizeBytes 20GB } | Out-Null

1..3 | % { Add-VMHardDiskDrive –VMName VM2 –Path D:demodisk$_.VHDX -ControllerType SCSI}

Get-VMHardDiskDrive -VMName VM2

 

Output:

 

PS C:> 1..3 | % { New-VHD –Path D:demodisk$_.VHDX –Dynamic –SizeBytes 20GB } | Out-Null

PS C:> 1..3 | % { Add-VMHardDiskDrive –VMName VM2 –Path D:demodisk$_.VHDX -ControllerType SCSI}

PS C:> Get-VMHardDiskDrive -VMName VM2

 

VMName ControllerType ControllerNumber ControllerLocation DiskNumber Path

------ -------------- ---------------- ------------------ ---------- ----

VM2 IDE 0 0 c:demov2.vhdx

VM2 SCSI 0 0 D:demodisk1.VHDX

VM2 SCSI 0 1 D:demodisk2.VHDX

VM2 SCSI 0 2 D:demodisk3.VHDX

 

Notes:

 

Nothing much. Just your regular VM with 1 IDE boot disk and 3 SCSI data disks.

 

1.2 - Create pool and mirrored space

 

Steps to perform on the guest:

 

$s = Get-StorageSubSystem -FriendlyName *Spaces*

$d = Get-PhysicalDisk -CanPool $true
New-StoragePool -FriendlyName Pool1 -StorageSubSystemFriendlyName $s.FriendlyName -PhysicalDisks $d
$p = Get-StoragePool Pool1
Set-ResiliencySetting -StoragePool $p -Name Mirror -NumberofColumnsDefault 1 -NumberOfDataCopiesDefault 2
$p | New-VirtualDisk -FriendlyName Space1 -ResiliencySettingName Mirror –UseMaximumSize

 

$L ="X”
$N = (Get-VirtualDisk -FriendlyName Space1 | Get-Disk).Number
Set-Disk -Number $N -IsReadOnly 0
Set-Disk -Number $N -IsOffline 0
Initialize-Disk -Number $N -PartitionStyle MBR
New-Partition -DiskNumber $N -DriveLetter $L -UseMaximumSize 
Start-Sleep –Seconds 10
Initialize-Volume -DriveLetter $L -FileSystem NTFS -Confirm:$false

 

Output:

 

PS C:> $s = Get-StorageSubSystem -FriendlyName *Spaces*

PS C:> $d = Get-PhysicalDisk -CanPool $true

PS C:> New-StoragePool -FriendlyName Pool1 -StorageSubSystemFriendlyName $s.FriendlyName -PhysicalDisks $d

 

FriendlyName OperationalStatus HealthStatus IsPrimordial IsReadOnly

------------ ----------------- ------------ ------------ ----------

Pool1 OK Healthy False False

 

PS C:> $p = Get-StoragePool Pool1

PS C:> Set-ResiliencySetting -StoragePool $p -Name Mirror -NumberofColumnsDefault 1 -NumberOfDataCopiesDefault 2

PS C:> $p | New-VirtualDisk -FriendlyName Space1 -ResiliencySettingName Mirror –UseMaximumSize

 

FriendlyName ResiliencySettingNa OperationalStatus HealthStatus IsManualAttach Size

                    me

------------ ------------------- ----------------- ------------ -------------- ----

Space1 Mirror OK Healthy False 27 GB

 

PS C:> $L ="X”

PS C:> $N = (Get-VirtualDisk -FriendlyName Space1 | Get-Disk).Number

PS C:> Set-Disk -Number $N -IsReadOnly 0

PS C:> Set-Disk -Number $N -IsOffline 0

PS C:> Initialize-Disk -Number $N -PartitionStyle MBR

PS C:> New-Partition -DiskNumber $N -DriveLetter $L -UseMaximumSize

 

   Disk Number: 4

 

PartitionNumber DriveLetter Offset Size Type

--------------- ----------- ------ ---- ----

1 X 1048576 27 GB Logical

 

PS C:> Start-Sleep –Seconds 10

PS C:> Initialize-Volume -DriveLetter $L -FileSystem NTFS -Confirm:$false

 

DriveLetter FileSystemLabel FileSystem DriveType HealthStatus SizeRemaining Size

----------- --------------- ---------- --------- ------------ ------------- ----

X NTFS Fixed Healthy 26.9 GB 27 GB

 

Notes:

 

Created a Pool and Space. Resulting disk is initialized and mounted as volume X:.

 

1.3 - Verify health of the pool and space

 

Steps to perform on the guest:

 

Get-Volume X | FT -AutoSize

Get-Volume X | Get-Partition | FT -AutoSize

Get-Volume X | Get-Partition | Get-Disk | FT -AutoSize

Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | FT -AutoSize

Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | Get-StoragePool | FT -AutoSize

Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | Get-PhysicalDisk | FT -AutoSize

 

Output:

 

PS C:> Get-Volume X | FT -AutoSize

 

DriveLetter FileSystemLabel FileSystem DriveType HealthStatus SizeRemaining Size

----------- --------------- ---------- --------- ------------ ------------- ----

X NTFS Fixed Healthy 26.9 GB 27 GB

 

PS C:> Get-Volume X | Get-Partition | FT -AutoSize

 

   Disk Number: 4

 

PartitionNumber DriveLetter Offset Size Type

--------------- ----------- ------ ---- ----

1 X 1048576 27 GB IFS

 

PS C:> Get-Volume X | Get-Partition | Get-Disk | FT -AutoSize

 

Number Friendly Name OperationalStatus Total Size Partition Style

------ ------------- ----------------- ---------- ---------------

4 Microsoft Storage Space Device Online 27 GB MBR

 

PS C:> Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | FT -AutoSize

 

FriendlyName ResiliencySettingName OperationalStatus HealthStatus IsManualAttach Size

------------ --------------------- ----------------- ------------ -------------- ----

Space1 Mirror OK Healthy False 27 GB

 

PS C:> Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | Get-StoragePool | FT -AutoSize

 

FriendlyName OperationalStatus HealthStatus IsPrimordial IsReadOnly

------------ ----------------- ------------ ------------ ----------

Pool1 OK Healthy False False

 

PS C:> Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | Get-PhysicalDisk | FT -AutoSize

 

FriendlyName CanPool OperationalStatus HealthStatus Usage Size

------------ ------- ----------------- ------------ ----- ----

PhysicalDisk2 False OK Healthy Auto-Select 19.25 GB

PhysicalDisk1 False OK Healthy Auto-Select 19.25 GB

PhysicalDisk3 False OK Healthy Auto-Select 19.25 GB

 

Notes:

 

All is healthy: Volume, Space (Virtual Disk), Pool and Physical Disks.

 

1.4 - Remove 1 disk

 

Steps to perform on the host:

 

Remove-VMHardDiskDrive -VMName VM2 -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0

Get-VMHardDiskDrive -VMName VM2

 

Output:

 

PS C:> Remove-VMHardDiskDrive -VMName VM2 -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0

PS C:> Get-VMHardDiskDrive -VMName VM2

 

VMName ControllerType ControllerNumber ControllerLocation DiskNumber Path

------ -------------- ---------------- ------------------ ---------- ----

VM2 IDE 0 0 c:demov2.vhdx

VM2 SCSI 0 1 D:demodisk2.VHDX

VM2 SCSI 0 2 D:demodisk3.VHDX

 

Notes:

 

Removed one of the 3 SCSI disks for the VM.

That is the equivalent, in a physical machine, to pulling a drive out while the system is running (assuming you have a drive that supports hot removal).

 

1.5 - Verify effect on the pool and space

 

Steps to perform on the guest:

 

Get-Volume X | FT -AutoSize

Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | FT -AutoSize

Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | Get-StoragePool | FT -AutoSize

Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | Get-PhysicalDisk | FT -AutoSize

Get-EventLog -LogName System -Source Disk | ? EntryType -ne "Information" | FL

Get-WinEvent -LogName Microsoft-Windows-Stor* | ? Level -lt 4 | FL

 

Output:

 

PS C:> Get-Volume X | FT -AutoSize

 

DriveLetter FileSystemLabel FileSystem DriveType HealthStatus SizeRemaining Size

----------- --------------- ---------- --------- ------------ ------------- ----

X NTFS Fixed Healthy 26.9 GB 27 GB

 

PS C:> Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | FT -AutoSize

 

FriendlyName ResiliencySettingName OperationalStatus HealthStatus IsManualAttach Size

------------ --------------------- ----------------- ------------ -------------- ----

Space1 Mirror Incomplete Warning False 27 GB

 

PS C:> Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | Get-StoragePool | FT -AutoSize

 

FriendlyName OperationalStatus HealthStatus IsPrimordial IsReadOnly

------------ ----------------- ------------ ------------ ----------

Pool1 Degraded Warning False False

 

PS C:> Get-Volume X | Get-Partition | Get-Disk | Get-VirtualDisk | Get-PhysicalDisk | FT -AutoSize

 

FriendlyName CanPool OperationalStatus HealthStatus Usage Size

------------ ------- ----------------- ------------ ----- ----

PhysicalDisk

Comments

  • Anonymous
    April 29, 2014
    Wow with all this info I might actually be able to figure out if my storage space is repairable. Been showing up as degraded even though I already replaced bad for several days now. I know it's supposed to carry out the repairs without user intervention but if it's taking this long it'd be nice to know if it's normal. Anyways, found out about Get-VirtualDisk cmdlet fromhttps://social.technet.microsoft.com/wiki/contents/articles/11382.storage-spaces-frequently-asked-questions-faq.aspx#How_do_I_replace_a_physical_disk which shows incomplete which let me to this page which seems will be more helpful than anything I"ve come across yet!
  • Anonymous
    May 18, 2014
    Pingback from Step-by-Step for Mirrored Storage Spaces Resiliency using PowerShell | Peter, IT Pro
  • Anonymous
    May 19, 2014
    Pingback from Nice to Know – MPIO “may” need to be configured correctly to increase performance when using Storage Spaces in Windows Server 2012 R2 « The Deployment Bunny
  • Anonymous
    June 09, 2014
    Pingback from A collection of Windows Server 2012 R2 / Hyper-V Server 2012 R2 links and related articles | Ahmad Sabry ElGendi
  • Anonymous
    July 07, 2014
    In this post, I'm providing a reference to the most relevant content related to Windows Server 2012
  • Anonymous
    November 19, 2014
    In this post, I'm sharing my favorite links related to Storage Spaces in Windows Server 2012 R2.