How to Use DISKPART to Create or Delete a Partition

Photo of author

By Victor Ashiedu

Published

In this Itechguide, Victor teaches you how to use DISKPART to create a partition and assign a drive letter. The guide also covers steps to use DISKPART to delete a partition.

Option 1: Create a Partition and Assign a Drive Letter

DISKPART is one of the most useful CMD commands for System Administrators. This section covers steps to use this must-know tool to create a new partition and assign a drive letter to the partition.

Step 1: Open Command Prompt as an Administrator

To use DISKPART, you need to open Command Prompt as administrator. Here are the steps to run CMD as Administrator…

  • Type command prompt in the search box. Then, from the search results, right-click Command Prompt and select Run as Administrator.
How to Use DISKPART to Create a Partition and Assign a Drive Letter.
  • When you receive a User Access Control (UAC) confirmation, requesting you to allow the “app to make changes to your PC”. On the UAC prompt, click Yes.
How to Use DISKPART to Create a Partition and Assign a Drive Letter.

Step 2: Create a Partition

After opening Command Prompt as administrator, use the steps below to create a partition.

  • On the CMD Prompt, to open the DISKPART command prompt, type the command below and press enter.
DISKPART
  • The DISKPART CMD prompt will open.
How to Use DISKPART to Create a Partition
  • On the DISKPART prompt, use the LISK DISK command to list all available disks – type the command and press enter.
LIST DISK 
  • The LIST DISK command displays all the disks on your PC. The next step is to select the disk you want to use DISKPART to create a partition on.
Note the disk number for the disk you want to create a partition on. For this example, my disk number is 1. Note that this disk is currently Offline.
  • To select the disk, use the command below – enter the command and press enter.
SELECT DISK 1 
Change 1 to your disk # identified in the previous step.
  • The last command should return “Disk # selected successfully”
How to Use DISKPART to Create a Partition and Assign a Drive Letter.
  • If your disk is Offline, you need to take it Online. Use the command below.
ONLINE DISK
  • The command should return “DiskPart successfully onlined the selected disk”. To confirm that the disk is now online, run the LIST DISK command.
  • To be sure that your disk is still selected, run the SELECT DISK command again. Then, to see if there are any partitions on the selected disk, run the command below – this will list all available partitions on the selected disk.
LIST PARTITION 
  • If there are partitions on the disk, they will be displayed. Otherwise, the command will return “There are no partitions on this disk to show”.
  • To use DISKPART to create a partition, type the command below. Then, press enter. Before you press enter, read the notes below the command.
CREATE PARTITION PRIMARY SIZE=n

The above command will create a Primary partition. If you want to create an Extended partition, replace PRIMARY with EXTENDED. In the command, n is the size of the partition in Megabytes. To create a partition with all available disk space, DO NOT specify the SIZE parameter.

To read more about disk partitions, read this How-to-geek guide – Hard Disk Partitions Explained.

  • Here is a real sample command – this DISKPART command creates a partition with all available spaces on the selected disk.
CREATE PARTITION PRIMARY
  • If DISKPART returns “DiskPart succeeded in creating the specified partition”, the partition was created. Otherwise, if it returns an error, read the error details and fix the problem.
  • To confirm that the partition was created, run the LIST PARTITION command again. The partition will now be listed!

Step 3: Assign a Drive Letter

After creating a partition, you need to assign a drive letter to the partition. Here are the steps…

  • Still on the DISKPART prompt, type the command with the format below.
ASSIGN LETTER=N

N is your drive letter. The command below assigns letter D to the partition you created in the last section…

ASSIGN LETTER=D
  • If the drive letter is not available, you will receive an error message – try another letter.
  • In the command shown in the image below, I used drive F and the drive letter was assigned successfully!
How to Use DISKPART to Assign a Drive Letter

Option 2: Delete a Partition

If you can DISKPART to create a partition, you can also use DISKPART to delete a partition. Here are the steps…

DISKPART  
  • The DISKPART prompt will open.
How to Use DISKPART to Delete a Partition
  • On the DISKPART CMD prompt, type the LIST DISK command. Then, press enter.
LIST DISK 
  • The LIST DISK command lists all the disks on your PC. The next step is to select the disk you want DISKPART to delete a partition from.
In this example, I want to delete a partition from Disk 1.
How to Use DISKPART to Delete a Partition
  • To select the disk, use the SELECT DISK command. Here is an example command that selects disk 1.
SELECT DISK 1

Replace 1 with your disk #. The next step is to list partitions on the select disk.

  • Use the command below to list available partitions on the disk.
LIST PARTITION
  • Then, select the partition you want to delete with this command…
SELECT PARTITION 1

Replace 1 with your partition #

  • Finally, to use DISKPART to delete a partition, type the command below and press enter.
DELETE PARTITION
  • To see how to run the commands above, see the image below…

As you can see, it is very easy to use DISKPART to create or delete a partition!

I hope you found this Itechguide helpful. If you were able to use DISKPART to create or delete a partition by following this guide, click on “Yes” beside the “Was this page helpful” question below.

You may also express your thoughts and opinions by using the “Leave a Comment” form at the bottom of this page.

Finally, for more Command Prompt Itechguides, visit our Windows Command Prompt page.

About the Author

Photo of author

Victor Ashiedu

Victor is the founder of InfoPress Media, publishers of Ilifeguides and Itechguides. With 20+ years of experience in IT infrastructure, his expertise spans Windows, Linux, and DevOps. Explore his contributions on Itechguides.com for insightful how-to guides and product reviews.

Related Articles

Get in Touch

We're committed to writing accurate content that informs and educates. To learn more, read our Content Writing Policy, Content Review Policy, Anti-plagiarism Policy, and About Us.

However, if this content does not meet your expectations, kindly reach out to us through one of the following means:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment