Most Windows newbies are probably unaware of Diskpart, a free CMD disk software that aids in managing disk partitions on the computer. However, knowing which diskpart command in windows you should use to perform specific tasks and how to prevent your data from being lost during the execution of these Diskpart commands is necessary. In this article, you will discover how Diskpart operates to monitor disk drives and even how to resolve Diskpart issues like a pro using diskpart commands in Windows 10/11/8/7.
In this article
Part 1. What Is Diskpart?
Diskpart is the latest command-line utility for managing disk partitions and has replaced the older fdisk tool. It is supported by all the latest Windows versions and can manage partitions on desktops, laptops, and external storage devices. However, you must know all the basic commands to manage partitions.
Basic Information About Diskpart |
|
Developer | Microsoft, Lee Schroeder |
Predecessor | Fdisk Utility |
Initial Release | February 17, 2000 |
Latest Release | August 8, 2012 |
Price | Free |
Target Users | Windows beginners and users with a technical background |
Supported OS | Windows 11/10/8.1/8/7 and Windows Servers |
Part 2. Get Most Common Diskpart Commands Examples in Windows
Diskpart offers a vast array of commands to manage your disk partitions. However, which command should be used to format a volume and which should be used to create a new partition? Check the Windows Diskpart commands mentioned in the table below to understand better which task each one performs.
Diskpart Commands | Function |
list disk | displays all the disks on your system. |
list vdisk | displays all the virtual disks on your Windows OS. |
list partition/volume | displays all the information about the partition/volume on your disk. |
select disk/partition/volume* | to select a particular disk, partition, or volume to perform a specific task. "*" indicates the number of a particular disk/volume/partition. |
detail disk/partition/volume | displays detailed information about the specific disk/partition/volume. |
create partition primary/logical size=* | to create a primary partition. "*" indicates the partition size you want to create in MB. |
delete disk/partition/volume * | deletes a specific disk, partition, or volume; "*" is the disk/partition/volume number. |
convert basic/dynamic/mbr/gpt | converts a disk between basic and dynamic or MBR and GPT. |
Assign | assigns a drive letter to a disk/volume/partition. |
Extend | expands the focused disk/volume/partition and its file system onto unallocated disk space. |
Shrink | decreases the size of the specified volume by the amount you choose. |
clean/clean all | to delete all partitions available on a disk or entirely delete all of the data on a hard disk or SSD. |
Format | to format a volume or partition and convert its file system to NTFS, FAT32, exFAT, and so on. |
Active | to make the disk's partition with focus active. |
Part 3. Using Diskpart Commands Examples to Manage Partitions in Windows
You can carry out multiple tasks using Diskpart; therefore, commands are carried out one at a time. The outcomes of the previous operation are displayed in the subsequent procedure, and you must press the "Enter" key after each command you input.
Discover how to use the Diskpart commands to manage disk partitions by performing different disk operations, which are mentioned below:
Active Partition Command
To make a selected drive/volume/partition active.
- Launch Diskpart, type the command
list disk
, and press Enter. - Type the command
select disk*
and hit Enter. - Type
list partition
and press Enter. - Type the command
select partition*
and hit Enter. Replace * with the number of the desired partition you want to set as active. - Type
active
and press the Enter key.

Assign Drive Letter Command
To assign a specific drive letter to the selected drive/volume/partition.
- Launch Diskpart in Command Prompt. To list all the volumes on your system, type "list volume" and hit "Enter."
- After entering the "select volume*" command, press "Enter" and replace * with the number of your partition or drive.
- Enter "assign letter=f" and hit the Enter key.
Create Primary Partition Command
To create a new primary partition, simple volume, or logical partition.
- Launch Diskpart.
- Enter the command
list disk
. - Type
select disk*
and press the Enter key; replace * with the disk's number on which you want to create a partition. - To create a partition on the specified disk, enter the relevant command:
create partition primary size=*
orcreate partition logical size=*
(you can replace NTFS with other desired formats like FAT32, exFAT, etc.)
assign drive letter=*
format fs=ntfs quick

Delete Partition Command
To delete volumes/partitions, wipe or erase partitions, clean disk/volume/partition, or erase HDD/SSD.
- Launch Diskpart.
- Enter the command
list disk
. - Press Enter after typing the command
list partition
. - Type the command
select partition*
and press Enter. - Type
delete partition
and hit Enter.

