Most Windows novices might know Diskpart as a free disk utility that helps manage some disk partitions on the computer. But do you know what commands to send to the operating system to execute specific tasks, and how to protect your data from being deleted by these Diskpart commands? Follow this guide, and you'll have a deeper understanding of what Diskpart is, what Diskpart commands can be used to manage disk drives, and even some tricks to fix Diskpart errors like a pro.

    • Price: Free
    • Reading Time: 3-5 minutes.
    • Audience: Beginners and experienced users of Windows.
    • Supported Operating Systems: Windows 11/10/8.1/8/7/XP and Windows Server.

Now let's see how to use Diskpart on your computer.

Please provide the English content you want translated, and I'll do my best to translate it into Chinese.

In this article, you will learn:

  • What is Diskpart
  • Get familiar with the most common Diskpart commands
  • How to open the Diskpart tool in Windows
  • How to manage hard drive partitions with Diskpart

What is Diskpart?

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

Diskpart is a command-line tool used for managing disk partitions and volumes. It is provided with the Windows operating system and allows users to perform various disk operations such as creating, deleting, formatting partitions, resizing volumes, setting active partitions, and more. Users can initiate this tool by running the Command Prompt and typing "diskpart," followed by a series of commands to manage their disks.

As mentioned in Wikipedia, Diskpart is a newer command-line disk partitioning utility that has replaced the older fdisk. It supports all Windows users in managing disk partitions on desktops, laptops, and even external storage devices with Diskpart syntax commands.

Here is some basic information about Diskpart that you might find interesting:

    - Initial release: February 17, 2000 - Developer: Microsoft, Lee Schroeder - Predecessor: fdisk, also known as Fdisk. - Operating systems: Windows, Windows Server, and ReactOS

"How does Diskpart work?"

Ever wondered how an operating system deals with command-line parameters and applies them to a targeted disk partition? The following is a brief overview of how Diskpart works, which will give you an idea of the tool's mechanics:

Step 1: Launch Diskpart.

Step 2. Type the following command to list available objects, such as disks, partitions, or even virtual disks:

    • List disks
    • List volumes
    • List partitions
    • List virtual disks

Step 3. Choose an object to work with – a disk, volume, or partition:

  • Select disk * (* denotes the selected disk number)
  • Select volume * (* denotes the selected volume number)
  • Select partition * (* denotes the selected partition number)

Step 4. Send commands to the operating system with specific Diskpart syntax.

Diskpart working process

"What is Diskpart - Advantages and Disadvantages of DiskPart [Pros & Cons]"

"Diskpart is a command-line interpreter that helps you manage the drives on your computer (disks, partitions, volumes, or virtual hard disks)." - From Microsoft.

"Diskpart is a command-line utility for partitioning hard drives, but can also format removable media such as flash drives." - From Wikipedia.

In a nutshell, Diskpart can be used to perform the following tasks:

So why is Diskpart so popular? Here's a list of its pros and cons to help you understand the benefits of this tool: Pros: 1. **Built-in Tool:** Diskpart is a command-line utility that comes bundled with Windows, eliminating the need for additional software installations. 2. **Automation:** It supports batch commands, allowing you to script disk management tasks, which is convenient for bulk operations. 3. **Advanced Features:** Diskpart offers advanced disk management functions like creating, deleting, formatting, and extending volumes. 4. **Command-Line Interface:** For users familiar with CLI, Diskpart provides a direct and precise method of operation. 5. **Remote Management:** Through Remote Server Administration Tools, Diskpart can manage disks on other computers remotely. Cons: 1. **Learning Curve:** Users unfamiliar with command lines might find Diskpart's learning curve steep, requiring knowledge of command syntax. 2. **No Graphical User Interface:** The lack of a GUI may lead to accidental misoperations, especially without confirmation prompts. 3. **Higher Risk:** Incorrect commands can result in data loss or disk damage, as its operations are typically executed immediately. 4. **Limited Error Checking:** Compared to graphical disk management tools, Diskpart offers less error checking when input mistakes occur or wrong disks are selected. 5. **Not Beginner-Friendly:** For new users not accustomed to command-line tools, Diskpart might not be the most suitable choice. After considering these pros and cons, you can decide whether Diskpart aligns with your needs and skill level.

01

Advantages of Disk Partitioning::

  • 1. Free
  • 2. Cross-platform: Windows & ReactOS
  • 3. Suitable for users of all levels
  • 4. Offers more operational functions than Disk Management
  • 5. Fast command processing speed for the operating system
