Home » DiskPart Commands Windows 10: Complete Guide to Managing Disks with DiskPart

DiskPart Commands Windows 10: Complete Guide to Managing Disks with DiskPart

This guide explains how to use DiskPart in Windows 10 for disk and partition management. Learn essential commands, troubleshooting methods, and data recovery solutions.

Updated on

Introduction to DiskPart in Windows

What Is DiskPart and How Does It Work?

DiskPart is a command-line utility included in Microsoft Windows that allows users to manage disks, partitions, and volumes without relying on graphical interfaces. Unlike the traditional Disk Management console, diskpart for windows provides direct control over storage devices through text-based commands.

The utility can create, delete, extend, shrink, and format partitions. It can also assign drive letters, convert disk types, and perform various maintenance operations. Because it works through Command Prompt, many administrators prefer cmd diskpart when troubleshooting storage issues or configuring new drives.

A typical session starts by opening Command Prompt with administrator privileges and entering the command:

diskpart

Once launched, the utility switches to its own command environment where users can execute specialized instructions.

One reason why diskpart in windows remains popular is its ability to perform operations that may not be available through graphical tools. Whether managing internal SSDs, HDDs, external drives, or USB devices, the utility offers comprehensive control.

However, because commands are executed immediately, users should verify the selected disk before making changes. A single incorrect command can affect important data.


Understanding Common DiskPart Commands

Launching CMD DiskPart Correctly

Before using cmd diskpart, it is important to launch the tool with administrative permissions.

Follow these steps:

  1. Press Windows + S.
  2. Type Command Prompt.
  3. Right-click Command Prompt.
  4. Select Run as administrator.
  5. Enter diskpart and press Enter.

After launching, the command prompt changes to:

DISKPART>

This indicates the utility is ready to receive commands.

Some of the most frequently used commands include:

CommandFunction
list diskDisplays available drives
select diskChooses a specific drive
list volumeShows all volumes
create partition primaryCreates a partition
formatFormats a partition
assignAssigns a drive letter
cleanRemoves partition information

These commands form the foundation of most storage management tasks.

The advantage of using windows command diskpart is precision. Administrators can directly target specific disks and automate tasks through scripts.

In enterprise environments, many IT teams use diskpart commande scripts to deploy storage configurations across multiple systems quickly and consistently.


Viewing Available DiskPart Disk Information

Before modifying any storage device, users should inspect available hardware using diskpart disk commands.

Start by running:

list disk

The output displays all connected storage devices, including:

  • Disk number
  • Capacity
  • Available space
  • Online status
  • GPT indicators

For example:

DISKPART> list disk

You may see:

Disk 0    512 GB
Disk 1 1 TB
Disk 2 64 GB

To work with a specific drive:

select disk 1

Then verify the selection:

detail disk

This command provides detailed information including:

  • Disk model
  • Current partitions
  • Volume status
  • Read-only settings

Checking these details reduces the risk of modifying the wrong device.

Many storage-related problems occur because users skip the verification stage. Taking a few seconds to inspect the drive can prevent accidental partition loss.


Essential Windows Command DiskPart Functions

The power of windows command diskpart comes from its broad range of management functions.

Some commonly used operations include:

Creating partitions

create partition primary

Assigning drive letters

assign letter=E

Formatting volumes

format fs=ntfs quick

Extending partitions

extend

Deleting partitions

delete partition

Each command performs a specific task, allowing users to customize storage layouts according to their needs.

For instance, after installing a new SSD, users can initialize the drive, create partitions, and format them without opening any graphical utility.

System administrators often combine multiple commands into scripts. This approach improves efficiency when configuring large numbers of machines.

Because diskpart commande operations are processed directly by Windows storage services, execution is typically fast and reliable.

Nevertheless, understanding the purpose of each command before running it is essential. Improper usage can lead to inaccessible partitions or complete data loss.


Preparing to Use DiskPart Safely

System Requirements and Test Environment

Before applying any storage-related procedure, it is advisable to verify the operating environment.

The following test environment was used when validating the methods described in this guide:

