The essentials

Quick reference

One focused task per row. Jump to the related section for complete, working examples.

UseSyntaxExamples
List physical disksGet-PhysicalDisk | Sort-Object FriendlyNameView examples
List disksGet-Disk | Sort-Object NumberView examples
Inspect one diskGet-Disk -Number 2 | Format-List Number, FriendlyName, SerialNumber, UniqueId, BusType, Size, PartitionStyleView examples
List disk partitionsGet-Partition -DiskNumber 2View examples
List volumesGet-Volume | Sort-Object DriveLetter, FileSystemLabelView examples
Resolve a drive letterGet-Partition -DriveLetter D | Get-VolumeView examples
Inspect resize rangeGet-PartitionSupportedSize -DriveLetter DView examples
Resize a partitionResize-Partition -DriveLetter D -Size 500GBView examples
Preview taking a disk offlineSet-Disk -Number 2 -IsOffline $true -WhatIfView examples
Preview assigning a letterSet-Partition -DiskNumber 2 -PartitionNumber 1 ` -NewDriveLetter R -WhatIfView examples
Initialize a raw diskInitialize-Disk -Number 2 -PartitionStyle GPTView examples
Create a maximum partitionNew-Partition -DiskNumber 2 -UseMaximumSize ` -AssignDriveLetterView examples
Format a volumeFormat-Volume -DriveLetter R -FileSystem NTFS ` -NewFileSystemLabel 'Archive' -ConfirmView examples
Scan a volumeRepair-Volume -DriveLetter D -ScanView examples

Windows storage cmdlets expose physical disks, partition tables, partitions, and formatted volumes as different objects. Resolve devices by number, unique ID, bus, size, and state before changes; capture current layout; inspect supported sizes; and require backups before initialization, formatting, or resizing.

Step by step

Detailed examples

01

Identify hardware with more than a disk number

Disk numbers can change with boot or attachment order. Record Number, UniqueId, serial, bus, model, size, partition style, boot/system flags, and location where available. Get-PhysicalDisk and Get-Disk describe related but different management layers.

Storage identity inventory
Get-Disk | Select-Object Number, FriendlyName, SerialNumber, UniqueId, BusType, Size, PartitionStyle, IsBoot, IsSystem, OperationalStatus
Get-PhysicalDisk | Select-Object FriendlyName, SerialNumber, MediaType, HealthStatus, OperationalStatus, Size
Back to quick reference ↑
02

Map disk, partition, and volume layers

A disk contains partitions; a partition may expose a volume; a volume contains a filesystem and mount points. Not every partition is user data. Preserve EFI, recovery, reserved, and boot partitions, and never infer purpose solely from size.

Trace one disk layout
$diskNumber = 2
Get-Disk -Number $diskNumber | Format-List *
Get-Partition -DiskNumber $diskNumber | ForEach-Object {
  $_
  $_ | Get-Volume -ErrorAction SilentlyContinue
}
Back to quick reference ↑
03

Check supported range, health, and backups

Get-PartitionSupportedSize computes current minimum and maximum. Resize-Partition can grow or shrink the partition and filesystem but lacks WhatIf, making the final call immediately stateful. Suspend encryption as required, check application and cluster constraints, and keep a tested backup.

Review a proposed resize without executing it
$current = Get-Partition -DriveLetter D
$supported = Get-PartitionSupportedSize -DriveLetter D
[pscustomobject]@{ Current = $current.Size; Minimum = $supported.SizeMin; Maximum = $supported.SizeMax; Proposed = 500GB } | Format-List
Back to quick reference ↑
04

Preview reversible state and letter changes

Taking a disk offline affects every contained volume. Drive-letter changes break paths, services, tasks, shares, and applications. Resolve the exact disk and partition first, use WhatIf where exposed, notify consumers, and verify mount-point alternatives.

Preview two state changes
Get-Disk -Number 2 | Format-List Number, UniqueId, IsOffline, IsReadOnly
Set-Disk -Number 2 -IsOffline $true -WhatIf
Get-Partition -DiskNumber 2 -PartitionNumber 1
Set-Partition -DiskNumber 2 -PartitionNumber 1 -NewDriveLetter R -WhatIf
Back to quick reference ↑
05

Treat initialization and formatting as destructive

Initialize-Disk writes a partition table; New-Partition changes layout; Format-Volume creates a filesystem and destroys access to prior data. Confirm the disk is truly RAW and unused using independent inventory, disconnect similar devices when practical, and do not pipeline discovery into these commands.

Review-only initialization plan
$candidate = Get-Disk -Number 2
$candidate | Format-List Number, UniqueId, SerialNumber, BusType, Size, PartitionStyle, OperationalStatus
if ($candidate.PartitionStyle -ne 'RAW') { throw 'Disk is not RAW; stop.' }
# Run each approved state-changing command separately only after independent verification.
Back to quick reference ↑
06

Correlate filesystem and device health

Volume health, physical-disk health, event logs, and vendor telemetry answer different questions. Repair-Volume scan detects filesystem issues, while repair modes may require downtime and do not fix failing hardware. Back up readable data before repair when failure is suspected.

Health baseline and scan
Get-Volume -DriveLetter D | Format-List DriveLetter, FileSystem, HealthStatus, OperationalStatus, Size, SizeRemaining
Get-PhysicalDisk | Select-Object FriendlyName, HealthStatus, OperationalStatus
Repair-Volume -DriveLetter D -Scan
Back to quick reference ↑

Sources and further reading

References

Authoritative documentation used to verify and expand this cheat sheet.

  1. MicrosoftStorage Modulelearn.microsoft.com
  2. MicrosoftGet-Disklearn.microsoft.com
  3. MicrosoftGet-Partitionlearn.microsoft.com
  4. MicrosoftResize-Partitionlearn.microsoft.com

Help us improve

Found a typo or missing example?

Tell us what would make this cheat sheet clearer, more complete, or more useful.

Share feedback