Skip to main content

Task 11: Clear Previous Storage Configuration (Conditional)

The automated run does this task for you

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.

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: 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.

Data Loss Warning

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

Never run a local-disk wipe against SAN LUNs

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​

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

RequirementDetails
Tasks 01–10 completeHostname configured, nodes restarted
Data backed upAll 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​

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

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​

IssueResolution
CanPool = False after runningRe-run Reset-PhysicalDisk
Storage pool still existsRemove from cluster first, then re-run
A SAN LUN is no longer RAWDo 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.

← 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​

VersionDateAuthorChanges
1.0.02025-03-25Azure Local CloudInitial release
1.1.02026-11-08Azure Local CloudAligned 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