Task 11: Clear Previous Storage Configuration (Conditional)
The automated OS configuration run covers this task in the ClearStorage step, when os_configuration.clear_storage is true. The plan lists the disks first; without the switch, leftover storage is reported as Blocked. Use the manual steps below when you can't use the run, or to understand or troubleshoot what it does. See how the run works.
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: Microsoft Learn - Install the Azure Local operating system (clean non-OS drives)
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.
This step DESTROYS ALL DATA on the local data disks. Ensure all data is backed up before proceeding. This is irreversible.
The scripts below skip every disk whose BusType is Fibre Channel or iSCSI, and they only reset physical disks that are not on those buses. This BusType filter is a safety guard added by this runbook, not a Microsoft step. SAN LUNs belong to the storage array, not to the node.
- Disaggregated (SAN-only): the infrastructure (250 GB or larger) and performance history (20 GB or larger) LUNs must stay RAW and are presented before deployment. Do not clear, initialize or reset them from this task. If a LUN holds an old configuration, clean it on the array side with your storage administrator.
- Hybrid (S2D + SAN): SAN LUNs are attached only after the initial deployment. If you redeploy a hybrid cluster, disconnect or unmask the SAN LUNs first so a wipe cannot reach them.
Microsoft Learn tells you to clean the non-OS drives on the machines you deploy: "Clean all the non-OS drives for each machine that you intend to deploy... This step doesn't apply to a machine repair operation" (Install the OS). For disaggregated deployments, Learn says "Don't initialize the drives, as the deployment expects the drive type to be RAW" (Install the OS for disaggregated deployments).
When to Run
| Scenario | Run? |
|---|---|
| New hardware, first deployment | ❌ Skip |
| Redeployment on existing hardware | ✅ Yes |
| Hardware with previous S2D config | ✅ Yes (local disks only) |
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 |
Values from infrastructure.yml
The values for this task come from infrastructure.yml (schema 5). Every key, with its type, default and example, is in the variables reference.
Execution Options
- Direct (On Node)
- Orchestrated Script
Run on each node individually via console, KVM, or RDP.
Run the commands below by hand. The toolkit no longer ships them as a script; the OS configuration does this task in its ClearStorage step.
# 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 | ? BusType -notin 'Fibre Channel','iSCSI' | Reset-PhysicalDisk -ErrorAction SilentlyContinue
Get-Disk | ? Number -ne $null | ? IsBoot -ne $true | ? IsSystem -ne $true | ? PartitionStyle -ne RAW | ? BusType -notin 'USB','Fibre Channel','iSCSI' | % {
$_ | 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
PowerShell
No script in this task folder. The folder
scripts/deploy/04-cluster-deployment/phase-03-os-configuration/task-11-clear-previous-storage-configuration-conditionalholds only a placeholder. A placeholder printsNOT IMPLEMENTED, changes nothing and exits with code 3. The earlierClear-StorageConfiguration.ps1andClear-StorageConfiguration-Direct.ps1are removed. The OS configuration does this task in its ClearStorage step.
Script
| Script | What it does |
|---|---|
scripts/deploy/04-cluster-deployment/phase-03-os-configuration/Invoke-AzureLocalOsConfiguration.ps1 | The one entry point of the OS configuration. It runs Set-AzureLocalNodeConfiguration.ps1 for each node: it reads the node, changes only what differs from infrastructure.yml, and reports. -Step limits the run to one step. |
The wipe runs only in Apply mode and only when os_configuration.clear_storage is true (or -ClearStorage is given). The Plan mode writes wipe-list.json; the Apply run needs it as -ApprovedWipeList and wipes nothing else. Boot, system, SAN and USB disks are never touched.
The nodes' local administrator comes from identity.local_admin of infrastructure.yml (the password is a secret reference), or from -Credential. The script never prompts. Run settings go in a JSON file given with -SettingsFile.
Run
./Invoke-AzureLocalOsConfiguration.ps1 -InfrastructureFile ./infrastructure.yml -Step ClearStorage -Mode Plan -ReportDirectory ./out
./Invoke-AzureLocalOsConfiguration.ps1 -InfrastructureFile ./infrastructure.yml -Step ClearStorage -Mode Apply -ApprovedWipeList ./out/wipe-list.json -ReportDirectory ./out
See how the run works.
Validation
# Verify all data disks are CanPool = True
$ServerList = @("<node1-ip>", "<node2-ip>")
Invoke-Command ($ServerList) {
Get-PhysicalDisk | Where-Object { $_.BusType -notin 'USB','Fibre Channel','iSCSI' } |
Select-Object FriendlyName, CanPool, CannotPoolReason, BusType, MediaType
} | Format-Table -AutoSize
Expected: All local data disks show CanPool = True. SAN LUNs (Fibre Channel or iSCSI) are not listed and must not be touched. 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 |
| A SAN LUN is no longer RAW | Do not reuse it as the infrastructure or performance history LUN. Ask the storage administrator to recreate or wipe it on the array, then present it again (see Task 14) |
Alternatives
The procedures in this task use the methods shown in the tabs above. The toolkit is PowerShell 7 only and has no Bash scripts. A few tasks that act on Azure also have an Azure CLI script written in PowerShell. The script status page of the toolkit lists which task has which script.
Navigation
← Task 10: Configure Hostname · ↑ Phase 03 · Disaggregated SAN: Task 12: HBA / iSCSI adapter drivers → · S2D or hybrid (S2D + SAN): Task 15: Combined Script →
Version Control
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0.0 | 2025-03-25 | Azure Local Cloud | Initial release |
| 1.1.0 | 2026-11-08 | Azure Local Cloud | Aligned to Azure Local 2610: the wipe loop and Reset-PhysicalDisk now skip Fibre Channel and iSCSI disks so SAN LUNs are never cleared; added SAN and hybrid danger box; fixed Learn links; navigation routes hybrid users to Task 15 |