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:
diskpartOnce 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.
⚠️Warning: Always confirm the target drive number before performing formatting or cleaning operations.
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:
- Press Windows + S.
- Type Command Prompt.
- Right-click Command Prompt.
- Select Run as administrator.
- 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:
| Command | Function |
|---|---|
| list disk | Displays available drives |
| select disk | Chooses a specific drive |
| list volume | Shows all volumes |
| create partition primary | Creates a partition |
| format | Formats a partition |
| assign | Assigns a drive letter |
| clean | Removes 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 diskThe output displays all connected storage devices, including:
- Disk number
- Capacity
- Available space
- Online status
- GPT indicators
For example:
DISKPART> list diskYou may see:
Disk 0 512 GB
Disk 1 1 TB
Disk 2 64 GBTo work with a specific drive:
select disk 1Then verify the selection:
detail diskThis 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.
⚠️Warning: Never use destructive commands such as clean until you have confirmed the correct disk number.
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 primaryAssigning drive letters
assign letter=EFormatting volumes
format fs=ntfs quickExtending partitions
extendDeleting partitions
delete partitionEach 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:
| Component | Specification |
|---|---|
| Operating System | Windows 10 Pro 22H2 |
| Processor | Intel Core i7 |
| Memory | 16 GB RAM |
| System Disk | 512 GB NVMe SSD |
| Secondary Disk | 1 TB SATA HDD |
| External Storage | 128 GB USB Drive |
| File System | NTFS |
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:
- Create a backup of important data.
- Verify the selected disk multiple times.
- Avoid interrupting formatting operations.
- Close applications accessing the target drive.
- 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:
cleanremoves partition information from the selected drive.
Likewise:
delete partitioneliminates an existing partition structure.
While data recovery may still be possible afterward, the process becomes significantly more complicated.
⚠️Warning: The clean command does not ask for confirmation before execution. Double-check the selected disk before proceeding.
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.
diskpartStep 3. Display all connected drives.
list diskStep 4. Select the desired disk.
select disk 1Step 5. View detailed information.
detail diskResult
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 diskStep 3. Select the target drive.
select disk 1Step 4. Create a primary partition.
create partition primaryStep 5. Select the newly created partition.
select partition 1Step 6. Mark it active if necessary.
activeStep 7. Assign a drive letter.
assign letter=FAfter 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.
diskpart3. Display all available volumes.
list volume4. Identify the target volume and select it.
select volume 35. Format the partition using the NTFS file system.
format fs=ntfs quickAlternatively, use exFAT for removable storage devices.
format fs=exfat quick6. Assign a drive letter to the formatted partition.
assign letter=G7. 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.
⚠️Warning: Formatting removes the existing file system structure and may make previously stored files inaccessible. Back up important data before proceeding.
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.
diskpart3. Display all connected drives.
list disk4. Identify the target drive based on capacity and select it.
select disk 15. Verify the selected drive.
detail disk6. Remove all partition information.
clean7. Create a new primary partition.
create partition primary8. Format the partition.
format fs=ntfs quickResult
After the process is complete, the drive will contain a fresh partition structure and can be used normally.
⚠️Warning: The clean command removes all partition information immediately. Make sure the correct drive is selected before running the command.
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 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.

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.

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.
diskpart2. View available volumes.
list volume3. Select the volume that needs additional space.
select volume 24. Extend the partition.
extend5. 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.
diskpart2. Display available disks.
list disk3. Select the desired disk.
select disk 14. Display partitions.
list partition5. Select the partition to remove.
select partition 36. Delete the partition.
delete partitionResult
The deleted partition becomes unallocated space and can later be used to create new partitions or extend existing ones.
⚠️Warning: Deleting a partition may make stored files inaccessible unless they are recovered with data recovery software.
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.
diskpart2. View available disks.
list disk3. Select the target disk.
select disk 14. Remove existing partition information.
clean5. Convert the drive to GPT.
convert gpt6. Create a new partition if necessary.
create partition primaryResult
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 13. Remove existing partition information.
clean4. Retry the conversion command.
convert gptThe 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 disklist volumelist partitionReview 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 diskand
detail diskThis 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 diskselect disk Xcleancreate partition primaryformat fs=exfat quickThis 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.