02

Disadvantages of Disk Partitioning::

  • 1. Complex
  • 2. No confirmation options, and actions cannot be undone
  • 3. Difficult to memorize all syntax parameters
  • 4. Easy to enter wrong commands, leading to serious issues
Sorry, the content you provided is " ", which is a space character. It doesn't have a direct corresponding translation in Chinese. If you need to translate a specific English sentence or paragraph, please provide more information.

Learn the most common Diskpart commands:

So which command formats a volume, and which one creates a new partition? First, familiarize yourself with the Diskpart commands listed in the following table:

Disk Management Commands Function
  • list disk
Get information of all disks on the computer.
  • list partition/volume
Get information of all partitions/volumes on a disk.
  • select disk/partition/volume *
Select a specific disk, partition or volume. (* stands for the selected disk or partition number).
  • detail disk/partition/volume
Display detailed information of the selected disk, partition or volume.
  • create partition primary/logical size=*
Create a new primary or logical partition. (* indicates the size of the volume you want to create, in MB).
  • delete disk/partition/volume *
Delete a specific disk, partition or volume. (* stands for the disk or partition number).
  • convert basic/dynamic/mbr/gpt
Convert between basic and dynamic disks, as well as between 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 clear all existing data.
  • format
Format a partition or volume and change its file system to NTFS, FAT32, exFAT, etc.
  • active
Set the selected partition as active.

Note that this list contains only some common Diskpart commands. If you need to learn more advanced Diskpart commands, refer to this link provided by Microsoft for assistance: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/diskpart.

How to Open Diskpart Tool in Windows

So, how to access the Diskpart utility on a Windows computer? Here are 4 ways listed below that you can follow to open Diskpart respectively according to your operating system:

1. Open Diskpart in Windows 11:

    1. Press the Windows + S keys, then type **diskpart** in the search box. 2. Right-click on "diskpart" and select "Run as administrator."

Open Diskpart in Windows 11

2. Open Diskpart in Windows 10:

  • Hold down the Windows key and press R to open the Run dialog box.
  • Type cmd, then click OK to launch Command Prompt.
  • Type diskpart in the Command Prompt window, then press Enter.

Open Diskpart in Windows 10

3. Open Diskpart in Windows 8:

    1. Click the Start menu, choose Search, and type cmd in the search box. 2. Right-click "Command Prompt" in the results list, and select "Run as administrator." 3. Type diskpart and press Enter to open it.

Open Diskpart in Windows 8

4. Open Diskpart in Windows 7:

    1. Click the Start menu, choose Search, and then type cmd. 2. Right-click on "Command Prompt" in the search results list, and select "Run as administrator." 3. In the Command Prompt, type diskpart, and press Enter.

Open Diskpart in Windows 7

After opening Diskpart, you need to manage your hard drive partitions or external storage devices with the corresponding Diskpart commands described above, following this comprehensive guide:  

How to Manage Hard Disk Partitions Using Diskpart

Here, you will get the guidelines listed below to manage disk partitions using the Diskpart command for different purposes:

Caution:
Be aware that using the Diskpart command line to format, delete, clean, erase or convert a disk can lead to severe data loss. So, make sure to back up all your important files before trying the tutorials below.

#1. Create a Partition Using Diskpart (Primary or Logical)

This applies to creating new simple volumes, primary partitions, or logical drives.

Step 1. Open Diskpart.

Step 2: Type list disk and press Enter.

Step 3: Type select disk * and press Enter. (Replace * with the number of the disk where you want to create the partition.)

Step 4. Enter the appropriate command to create a partition on the selected disk:

  • Create primary partition size=* (replace * with the size of the partition in MB) or Create logical partition=*
  • Assign drive letter=* (replace * with the drive letter you want to assign to the new volume)
  • Format fs=ntfs quick (you can replace NTFS with another file system of your choice, such as FAT32, exFAT, etc.)

Format Partition

Please provide the English content you want translated, and I'll do my best to translate it into Chinese.

Learn More

Aside from creating primary or logical partitions, you can also use Diskpart to create boot volume, dynamic volume, RAID-5, mirrored volume, etc. Click here to learn how to create volume with Diskpart.

#2. Format or Quick Format Hard Disk/SSD or USB with Diskpart

Applies to: Format a hard drive/SSD, quickly format USB flash drive, or format external disk with Diskpart/CMD.

Step 1: Launch Diskpart.

If you need to format the internal hard drive, skip Step 2.

