Skip to main content
Version: 1.0.0

Task 11: Clear Previous Storage Configuration (Conditional)

Runbook Phase 03 Platform

DOCUMENT CATEGORY: Runbook SCOPE: Clear previous Storage Spaces Direct configuration if redeploying on existing... PURPOSE: Clear previous Storage Spaces Direct configuration if redeploying on existing hardware MASTER REFERENCE: Azure Local Storage Spaces Direct

Status: Active

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.

Data Loss Warning

This step DESTROYS ALL DATA on data disks. Ensure all data is backed up before proceeding. This is irreversible.


When to Run

ScenarioRun?
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

RequirementDetails
Tasks 01–10 completeHostname configured, nodes restarted
Data backed upAll important data saved — this cannot be undone

Variables from variables.yml

PathTypeDescription
cluster_nodes[].management_ipstringPSRemoting target IP (orchestrated mode)
cluster_nodes[].hostnamestringNode display name for logging

Execution Options

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

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

IssueResolution
CanPool = False after runningRe-run Reset-PhysicalDisk
Storage pool still existsRemove from cluster first, then re-run


Alternatives

The procedures in this task use the scripted methods shown in the tabs above. Additional deployment methods including Azure CLI and Bash scripts are available in the azurelocal-toolkit repository under scripts/deploy/.

MethodDescription
Azure CLIPowerShell-based Azure CLI scripts for Azure resource operations
BashLinux/macOS compatible shell scripts for pipeline environments

← Task 10: Configure Hostname · ↑ Phase 03 · Task 12: Combined Script →


Version Control

VersionDateAuthorChanges
1.0.02025-03-25Azure Local CloudInitial release