ComponentSpecification
Operating SystemWindows 10 Pro 22H2
ProcessorIntel Core i7
Memory16 GB RAM
System Disk512 GB NVMe SSD
Secondary Disk1 TB SATA HDD
External Storage128 GB USB Drive
File SystemNTFS

The commands were tested on fully updated Windows installations with administrator privileges.

Although most procedures also work on Windows 11, Windows 8.1, and Windows 7, interface differences may exist.

Before making any modifications:

  • Back up important files.
  • Disconnect unnecessary external drives.
  • Verify disk numbers carefully.
  • Ensure stable power supply.

These precautions help reduce risks during partition management.


Important Precautions Before Running Commands

Because diskpart for windows provides low-level access to storage devices, preparation is critical.

Best practices include:

  1. Create a backup of important data.
  2. Verify the selected disk multiple times.
  3. Avoid interrupting formatting operations.
  4. Close applications accessing the target drive.
  5. Ensure administrator permissions are available.

Many users mistakenly assume that deleting a partition only removes drive letters. In reality, certain commands modify partition tables directly.

For example:

clean

removes partition information from the selected drive.

Likewise:

delete partition

eliminates an existing partition structure.

While data recovery may still be possible afterward, the process becomes significantly more complicated.


How to Use DiskPart for Basic Disk Management

Method 1: List and Identify Disks with DiskPart

Purpose: Identify connected storage devices before performing any operation.

Test Environment

  • Windows 10 Pro 22H2
  • 512 GB SSD
  • 1 TB HDD
  • Administrative Command Prompt

Steps

Step 1. Open Command Prompt as Administrator.

Step 2. Launch diskpart.

diskpart

Step 3. Display all connected drives.

list disk

Step 4. Select the desired disk.

select disk 1

Step 5. View detailed information.

detail disk

Result

The utility displays:

  • Disk capacity
  • Current status
  • Existing partitions
  • Volume information

This method should always be performed before any partition modification. It serves as the foundation for all other diskpart disk operations.

Correct disk identification significantly reduces the chance of selecting the wrong device and causing unintended changes.


Method 2: Create a New Partition Using DiskPart

Purpose: Allocate unallocated space into a usable partition.

Test Environment

  • Windows 10 Pro
  • 1 TB HDD with unallocated space
  • NTFS file system

Step 1. Open cmd diskpart.

Step 2. View available drives.

list disk

Step 3. Select the target drive.

select disk 1

Step 4. Create a primary partition.

create partition primary

Step 5. Select the newly created partition.

select partition 1

Step 6. Mark it active if necessary.

active

Step 7. Assign a drive letter.

assign letter=F

After completion, Windows recognizes the partition as a usable volume.

This method is commonly used after installing new storage devices or reallocating free disk space.

Method 3: Format a Partition with DiskPart

Purpose: Prepare a newly created partition for storing files by applying a supported file system.

Test Environment

  • Windows 10 Pro 22H2
  • 256 GB SSD partition
  • Administrator Command Prompt
  • NTFS and exFAT file systems tested

After creating a partition, formatting is usually required before the operating system can use the available storage space. Using diskpart allows users to quickly format partitions without opening Disk Management.

Instructions

1. Open Command Prompt with administrator privileges.

2. Launch diskpart.

diskpart

3. Display all available volumes.

list volume

4. Identify the target volume and select it.

select volume 3

5. Format the partition using the NTFS file system.

format fs=ntfs quick

Alternatively, use exFAT for removable storage devices.

format fs=exfat quick

6. Assign a drive letter to the formatted partition.

assign letter=G

7. Wait for the formatting process to finish and verify that the drive appears in File Explorer.

Result

The selected partition is successfully formatted and becomes available for data storage. Users can immediately save files, install applications, or use the partition as a backup location.

NTFS is generally recommended for internal drives because it supports advanced features such as file permissions, compression, and encryption. exFAT is often preferred for external drives that need compatibility with multiple operating systems.

Method 4: Clean a Disk and Remove Existing Partitions

Purpose: Remove all existing partition information and prepare a drive for a fresh configuration.

Test Environment

  • Windows 10 Pro 22H2
  • 1 TB SATA HDD
  • Administrator Command Prompt
  • GPT and MBR disks tested

