Task 11: Clear Previous Storage Configuration (Conditional)
Status: Active | Estimated Time: 5–15 minutes | Last Updated: 2026-03-04
Overview
If nodes have previously been used with Storage Spaces Direct, all existing storage pools, virtual disks, and disk metadata must be cleared before Azure Local deployment.
This step DESTROYS ALL DATA on data disks. Ensure all data is backed up before proceeding. This is irreversible.
When to Run
| Scenario | Run? |
|---|---|
| New hardware, first deployment | ❌ Skip |
| Redeployment on existing hardware | ✅ Yes |
| Hardware with previous S2D config | ✅ Yes |
Disks showing CanPool = False | ✅ Yes |
| After a failed deployment | ✅ Yes |
Prerequisites
| Requirement | Details |
|---|---|
| Tasks 01–10 complete | Hostname configured, nodes restarted |
| Data backed up | All important data saved — this cannot be undone |
Variables from variables.yml
| Path | Type | Description |
|---|---|---|
cluster_nodes[].management_ip | string | PSRemoting target IP (orchestrated mode) |
cluster_nodes[].hostname | string | Node display name for logging |
Execution Options
- Direct (On Node)
- Orchestrated (Mgmt Server)
Run on each node individually via console, KVM, or RDP.
Toolkit script: scripts/deploy/04-cluster-deployment/phase-03-os-configuration/task-11-clear-previous-storage-configuration-conditional/powershell/Clear-StorageConfiguration-Direct.ps1
# Task 11 - Clear Previous Storage Configuration (run locally on target node)
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 | ? BusType -ne USB | % {
$_ | Set-Disk -isoffline:$false
$_ | Set-Disk -isreadonly:$false
$_ | Clear-Disk -RemoveData -RemoveOEM -Confirm:$false
$_ | Set-Disk -isreadonly:$true
$_ | Set-Disk -isoffline:$true
}
Get-Disk | Where Number -Ne $Null | Where IsBoot -Ne $True | Where IsSystem -Ne $True | Where PartitionStyle -Eq RAW | Group -NoElement -Property FriendlyName
Run from the management server against all nodes.
Toolkit script: scripts/deploy/04-cluster-deployment/phase-03-os-configuration/task-11-clear-previous-storage-configuration-conditional/powershell/Invoke-ClearStorage-Orchestrated.ps1
# Task 11 - Clear Previous Storage Configuration (orchestrated, all nodes)
# variables.yml variables:
# cluster_nodes[].management_ip -> $ServerList
$ConfigPath = "$env:USERPROFILE\variables.yml"
$ServerList = (Get-Content $ConfigPath | Select-String 'management_ip:\s+"?([^"'' ]+)' |
ForEach-Object { $_.Matches[0].Groups[1].Value.Trim() })
Invoke-Command ($ServerList) {
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 | ? BusType -ne USB | % {
$_ | Set-Disk -isoffline:$false
$_ | Set-Disk -isreadonly:$false
$_ | Clear-Disk -RemoveData -RemoveOEM -Confirm:$false
$_ | Set-Disk -isreadonly:$true
$_ | Set-Disk -isoffline:$true
}
Get-Disk | Where Number -Ne $Null | Where IsBoot -Ne $True | Where IsSystem -Ne $True | Where PartitionStyle -Eq RAW | Group -NoElement -Property FriendlyName
} | Sort -Property PsComputerName, Count
Validation
# Verify all data disks are CanPool = True
$ServerList = @("<node1-ip>", "<node2-ip>")
Invoke-Command ($ServerList) {
Get-PhysicalDisk | Where-Object { $_.BusType -ne 'USB' } |
Select-Object FriendlyName, CanPool, CannotPoolReason, BusType, MediaType
} | Format-Table -AutoSize
Expected: All data disks show CanPool = True. Boot disk shows CannotPoolReason = Insufficient Capacity — this is expected.
Validation Checklist
- Script ran without errors on all nodes
- All data disks show
CanPool = True - Boot disk excluded (shows
Insufficient Capacity— expected)
Troubleshooting
| Issue | Resolution |
|---|---|
CanPool = False after running | Re-run Reset-PhysicalDisk |
| Storage pool still exists | Remove from cluster first, then re-run |
Navigation
← Task 10: Configure Hostname · ↑ Phase 03 · Task 12: Combined Script →