Most Windows beginners might know that the Diskpart is a free disk utility that helps take control of some disk partitions on the computer. However, what command should you use to process specific orders to the Operating Systems, and do you know how to protect your data from being removed from these Diskpart commands? Following this guide, you'll further learn what exactly Diskpart does, what Diskpart commands you can apply to manage disk drives, and you can even follow some tips to fix Diskpart errors like a professional. 

  1. Price: Free
  2. Reading Duration: 3-5 minutes.
  3. Target Users: Windows beginners and mature users.
  4. Supported OS:  Windows 11/10/8.1/8/7/XP and Windows Servers.

Let's see how to use Diskpart on your computer now.

In this article, you'll learn:

  • What Is Diskpart
  • Learn About Most Common Diskpart Commands 
  • How to Open Diskpart Utility in Windows
  • How to Use Diskpart to Manage Hard Drive Partitions
  • How to Use Diskpart to Fix Device Errors
  • Troubleshooting Diskpart Errors On Windows

What Is Diskpart

Diskpart is a command-line disk partitioning utility included in Windows 2000 and later Microsoft operating systems, replacing its predecessor, fdisk.
                                                                                                  - by Wikipedia

Definition of Diskpart

From Wikipedia, Diskpart is a newer command-line disk partitioning tool to replace the older fdisk, and it supports all Windows users to run Diskpart syntax parameters to manage disk partitions on desktop computers, laptops, and even external storage devices.

Here is a list of basic information about Diskpart that you may feel like knowing:

  • Initial Release: February 17, 2000
  • Developers:Microsoft, Lee Schroeder
  • Predecessor: fdisk, also known as Fdisk.
  • Operating Systems: Windows, Windows Servers, and ReactOS

How Does Diskpart Work? 

Do you know how the operating system processes the command parameters and applies the executions on the target hard drive partitions? Here is the working procedure of Diskpart, and you may follow it to learn how this utility works:

Step 1. Open the Diskpart.

Step 2. Input available object, such as a disk, partition, or even a virtual disk, with commands:

  • list disk
  • list volume
  • list partition
  • list vdisk

Step 3. Focus on an object - the disk, volume, or partition:

  • select disk * (* presents the number of selected disk)
  • select volume * (* presents the number of selected volume)
  • select partition * (* presents the number of selected partition)

Step 4. Process operation orders to the OS via specific Diskpart syntax parameters.

Diskpart working process

What Does Diskpart Do - Benefits of DiskPart [Pros & Cons]

"The diskpart command interpreter helps you manage your computer's drives (disks, partitions, volumes, or virtual hard disks)." - by Microsoft

"The diskpart is a utility used for partitioning hard drives but can also format removable media such as flash drives." - by Wikipedia.

Briefly, Diskpart could be applied to execute the following tasks:

So why is Diskpart so popular? Here is a list of Pros and Cons of Diskpart, and you may follow to learn the benefits of this tool:

01

Pros of Diskpart:

  • 1. Free
  • 2. Cross-platform: Windows & ReactOS
  • 3. Applicable to all levels of users.
  • 4. Support more operational features than Disk Management.
  • 5. Rapid to process orders to the OS.
02

Cons of Diskpart:

  • 1. Complex
  • 2. No confirm option, and no undo option.
  • 3. Hard to remember all syntax parameters.
  • 4. Easy to type false commands and cause serious problems.
 

Learn About Most Common Diskpart Commands  

So which command is for formatting a volume, and which is for creating a new partition? First, check the listed Diskpart commands here in the below table, and you'll understand what each Diskpart command actually does:

Diskpart Commands Function
  • list disk
Get information about all disks on your computer.
  • list partition/volume
Get information about all partitions/volumes on a disk.
  • select disk/partition/volume *
Focus on a specific disk, partition, or volume. (* means the number of selected disks or partitions.)
  • detail disk/partition/volume
Display detailed information about the selected disk, partition, or volume.
  • create partition primary/logical size=*
Create a new primary or logical partition. (* means the volume size that you want to create in MB.)
  • delete disk/partition/volume *
Delete a specific disk, partition, or volume. (* means the disk or partition number.)
  • convert basic/dynamic/mbr/gpt
Convert a disk between basic and dynamic, MBR and GPT.
  • assign
Assign a drive letter to a new volume.
  • clean/clean all