A damaged partition table, failed operating system installation, or incorrect storage configuration can sometimes prevent a drive from working properly. In these situations, the diskpart clean command can reset the disk structure and allow you to start over.

Instructions

1. Open Command Prompt as Administrator.

2. Launch diskpart.

diskpart

3. Display all connected drives.

list disk

4. Identify the target drive based on capacity and select it.

select disk 1

5. Verify the selected drive.

detail disk

6. Remove all partition information.

clean

7. Create a new primary partition.

create partition primary

8. Format the partition.

format fs=ntfs quick

Result

After the process is complete, the drive will contain a fresh partition structure and can be used normally.


Method 5: Recover Lost Files After Accidental DiskPart Operations

Purpose: Recover files after formatting, partition deletion, or incorrect diskpart commande operations.

Test Environment

  • Windows 10 Pro
  • 512 GB SSD
  • NTFS file system
  • Deleted partition scenario

Although diskpart for windows is excellent for managing storage devices, it cannot restore deleted files. If data is lost after running commands such as clean, delete partition, or format, a recovery solution may be required.

Instructions

Step 1: Connect the Drive / USB)

Connect your device (SD card, HDD/SSD, or USB drive) to your computer and launch PandaOffice Drecov. Select the target device and start the scan. The software will perform a quick scan and deep scan to detect lost or deleted data.

Step-by-Step to Recover Data with PandaOffice Drecov

Step 2: Locate and Preview Lost Files

After scanning, browse the detected files and use the preview feature to check recoverable data. You can preview documents (Word, Excel, PDF), photos, and videos to ensure file integrity before recovery.

hard disk drive recovery step 3

Step 3: Recover and Save to a New Location

Select the files you want to restore and click recover. Save all recovered data to a different drive or location (not the original device) to avoid overwriting lost data.

Step-by-Step to Recover Data with PandaOffice Drecov

Why Choose PandaOffice Drecov Recovery Software?

PandaOffice Drecov offers a fast, secure, and user-friendly solution for recovering lost files across multiple scenarios. Whether you need email recovery, ZIP File Recovery, format data recovery, or help to recover deleted drafts Outlook, the software provides reliable recovery performance for both personal and business users.

PandaOffice Drecov supports recovery from formatted hard drives, SSDs, USB drives, SD cards, and external storage devices. Its advanced scanning engine can locate deleted archives, damaged ZIP files, lost Outlook drafts, and accidentally removed documents with high accuracy. For users searching for how to find deleted messages in Teams, PandaOffice Drecov can also help recover exported chat files, attachments, and related local cache data when available.

After recovery, test the file again. If the audio stream was damaged because of storage issues, a recovered version may play normally.

This method is particularly useful when only a few files exhibit audio problems while VLC works correctly with all other media.

This method can help users recover files from floppy disk storage after accidental deletion, formatting, or logical corruption.

Result

Pandaoffice Drecov can often recover files that become inaccessible after formatting, partition removal, or accidental execution of destructive cmd diskpart commands.

For the highest recovery rate, avoid writing new data to the affected drive before recovery.


Advanced DiskPart Management Tasks

Method 6: Extend a Partition Using Unallocated Space

Purpose: Increase the size of an existing partition without recreating it.

Test Environment

  • Windows 10 Pro
  • 500 GB SSD
  • 100 GB adjacent unallocated space

When a partition starts running out of space, diskpart in windows can expand it if unallocated space exists immediately after the partition.

Instructions

1. Launch diskpart.

diskpart

2. View available volumes.

list volume

3. Select the volume that needs additional space.

select volume 2

4. Extend the partition.

extend

5. Wait for the operation to finish.

Result

The selected partition grows into the available unallocated space without requiring reformatting.

This method is commonly used when the system drive becomes nearly full.


Method 7: Delete an Unwanted Partition

Purpose: Remove an unnecessary partition and reclaim storage space.

Test Environment

  • Windows 10 Pro
  • GPT disk
  • Multiple partitions available

Sometimes users create extra partitions that are no longer needed. Removing them allows the space to be reused elsewhere.

Instructions

1. Open cmd diskpart.

diskpart

