Everything About DiskPart Commands in Windows 10

DiskPart is a command-line utility in Windows 10/11, enabling you to perform disk partition operations with commands. Learn how to use DiskPart commands with typical examples here.

Emily

By Emily / Updated on November 20, 2023

Share this: instagram reddit

What is DiskPart?

DiskPart, replacing its predecessor - fdisk, is a command-line utility that provides the ability to manage disks, partitions or volumes in your computer running all versions of the operating system since Windows 2000, also including the latest Windows 10. Users can input DiskPart commands directly to organize hard disk partitions or create a text file script to perform multiple commands. Most disk partition operations that you can perform in Disk Management tool are integrated into DiskPart.

How to open DiskPart in Windows 10/11?

You will need to launch Windows 10/11 DiskPart with Administrator permission. One way is to type "diskpart" in the Search box, and then when diskpart appears in the search results, right-click it and select "Run as administrator". The other way is to press "Windows logo + R" keys and type "diskpart" in the box, and then click "OK".

open-diskpart

Common DiskPart Windows 10/11 commands (examples study)

Before you can use DiskPart commands in Windows 10, you must first list, and then select an object to give it focus. When an object has been focused, any DiskPart commands that you type will act on that object.

At the DISKPART> prompt, type "list disk" to display all the disks in your computer. Each one will have a specific disk number, starting with 0. An asterisk (*) under GPT row means the disk is of GPT partition style. Unless there is only one disk, you will have to tell DiskPart which disk to manage by using "select disk n" command to give it focus. n represents the number of the disk.

list disk

At the DISKPART> prompt, type "list volume" to display all the volumes on all disks. Each one will have a specific volume number, starting with 0. To tell DiskPart which volume to manage, you need to type "select volume n" to give it focus. n can be the number of the volume or the drive letter of the volume if has.

Select volume

To view what DiskPart can for you, just type help to see a list of commands.

Diskpart help

Next, we will take some of the most common commands that Diskpart uses as examples for you to get a further understanding.

Section 1. Most common Diskpart commands on volume in Windows 10/11

Because when selecting a volume, the focus remains on it until you select a different volume, “select volume” command may not be used in each operation. Besides, the examples are performed one after one and the effect of the previous operation will be viewed in the next operation. If you only need to perform one of the operations, you need to select the volume before using the corresponding command.

Note: Each time you type a command, you need to press the "Enter" key to apply it.

1. Delete Volume

To delete a volume, please refer to the following command:

▪ list volume

▪ select volume 6 (here take F: drive for example).

▪ delete volume

And then, you will receive a message says: DiskPart successfully deleted the volume.

Note: You cannot delete the system volume, boot volume, or any volume that contains the active paging file or crash dump.

Delete volume

2. Create Partition

To create a partition, please refer to the following command:

▪ create partition primary size=102400

And then, you will receive a message says: DiskPart succeeded in creating the specified partition.

Create partition

The above command means to create a 102400MB (100GB) primary partition. To create other types of partition, you just need to replace primary with one of the following:

Create partition type

➧Note: To create a partition, there must be unallocated space on the disk.

3. Format Partition

Type list volume command, you will find the new created partition is RAW, which means you must format partition before you can use it. To format a partition, please refer to the following command:

▪ format fs=ntfs quick

And then, you will receive a message says: DiskPart successfully formatted the volume.

The above command means to perform a quick format on the partition. It will be formatted with NTFS file system. To create other file system partition like FAT, FAT32, you just need to replace ntfs with fat or fat32. The label can be any name as you like.

Format RAW disk

➧Note: DiskPart cannot format 32GB+ partition to FAT32. To format a large hard drive to FAT32, you have to turn to a third-party partition manager.

4. Assign Drive Letter

A partition without a drive letter will be hidden under "File Explorer". To assign a drive letter to an existing partition, please refer to the following command:

▪ assign letter=F (F can be replaced with another letter that has not been used yet).

