How to Configure a New Hard Drive Using the Windows DiskPart Command


**Disclosure: This post contains affiliate links. If you make a purchase through these links, we may earn a small commission at no extra cost to you.

With hard drives getting larger and faster all the time, it makes sense that you might want to upgrade your drive to gain some additional performance from your computer. Or you may be building your own computer and want to get the largest and fastest drive you can afford.

When you replace a hard drive or add a new drive to your computer, you will need to configure it before Windows will be able to recognize it and allow you to use it to store your files and folders. To configure your new hard drive, you can use the Windows Disk Management tool if you want to go the GUI route. But if you are into the command line, we will be showing you how to configure a new hard rive using the Windows DiskPart command.

The image below shows our newly installed hard drive (Disk 1) in the Windows Disk Management tool. As you can see, the drive is offline and does not have any volumes\partitions created on it.

Windows Disk Management tool

To use the DiskPart command line tool to configure our new hard drive, we will first need to open an administrative command prompt.  To do so, simply type cmd in the Windows taskbar search box and then choose the Run as administrator option to the right or right click the Command prompt icon itself and choose Run as administrator.

Next, we will need to type in diskpart and press enter to enter the DISKPART> prompt.

How to Configure a New Hard Drive Using the Windows DiskPart Command

The first thing we need to do is type in list disk which will show the hard drives installed on the computer. Then once we figure out which disk we want to work with, we can type select disk X to work with that disk. You will need to substitute X with the number of the disk you want to work with. In our example, we want to work with Disk 1.

How to Configure a New Hard Drive Using the Windows DiskPart Command

Now that Disk 1 is selected we can type online disk to bring the disk online. Next, we will type in clean to wipe all the existing partitions on the drive. This step is not necessary if it’s a new drive with nothing on it but if it’s a disk from another computer for example, the clean command is an easy way to wipe all the data on the drive.

If you plan on installing Windows 11 on your drive or if you plan on having partitions larger than 2TB, you can use the convert gpt command to convert it to GPT (GUID Partition Table). You can also type convert mbr to convert it to MBR (Master Boot Record). You can check out this article which discusses the differences between GPT and MBR.

How to Configure a New Hard Drive Using the Windows DiskPart Command

Next, we will need to create any partitions you want to configure for the new drive. If you use the create partition primary command by itself, DiskPart will use the entire disk for the new partition.

If you want to create more than one partition, you can use the same command but add size=X where X is the size in megabytes you want to use for the partition.

For example, we want to split our 100GB disk into two equal partitions so our first command will be create partition primary size=51200 which will create the first 50GB partition. Then we will use format fs=ntfs label=”Project 1″ quick which will format the new partition using NTFS with label disk label of “Project 1”. Then we will use the assign letter=E command which will mount it as drive letter E. You can use the format and assign letter commands the same way when creating a partition that uses the entire disk.

How to Configure a New Hard Drive Using the Windows DiskPart Command

Since we want to use the rest of the disk space for our second partition, we will use the create partition primary command to use the remaining space (~50GB). Then we will format the drive, give it a label of Project 2 and assign it the drive letter F with the following commands.

Format fs=ntfs label=”Project 2″ quick

Assign letter=F

How to Configure a New Hard Drive Using the Windows DiskPart Command

If you want to use a dynamic disk instead of a basic disk, then you can use the convert dynamic command. This is not available in Home editions of Windows so keep that in mind. Dynamic disks are used to enable advanced storage configurations like spanned, striped (RAID 0), mirrored (RAID 1), and RAID-5 volumes across one or more physical drives. Unlike basic disks, they allow for flexible volume management, including resizing and combining disks without repartitioning.

Once we are done configuring the drive, we will type exit to close DiskPart.

Now if we open Disk Management again, we will be able to see our newly configured hard drive with its new partitions, volume labels and drive letters.

Windows Disk Management tool

For additional training resources, check out our online IT training courses.

Check out our extensive IT book series.

Related Posts

© 2025 Online Computer Tips
Website by Anvil Zephyr