Step 2: Connect your portable external hard drive or USB to your computer.

Step 3: Type each of the following commands, pressing Enter after each one:

    • **list disk** • **select disk * ** (Replace * with the number of the target disk.) • **list volume** • **select volume * ** (Replace * with the volume number on the disk to be formatted.) • **format fs=ntfs quick** or **format fs=fat32/exfat quick.**

Note that if you need to format more than one partition on the computer, you will need to repeat this process for each one.

4. When you are finished, type exit to close the disk partition utility.

Format disk with Diskpart

#3. Using Diskpart to Delete Partitions, Clean, or Erase a Disk

Applies to: Using Diskpart to delete a volume, remove a recovery partition, clean a disk, or erase an HDD/SSD.

Delete partitions from the hard drive:

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

Use Diskpart to delete partition

Note: If you need to delete the recovery partition, replace delete partition with delete partition override.

Please provide the English content you want to translate, and I'll translate it into Chinese for you promptly.

Extra Tip:

If you want to quickly delete all existing partitions on the disk, please refer to the link: How to delete all partitions with Diskpart.

To clean or wipe a disk:

If you're about to erase everything on your hard drive or SSD, the Diskpart Clean command is what you need. Here's how to use it.

    1. Open Diskpart. 2. Type in the following commands to completely wipe the disk: 3. **list disk** 4. **select disk * ** (Replace * with the number of the disk you want to delete.) 5. **clean all**

Use the clean all command in Diskpart to clear all partitions on the disk

    4. Type **exit** to close Diskpart.

If you need to use the disk for another purpose, you can go back to the first guide and proceed with Creating a partition with Diskpart.

#4. Convert disk from MBR to GPT or from GPT to MBR using Diskpart

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

    1. Open Diskpart. 2. Type `list disk` and press Enter. 3. Type `select disk *` and press Enter. 4. Type `clean` and press Enter. 5. Type `convert mbr` or `convert gpt`, then press Enter.

Convert disk to MBR or GPT with Diskpart

Please provide the English content you want translated, and I'll promptly translate it into Chinese for you.

Additional Tip: Please note that Diskpart will delete all existing partitions on the disk before converting it to another type. For a seamless solution, you might want to try using a third-party disk conversion tool. Click this link to successfully convert a GPT disk to an MBR disk without losing data.

#5. Other Popular Commands for Managing Partitions with Diskpart

In addition to creating, formatting, cleaning, or converting disk partitions, you can use the Diskpart command to perform other partition tasks, such as extending, shrinking, and activating a partition.

Use Diskpart to extend the partition:

    1. Launch Diskpart, then type list volume and press Enter. 2. Input select volume *, then press Enter (replace * with the volume you want to select). 3. Type extend or extend size=* (replace * with the amount of size you want to add to the selected partition).

Extend partition with Diskpart

"Using Diskpart to shrink a partition"

    1. Launch Diskpart, then type **list volume** and hit Enter. 2. Type **select volume * ** and press Enter. (Replace the asterisk (*) with the number of the volume you want to shrink.) 3. Input **shrink desired=*** and hit Enter. (Replace the asterisk (*) with the amount of size, in MB, that you want to shrink from the selected partition.)

Shrink partition with Diskpart

Use Diskpart to mark the partition as active:

    1. Launch Diskpart and type list disk, then press Enter. 2. Type select disk * and press Enter, replacing * with the number of the target disk. 3. Type list partition, then press Enter. 4. Type select partition * and press Enter, replacing * with the number of the partition you want to activate. 5. Type active, then press Enter.

Use Diskpart to set the partition as active

In addition, you can use Diskpart command line to merge partitions, hide a partition and show hidden partition.

"Free Download Alternative to Diskpart"

Though Diskpart is free for all Windows users and can solve some daily disk management issues, it's still complicated for some Windows users who have no computer skills. And the reliable AOMEI Partition Assistant Free, can totally replace it to help you accomplish various disk partitioning tasks with simple clicks.

Conclusions

On this page, we discuss in detail what Diskpart is, what Diskpart can do for you, the benefits of using Diskpart, and demonstrate some common Diskpart commands.

After reading this article, you will know how to use these Diskpart commands to manage disk partitions and external storage devices.

In addition, you can apply some troubleshooting fixes to get rid of normal device errors like read-only or RAW and make it work normally.

For beginners, if you don't want to use Diskpart due to the many commands you have to remember, your best bet is to use Partition Master Free. It will always save your device from fatal errors and breathe new life into your disk partitions.