And then, you will receive a message says: DiskPart successfully assigned the drive letter or mount point.

Assign drive letter

5. Extend Partition

To extend a partition, please refer to the following command:

▪ extend size=20480

And then, you will receive a message says: DiskPart successfully extended the volume.

The above command means to add 20480MB (20GB) to the volume 6. If no size is given, all of the contiguous unallocated space on its right side will be added.

extend size

➧Note: To extend a partition, there must be contiguous unallocated space on its right side.

6. Shrink Partition

To shrink a partition, please refer to the following command:

▪ shrink desired= xxxxxx

And then, you will receive a message says: DiskPart successfully shrunk the volume by 39GB.

Shrink

➧Note: You can reduce the size of a volume only if it is formatted using the NTFS file system.

7. Mark Partition as Active

To mark a partition as active, please refer to the following command:

▪ active

And then, you will receive a message says: DiskPart marked the current partition as active.

Set active

Section 2. Most Common Commands on Disk in Windows 10/11

The most common diskpart commands used on the disk should be the MBR and GPT conversion. To delete all partitions or volumes on a disk and convert the disk between MBR and GPT, please refer to the following command:

▪ list disk

▪ select disk 1

▪ clean

▪ "convert gpt" or "convert mbr".

convert to GPT

convert to mbr

Free alternative to Windows 10/11 DiskPart Utility

As DiskPart alternative, AOMEI Partition Assistant Standard is a free partition manager software and disk management tool, that provides more features than DiskPart. It not only supports Windows 10, but also supports Windows 11/8.1/8, Windows 7, Vista, and XP. You can also resize the BitLocker partition when it is running out of space. With a user-friendly interface, it is very easy to use.

To perform an operation on a partition, you just need to right-click on it. The operations supported by AOMEI Partition Assistant Standard are as below:

Operation On Partition

The operations of disk management and step-by-step wizards are as below:

Operation On Disk

DiskPart in Windows 10/11 can meet the basic requirement of most users. And the free AOMEI Partition Assistant is more advanced than it and provides more amazing features. For example, it can extend/shrink both FAT32 and NTFS partition. For extending a partition, its “Merge partition” allows users to add non-adjacent unallocated space into the target partition. It is able to format large partition (2TB at most) to FAT32 file system. For partition style conversion, it can convert data disk between MBR and GPT without deleting partitions.

You can download this freeware and have a try. To get more advanced features, such as converting dynamic disk into basic without losing data, recovering lost partition, you can upgrade AOMEI Partition Assistant Standard to Professional version.

Download Freeware Win 11/10/8.1/8/7/XP
Secure Download

FAQs about Diskpart

Can I use Diskpart to format a disk or partition?
Yes, Diskpart allows you to format disks and partitions. Use the command we've shown in the post and follow the desired options and parameters.

What is the difference between a disk and a volume in Diskpart?
In Diskpart, a disk refers to a physical storage device, while a volume is a partition on a disk. A disk can contain multiple volumes.

What should I do if Diskpart gives an "Access Denied" error?
If you encounter "Access Denied" errors in Diskpart, ensure that you are running the Command Prompt or PowerShell as an administrator. Administrative privileges are necessary for many Diskpart operations.

How can I recover data from a deleted partition using Diskpart?
Unfortunately, Diskpart does not provide a straightforward method for partition recovery. Consider using specialized data recovery tools like AOMEI Partition Assistant for this purpose.

How do I check the status of a disk or partition in Diskpart?
Use the `detail disk` or `detail partition` commands in Diskpart to view detailed information about a specific disk or partition, including its status and attributes.

Emily
Emily · Staff Editor
Emily is an English editor of AOMEI Technology; she has a great passion for providing easy solutions for people to tackle with all disk or partition management problems. In addition to writing articles about disk/partition management, she also edits great tutorials on how to back up and restore disk for data security. In her spare time, she loves to learn computer skill to improve herself or stay with her family to enjoy a good day.