2. Display available disks.

list disk

3. Select the desired disk.

select disk 1

4. Display partitions.

list partition

5. Select the partition to remove.

select partition 3

6. Delete the partition.

delete partition

Result

The deleted partition becomes unallocated space and can later be used to create new partitions or extend existing ones.


Method 8: Convert an MBR Disk to GPT

Purpose: Upgrade a disk to GPT partition style for modern systems.

Test Environment

  • Windows 10 Pro
  • 2 TB HDD
  • UEFI-enabled computer

GPT supports larger storage devices and more partitions than the traditional MBR structure.

Instructions

1. Start diskpart.

diskpart

2. View available disks.

list disk

3. Select the target disk.

select disk 1

4. Remove existing partition information.

clean

5. Convert the drive to GPT.

convert gpt

6. Create a new partition if necessary.

create partition primary

Result

The drive now uses GPT partitioning and is ready for modern Windows installations.


Common DiskPart Errors and Solutions

DiskPart Access Is Denied

This error usually appears when the Command Prompt window lacks administrator privileges.

Possible solutions include:

  • Run Command Prompt as Administrator.
  • Remove write protection from the drive.
  • Check storage permissions.
  • Verify security policies.

Most cases are resolved by launching an elevated command window.


The Selected Disk Is Not Convertible

This message commonly appears when users attempt to convert a disk that still contains active partitions.

Possible fixes:

1. Back up important data.

2. Select the disk.

select disk 1

3. Remove existing partition information.

clean

4. Retry the conversion command.

convert gpt

The conversion should proceed successfully if no conflicting partitions remain.


DiskPart Cannot Find the Specified Object

This error often occurs when an incorrect disk, partition, or volume number is entered.

To refresh the available storage information, run:

list disk
list volume
list partition

Review the displayed identifiers carefully before selecting a target object.


DiskPart FAQ

Can DiskPart Recover Deleted Files?

No. DiskPart is a storage management utility rather than a file recovery tool.

It can perform operations such as:

  • Creating partitions
  • Deleting partitions
  • Formatting drives
  • Assigning drive letters
  • Extending volumes

However, it cannot recover deleted files. If data loss occurs after using windows command diskpart, a dedicated recovery solution is required.


Why Does DiskPart Show a Different Disk Number?

Disk numbers may change when:

  • USB drives are connected or disconnected
  • New storage devices are installed
  • BIOS settings are modified
  • Storage controllers are updated

Before executing commands, always verify the drive using:

list disk

and

detail disk

This simple check helps prevent accidental operations on the wrong disk.


Is DiskPart Available on Every Windows Version?

Yes. diskpart for windows is included with most modern Windows operating systems, including:

  • Windows 11
  • Windows 10
  • Windows 8.1
  • Windows 8
  • Windows 7
  • Windows Server editions

The command set may vary slightly, but the core functionality remains largely the same.


What Is the Difference Between Disk Management and DiskPart?

Disk Management uses a graphical interface that is suitable for beginners.

In contrast, diskpart in windows provides:

  • More advanced control
  • Script automation
  • Faster administration
  • Enterprise deployment capabilities

For IT professionals and power users, diskpart commande often offers greater flexibility than graphical tools.


Can DiskPart Format USB Drives?

Yes. The utility can manage USB flash drives just like internal storage devices.

A typical workflow includes:

list disk
select disk X
clean
create partition primary
format fs=exfat quick

This process is commonly used to repair corrupted USB drives or prepare bootable installation media.


Conclusion

DiskPart remains one of the most powerful command-line storage management tools available in Windows. Whether you need to inspect a diskpart disk, create partitions, format volumes, extend storage space, or convert partition styles, the utility provides precise control over virtually every aspect of disk management.

This guide covered essential cmd diskpart commands, advanced windows command diskpart operations, troubleshooting techniques, and recovery options for accidental data loss. By understanding how diskpart for windows works and following proper safety precautions, users can confidently manage storage devices while minimizing the risk of errors.

Always verify the selected drive before executing commands, maintain current backups, and use recovery tools when necessary. With careful usage, diskpart in windows remains an invaluable utility for both everyday users and experienced administrators.