Delete all partitions on a disk and remove all existing data. Or completely erase a hard drive or SSD, and wipe out all existing data.
  • format
Format a partition or a volume, change its file system to NTFS, FAT32, exFAT, etc.
  • active
Set a selected partition active.

Note that we only listed some common Diskpart commands here. If you need to learn more advanced Diskpart commands, you can follow this link provided by Microsoft for help: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/diskpart.

How to Open Diskpart Utility in Windows

So how do I access the Diskpart utility on a Windows computer? Here we list 4 paths that you can follow the respective one to open Diskpart based on your operating system:

1. Open Diskpart in Windows 11:

  • Press the Windows + S keys, and type diskpart in the Search box.
  • Right-click diskpart and select "Run as administrator".

Open Diskpart in Windows 11

2. Open Diskpart in Windows 10:

  • Press Windows + R keys and type cmd in the Run dialog.
  • Click "OK" to run Command Prompt.
  • Type diskpart and hit Enter in the command prompt window.

Open Diskpart in Windows 10

3. Open Diskpart in Windows 8:

  • Click the Start menu, select Search, and type cmd in the Search box.
  • Right-click on Command Prompt from the result list and select "Run as Administrator".
  • Type diskpart and hit Enter to open it.

Open Diskpart in Windows 8

4. Open Diskpart in Windows 7:

  • Click the Start menu, select Search, and type cmd.
  • Find and right-click Command Prompt from the result list, and select "Run as an Administrator".
  • Type diskpart in Command Prompt and hit Enter.

Open Diskpart in Windows 7

After you open the Diskpart, it's your turn to follow the full guide below to manage your hard disk partitions or external storage devices with respective Diskpart commands as introduced above. 

How to Use Diskpart to Manage Hard Drive Partitions

Here in this part, you'll get a respective guide as listed below to apply the Diskpart command to manage disk partitions for different purposes:

  1. #1. Create partition
  2. #2. Format Hard Drive Partition
  3. #3. Delete Partition, Clean or Erase a Hard Drive
  4. #4. Convert Disk to MBR/GPT
  5. More...
Notice:
Note that formatting, deleting, cleaning, erasing, or converting disks with Diskpart command lines may all cause serious data loss issues. So please make sure you create a backup of all existing essentials before trying the next tutorials. 

#1. Use Diskpart to Create Partition (Primary or Logical)

Applies to: create a new simple volume, primary partition, or logical partition.

Step 1. Open Diskpart.

Step 2. Type list disk and hit Enter.

Step 3. Type select disk * and hit Enter. (Replace * with the number of the target disk you want to create a partition on it.)

Step 4. Type the respective command to create a partition on the selected disk:

  • create partition primary size=* (* stands for the partition size in MB.) or create partition logical =*
  • assign drive letter=* (Replace * with the drive letter you want to add to the new volume.)
  • format fs=ntfs quick (you can also replace NTFS with other desired formats like FAT32, or exFAT, etc.)

Format partition

LEARN MORE

Aside from creating a primary or logical partition, you can also use Diskpart commands to create boot volume, dynamic volume, RAID-5, mirrored volume, and more. Follow this link and learn How to Create Volume by Using Diskpart.

#2. Use Diskpart to Format or Quick Format Hard Drive/SSD or USB

Applies to: Format hard drive/SSD, quick format USB or external disks using Diskpart/CMD. 

Step 1. Open Diskpart.

Skip Step 2 if you need to format an internal hard drive.

Step 2. Connect a removable external hard disk or USB to your PC.

Step 3. Type the following command lines one by one and hit Enter each time:

  • list disk
  • select disk * (Replace * with the number of the target disk.)
  • list volume
  • select volume * (Replace * with the volume number on your disk that you need to format.)
  • format fs=ntfs quick, or format fs=fat32/exfat quick. 

Note that you need to repeat the process if you need to format multiple partitions on your computer.

Step 4. Type exit and close Diskpart when the process completes. 

Formt partitoin using Diskpart

BONUS TIP:

related articles

How to Clean and Format a Disk Using Diskpart

Aside from quick formatting a storage device, you can also apply the Diskpart Utility to clean and format a disk so as to make use of it as fresh as new. Follow to learn the details.

Format disk using diskpart