Format Partition Command
To format hard drive or partition, quick format volumes, USB, or external disks.
- Launch Diskpart.
- Input the following commands in sequence, and press Enter each time:
list disk
(Replace * with the target disk number.)
select disk*list volume
(Replace * with the volume on your drive to be formatted.)
select volume*format fs=ntfs quick
, orformat fs=exFAT quick
, orformat fs=fat32 quick


Shrink Partition Command
To reduce the size of the specified partition.
- Launch Diskpart.
- Type the command
list volume
and press Enter. - Input the command
select volume*
and press Enter. Replace * with the number of volumes/partitions you want to shrink. - Type
shrink desired=*
and hit Enter. Replace * with the size you want to shrink from the specified partition.

Clean-up or Erase Disk Command
To erase or clean up the entire disk, volume, or partition.
Launch Diskpart, input the following commands in sequence, and press Enter every time.
- list disk
- select disk* (replace * with drive number)
- clean all

MBR to GPT/GPT to MBR Command
To transform disk type, change MBR to GPT or GPT to MBR.
- Launch Diskpart, type the command
list disk
, and press Enter. - Input the command
select disk*
and hit Enter. - Type
clean
and press Enter. - Enter the command
convert mbr
orconvert gpt
and hit Enter.

Part 4. How To Open Diskpart in Windows 10/11/8/7?
Different Windows versions have different interfaces; therefore, if you don't know how to open Diskpart on your Windows edition, don't worry. Depending on your operating system, you can choose from the following four routes to launch Diskpart:
Run Diskpart in Windows 10
- Press Win+R to launch the Run Application.
- Type CMD in the Run dialogue box to open Command Prompt and hit Enter to launch the Command Prompt application.
- In the Command Prompt window, enter the command Diskpart and hit Enter.

Run Diskpart in Windows 11
- Hit the Win+S keys to launch the Windows Search Application and type
Diskpart
in the search bar. - Right-click on
Diskpart
and choose Run as Administrator from the dropdown menu options.

Run Diskpart in Windows 8
- Click the Start menu, go to the Search bar, and type
CMD
in the search box. - Right-click on the Command Prompt application and select Run as Administrator.
- Input
Diskpart
in the Command Prompt window and press Enter to launch Diskpart.

Run Diskpart in Windows 7
- Choose Search from the Start menu, then type
CMD
. - From the results list, select Command Prompt and choose "Run as an Administrator" from the context menu.
- In the Command Prompt, type
diskpart
and press Enter.

Part 5. Recover Partition Easily If Data Loss
It is challenging to remember all the Diskpart commands with accurate syntax parameters; therefore, there are greater chances of partition formatting, deletion, or erasure. However, if you have entered the wrong Diskpart commands and accidentally deleted the partition or your data is deleted through unintentional formatting.
There's no need to worry. Using powerful and reliable recovery software, you can recover the deleted partition or lost data; Recoverit is the industry leader in recovering your deleted files in seconds.
- Download and launch the Recoverit Data Recovery application and choose the respective deleted partition.
- Recoverit will Scan all the lost or deleted partitions to recover them.
- Preview the recoverable partition files to identify which files you want back.
- Click the Recover option to recover the partition after the preview.
Conclusion
We have provided an in-depth explanation of what Diskpart is, what it can perform, why you should use it, and examples of typical Diskpart commands. Diskpart is a more effective Windows utility than disk management for managing your computer's hard disk partitions and external storage devices. However, remembering syntax commands is the only complexity that some beginner users may experience.
FAQ
-
Do I need to install Diskpart from any external source?
No! Diskpart is a Windows utility already installed and incorporated into your operating system. You don't need to install it from any external source, nor does it cost you. -
Does the Diskpart Clean command delete all the hard drive data?
The Clean command enables you to delete any or all drive partitions. However, all the data won't be deleted; if you have cleaned only one drive, the data associated with that drive will be deleted. -
Does older Windows versions include Diskpart?
No! Earlier Windows OS versions had the Fdisk tool instead of Diskpart to manage hard drives and partitions. -
I accidentally lost a partition by entering the wrong command in Diskpart; what to do next?
The lost partition is only removed from the record of the partition table and is not entirely gone. Therefore, if you have accidentally lost your partition, you can recover it using dependable recovery software. -
Can I format my disk using Diskpart?
Yes! Diskpart allows you to format any or all of your disks; you can accomplish this by applying the "format" command to the specified drive. Note that formatting deletes all the drive content, so back up your data into another drive before formatting.