DiskPart Tutorial — Windows Disk & Volume Management
DiskPart is a low-level command-line tool used to manage disks, partitions, and volumes. It is commonly used in recovery environments, server troubleshooting, and OS deployment.
⚠ Warning: DiskPart can permanently destroy data. Always confirm disk numbers before making changes.
When to Use DiskPart
- Windows won’t boot
- Disk or volume not visible
- Partition repair or cleanup
- Formatting drives
- Preparing disks for OS install
- Checking RAID / NVMe detection
Launching DiskPart
diskpart
You’ll see:
DISKPART>
Basic Navigation Commands
List all disks
list disk
Shows all physical disks detected by the system.
Select a disk
select disk 0
Replace 0 with the correct disk number.
View disk details
detail disk
Working with Volumes
List volumes
list volume
Displays partitions and drive letters.
Select a volume
select volume 2
View volume details
detail volume
Assign or Change Drive Letter
assign letter=D
Useful when Windows Recovery doesn’t mount drives correctly.
Rescan Storage Devices
rescan
Forces DiskPart to re-detect disks. Useful after loading drivers.
Clear Read-Only Disk State
attributes disk clear readonly
Fixes disks stuck in read-only mode.
Create New Partition (Dangerous)
⚠ Erases existing partition layout.
clean
create partition primary
format fs=ntfs quick
assign
Only use when preparing a disk for fresh installation.
Repair Scenario — Disk Visible but No Volume
- Run
list disk - Select disk
- Run
detail disk - Run
rescan - Check volumes again
If volumes still missing, partition table may be corrupted. Stop and switch to recovery tools.
Exit DiskPart
exit
Common Mistakes to Avoid
- Running
cleanon wrong disk - Formatting system disk accidentally
- Assuming disk numbers are same as BIOS
- Ignoring read-only attributes
- Writing new partitions before recovery attempt
Recovery Best Practice
- Always document disk numbers first
- Never modify disk until data is backed up
- Use read-only inspection before repair
- If unsure — stop and escalate
Summary
- DiskPart is powerful and dangerous
- Use it for inspection first, repair second
- Always confirm disk identity
- Never rush destructive commands
DiskPart is a surgical tool — treat it like one.
No Comments