13–Windows Server 2016
Configuring Storage Spaces Direct
227
AH0054601-00 B
Step 4. Cleaning Disks Used for Storage Spaces Direct
The disks intended to be used for Storage Spaces Direct must be empty, and
without partitions or other data. If a disk has partitions or other data, it will not be
included in the Storage Spaces Direct system.
The following Windows PowerShell command can be placed in a Windows
PowerShell script (
.PS1
) file and executed from the management system in an
open Windows PowerShell (or Windows PowerShell ISE) console with
Administrator privileges.
icm (Get-Cluster -Name HCNanoUSClu3 | Get-ClusterNode)
{
Update-StorageProviderCache
Get-StoragePool |? IsPrimordial -eq $false | Set-StoragePool
-IsReadOnly:$false -ErrorAction SilentlyContinue
Get-StoragePool |? IsPrimordial -eq $false | Get-VirtualDisk |
Remove-VirtualDisk -Confirm:$false -ErrorAction SilentlyContinue
Get-StoragePool |? IsPrimordial -eq $false | Remove-StoragePool
-Confirm:$false -ErrorAction SilentlyContinue
Get-PhysicalDisk | Reset-PhysicalDisk -ErrorAction
SilentlyContinue
Get-Disk |? Number -ne $null |? IsBoot -ne $true |? IsSystem -ne
$true |? PartitionStyle -ne RAW |% {
$_ | Set-Disk -isoffline:$false
$_ | Set-Disk -isreadonly:$false
$_ | Clear-Disk -RemoveData -RemoveOEM -Confirm:$false
$_ | Set-Disk -isreadonly:$true
$_ | Set-Disk -isoffline:$true
}
Get-Disk |? Number -ne $null |? IsBoot -ne $true |? IsSystem -ne
$true |? PartitionStyle -eq RAW | Group -NoElement -Property
FriendlyName
} | Sort -Property PsComputerName,Count
NOTE
Running this script helps identify the disks on each node that can be used
for Storage Spaces Direct and removes all data and partitions from those
disks.