#3. Use Diskpart to Delete Partition, Cleanup, or Erase Disk 

Applies to: Delete volumes, remove recovery partition, clean disk, or erase HDD/SSD using Diskpart. 

To Delete Partitions from Hard Drive:

  • Open Diskpart.
  • Type list disk and hit Enter.
  • Type list partition and hit Enter.
  • Type select partition * and hit Enter. (Replace * with the number of target volume you want to delete.)
  • Type delete partition and hit Enter.

Delete partition usig Diskpart

Note that if you need to delete a recovery partition, replace delete partition with delete partition override.

Bonus Tip:

If you want to delete all existing partitions on a disk quickly, you can follow this link for help: How to Use Diskpart to Delete All Partitions.

To Cleanup or Erase Disk:

If you are about to get rid of everything from your hard drive or SSD, Diskpart Clean command is exactly what you need. Here is how to do so:

  • Open Diskpart.
  • Type the following commands to wipe a disk completely:
  • list disk
  • select disk * (Replace * with the number of target disk you wish to erase.)
  • clean all

Clean all paritions on disk with diskpart

  • Type exit to close Diskpart.

If you need to continue using the disk for other purposes, you can revert to the first guide to Create Partition with Diskpart on the disk.

#4. Use Diskpart to Convert Disk from MBR to GPT or GPT to MBR

Applies to: Change disk type, convert MBR to GPT or GPT to MBR using Diskpart.

  • Open Diskpart.
  • Type list disk and hit Enter.
  • Type select disk * and hit Enter.
  • Type clean and hit Enter.
  • Type convert mbr or convert gpt and hit enter.

Convert disk to mbr or gpt using Diskpart

Bonus Tip: 

Note that Diskpart will remove all existing partitions on a disk before converting its disk type to another one. For a seamless solution, you may try a third-party disk conversion tool. Follow this link, and you can successfully Convert GPT Disk to MBR without losing data.

#5. Other Hot Commands to Manage Partitions with Diskpart

Alongside creating, formatting, cleaning, or converting disk partitions, you can also apply Diskpart commands to execute other partitioning tasks, such as extending, shrinking, and active partitions.

To Extend Partition with Diskpart:

  • Open Diskpart and type list volume. Hit Enter.
  • Type select volume * and hit Enter.
  • Type extend or extend size=* (Replace * with the volume size you want to add to the selected partition.)

Extend partition using Diskpart

To Shrink Partition with Diskpart:

  • Open Diskpart and type list volume, hit Enter.
  • Type select volume * and hit Enter. (Replace * with the number of target volume you want to shrink.)
  • Type shrink desired=* and hit Enter. (Replace * with the volume size you want to shrink from the selected partition.)

Shrink partition using Diskpart

To Mark Partition as Active with Diskpart:

  • Open Diskpart and type list disk, and hit Enter.
  • Type select disk * and hit Enter. (Replace * with the number of target disk.)
  • Type list partition and hit Enter.
  • Type select partition * and hit Enter. (Replace * with the number of desired partition you want to set as active.)
  • Type active and hit Enter.

Set partition active usign diskpart

Aside from this, you can also use Diskpart command lines to merge partitions, hide partitions, and even show hidden partitions. 

Diskpart Alternative Free Download

Though Diskpart is free for all Windows users to apply and resolve some daily disk management issues, however, it's still a bit complex for some Windows users who have no computing skills. EaseUS Partition Master Free, with its reliable disk partition features, is entirely qualified to replace Diskpart and assist all of you in fulfilling all types of disk partition requests with simple clicks.

Free Download 

Windows 11/10/8/7100% Secure

Bonus Tip:

If you are about to look for more free and equal tools that could be applied to manage disk partitions, you may follow Best Diskpart Alternatives for Windows 11, 10, 8, 7 and get to learn more details.

How to Use Diskpart to Fix Device Errors 

The Diskpart Utility is also practical to assist you in resolving some common device errors. For example, a storage device becomes RAW, or a hard drive becomes read-only.

If you happen to have the same issue on your storage devices, follow the tips here, and you'll make your device work normally again:

#1. Fix Drive Read Only with Diskpart

Command: attributes disk clear readonly command

Applies to Fix: hard drive partition or storage devices show Read-only.

Step-By-Step Guide:

Step 1. Open Diskpart by clicking the Start menu, typing cmd in the search box, and hitting Enter. Then type diskpart in the command prompt and hit Enter.

Step 2. Type list disk and hit Enter.

Step 3. Select disk * and hit Enter. (Replace * with the number of your disk, which is read-only.)

Step 4. Type attributes disk clear readonly and hit Enter.

Fix device read only issue with Diskpart

LEARN MORE

Note that the Disk Read Only error could be caused by various reasons. Aside from using Diskpart, you can also try Registry, Read-only removal software, and other solutions to fix this issue on your device. Follow this link to learn 5 methods about How to Change Drive from Read Only to Read and Write.

#2. Convert Device from RAW to NTFS

Command: chkdsk, format FS=NTFS

Applies to Fix: USB, hard drive, or external disk becomes RAW, inaccessible.

If you have essential data saved on a RAW device, you may refer to reliable data recovery software to scan and restore all content from the device first. 

Step-by-Step Guide: 

Step 1. Open Diskpart.

Step 2. Type chkdsk e: /f /r /x and hit enter. (Replace E: with the drive letter of RAW device.)

Fix device becoming RAW issue with diskpart

Step 3. Type list partition and hit Enter.

Step 4. Type select partition * and hit Enter. (Replace * with the number of the RAW partition.)

Step 5. Type format fs=NTFS quick and hit Enter.

LEARN MORE

Aside from Diskpart, you can also apply disk management or a third-party disk partitioning software to get rid of the RAW issue on your device. You just need to follow this link: Convert RAW to NTFS to learn more details.

Troubleshooting Diskpart Errors On Windows

According to many experienced Windows service providers and Windows beginners, the Diskpart utility may also report some strange error messages in the command prompt window. 

If you are having one of the following error messages, stay calm. You may follow the resolutions below to eliminate Diskpart errors and make it function normally again. 

Error 1: Diskpart I/O Device Error

  • Error Message: "Diskpart has encountered an error the request could not be performed because of an i/o device error".

Error message of I/O device error in Diskpart

Troubleshooting: Fix DiskPart I/O Device Error in Windows 10/8/7

Error 2: Diskpart Has Encountered an Error, Access Is Denied

  • Error Message: "Diskpart has encountered an error: Access is denied. See the System Event Log for more information."

Diskpart has encountered an error

Troubleshooting: How to Fix Diskpart Has Encountered an Error Access Is Denied Error

Error 3: Diskpart Failed to Clear disk Attributes

  • Error Message: "Diskpart failed to clear disk attributes." 

Diskpart failed to clear disk attributes

Troubleshooting: How to Fix Diskpart Failed to Clear Disk Attributes Error

Error 4: The System Cannot Find The File Specified

  • Error Message: "The system cannot find the file specified."

System cannot find the file specified

Troubleshooting: 8 Fixes to Remove System Cannot Find The File Specified Error

Error 5: Virtual Disk Service errors in Disk Part

  • Error Message: "Clean is not allowed on the disk containing the current boot, system, pagefile, crashdump or hibernation volume".

Clean is not allowd with virutual disk service error

  • Error Message: "The specified disk is not convertible. CDROMs and DVDs are examples of disks that are not convertible".

specified disk is not convertable with virtual disk service error

Troubleshooting: How to Fix DiskPart Virtual Disk Service Errors 

Conclusion

On this page, we thoroughly discussed that is Diskpart, what Diskpat can do for you, the benefits of using Diskpart, and displayed some common Diskpart commands.

Following this page, you will learn how to master these Diskpart commands to manage your hard drive partitions and external storage devices. 

Also, you can apply some troubleshooting fixes to eliminate normal device errors like Read-only, or the device becomes RAW and makes your device function normally again.

For beginners, if you are reluctant to use Diskpart as it's complex to remember all the commands, your best shot is to turn to EaseUS Partition Master Free for help. It will always save your device from deathly errors and bring life back to your disk partitions.

Free Download 

Windows 11/10/8/7100% Secure

 

Was This Page Helpful?

Updated by Tracy King

Tracy joined in EaseUS in 2013 and has been working with EaseUS content team for over 7 years. Being enthusiastic in computing and technology, she writes tech how-to articles and share technical solutions about Windows & Mac data recovery, file/system backup and recovery, partition management and iOS/Android data recovery.

Read full bio