How to Partition and Erase Windows Volumes with Diskpart

choubertsprojects

The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

While the task of erasing and partitioning disks may seem daunting, it is actually quite simple. Partitioning a disk allows you to use an old storage device with multiple volumes which will allow for increased speed and less impact on resource usage by your computer

Diskpart is a command-line tool that allows users to partition and erase Windows volumes. “diskpart create partition windows 10” will create a new volume on the hard drive.

How to Partition and Erase Windows Volumes with Diskpart

You must learn how to use Diskpart if you need to manage disks, partitions, and volumes on your Windows PC. Diskpart is a command-line disk management software that lets you manage drives, partitions, and volumes in Windows.

In this article, you’ll learn how to use Diskpart to shrink, expand, and remove volumes, as well as manage unallocated space.

Let’s get started!

Prerequisites

If you want to follow along with any of the demonstrations in this lesson, make sure you have:

  • Windows 7+ — Although all of the examples in this article utilize Windows 10, everything should still function on prior versions of Windows.
  • To manage Windows storage, create a local user account with administrator access.

Getting to Diskpart

Unlike many other command-line applications, Diskpart allows you to interact with it. Instead of continually entering the command diskpart, you execute it just once to enter an interactive session.

Open Windows PowerShell as administrator to access the Diskpart shell.

Although cmd.exe will function, the course will utilize PowerShell since it is the successor of cmd.exe.

In PowerShell, open a Diskpart session by typing diskpart. You can tell you’re in a diskpart session from the new DISKPART> prompt, as shown below.

Getting to DiskpartGetting to Diskpart

Type exit if you need to leave Diskpart.

Choosing a Disk

This tutorial consists of many sections which have one thing in common, Choosing a Disk. To prevent from explaining how to do this in each section, be sure you know how to select a disk when the tutorial mentions it.

Because your Windows system is likely to have numerous drives, one of the first things you’ll do is choose which disk to work with. To do so, instruct Diskpart to list all accessible disks from inside the Diskpart session.

The list disk command will then return all of the disks that Windows currently sees. Then, select a disk providing the disk number. For example, the command below is Choosing a Disk number 0.

When Diskparts has finished selecting the disk, it will display the message below and return you to the Diskpart prompt. Now you may start controlling the partitions and volumes on that drive.

Choosing a DiskChoosing a Disk

Choosing a Volume

Similarly to Choosing a Disk, this tutorial will require you to also select a volume with Diskpart. In the sections below, when the tutorial tells you to select a volume, be sure you know this means.

The same principle of Choosing a Disk applies to selecting volumes; list the volumes and select the volume number you’d like to work with.

Choosing a VolumeChoosing a Volume

Volume Reduction

Now that we have the basics out of the way let’s now get down to actually doing something useful with Diskpart! First up is Volume Reduction on a disk.

Volume Reduction turns unused space from the selected volume into unallocated space. Unallocated space is an inactive space or space that does not belong to any partition.

If you’re following along, make sure you have a drive with some free space on it, either unformatted or NTFS formatted (see Creating and Formatting a Volume). Also, make sure the partition isn’t an OEM partition, an Extensible Firmware Interface (EFI) system partition, or a recovery partition. Volume 2 (designated C) will be used in this course.

  1. Start Diskpart.

2. Choose a disk that has some free space.

3. Next, either use the list volume command to locate a volume or use the detail disk command to get disk information as well as volumes on the drive. Because it is formatted as NTFS, Volume 2 is an excellent candidate for downsizing.

Seeing the Volumes on a Selected DiskSeeing the Volumes on a Selected Disk

4. Determine the greatest amount of space that the volume may be decreased and then choose it (shrink querymax).

The sample volume for this lesson may be reduced by 14GB, as seen below.

Maximum Space for ShrinkageMaximum Space for Shrinkage

5. Next, type shrink desired=#, substituting # with the appropriate quantity in megabytes, as shown below.

10GB is equivalent to 10240 megabytes.

Because many apps may be using the disk at the same time, use the shrink command below with the minimum argument. If the intended value isn’t available, the minimum parameter serves as a backup.

minimum=8192 shrink desired=10240

Diskpart shrank the specified volume by 10GB, as seen below.

Volume ReductionVolume Reduction

6. When you decrease a volume, it becomes unallocated space. List the disks again using list disk to ensure the unallocated space. Unallocated space is beneath the Free column in the diagram below.

Unallocated Space ViewingUnallocated Space Viewing

Partitioning a Computer

Unallocated space, as previously stated, is not part of a partition. You must construct a partition from that area in order to utilize it.

To create a new volume out of unallocated space, follow these steps:

  1. Start Diskpart.

2. Use list disk to check which drives have unallocated space that you can use to create a new volume and then choose that disk.

Disk 0 now has 10GB of free space after decreasing the volume from the previous section, as seen below.

Choosing a Disk to Manage in the SystemChoosing a Disk to Manage in the System

3. Next, use the create partition command to create an active partition on the specified disk. The example below will create a 10GB partition.

create main partition size=10240

Using Unallocated Space to Create PartitionUsing Unallocated Space to Create Partition

If you want to install an operating system on your freshly formed partition, use the active argument to make it bootable.

Formatting a Partition/Creating a Volume

Once you’ve created a partition, you’ll need to format it to create a volume so you can start utilizing the storage.

Diskpart automatically puts focus on the newly generated partition when you create a partition using it. Run the list partition command to see this. Take a look at the sample below. The asterisk (*) next to the partition number indicates that Partition 4 is now chosen.

Viewing the Partitions ListViewing the Partitions List

1. To build a volume using Diskpart, use the filesystems command to see which file systems the partition supports. The presently chosen partition (Partition 4 in this example) supports NTFS, FAT32, and REFS, as seen below.

A file system controls how files are named, saved, and retrieved from storage, allowing you to distinguish between them.

Viewing File Systems That Are SupportedViewing File Systems That Are Supported

2. Next, format the partition as NTFS (fs=NTFS) and name the volume (label=”Backup”). You can use whatever file system you choose as long as the disk supports it, and you may select your own label.

Diskpart takes control of the session by default until the format is finished. While the format is executing, use the nowait option to restore control to the console immediately.

label=”Backup” format fs=NTFS fast

Partition to Volume FormattingPartition to Volume Formatting

3. Use the assign command to assign the F drive letter to the volume you just created, and you’ll see your freshly formed volume with the new drive letter.

list volume assign letter=F

Choosing a Drive LetterChoosing a Drive Letter

Volume Expansion

If you have some unallocated space on a drive next to a volume and are running out of space on a volume, you can extend that volume with Diskpart. Volume Expansion is the opposite of Volume Reduction.

To make a volume bigger:

  1. Start Diskpart.

2. Utilize list disk to find the disk with the volume you want to enlarge and determine if any of the other disks in the system have enough unallocated space to use.

If you don’t have enough unallocated space to expand, skip this stage and clean up your drive to free up some space.

Related: [Step-by-Step] 9 Ways to Clean Up Windows 10

After that, choose the disk that has unallocated space adjacent to it. Disk 0 will be used in this lesson.

Choosing a Disk to Manage in the SystemChoosing a Disk to Manage in the System

3. Run detail disk to list all volumes with list volume to find the volume to enlarge. Volume 2 will be used in the lesson, as seen below.

Viewing Specific Disk InformationViewing Specific Disk Information

4. Select the volume to expand and use the extend command to extend it. Volume 2 will be increased to 10GB in the example below.

If the extension is successful, you’ll have 10GB more space on the disk!

Choosing the Volume to ExtendChoosing the Volume to Extend

Delete a Volume and Partition

If your computer has numerous volumes or partitions, you may “convert” them to unallocated space by removing them. You’re out of luck if you’re seeking to clear up space on a single-volume disk.

Related: [Step-by-Step] Nine Ways to Clean Up Windows 10

To be secure, make sure all data on the disk you’re removing is backed up.

In Diskpart, deleting a volume or partition is largely comparable to the technique you’ve learned in these sections.

1. Select the disk that contains the partition or volume you want to erase using select.

2. Make a list of the partitions or volumes.

a list of partitions and volumes

3. Choose a partition or disk to work with.

# partitions to pick # partitions to list #

4. Using remove to destroy the partition or drive

remove partition delete volume

A volume was successfully deleted.A volume was successfully deleted.

Partition was successfully deleted.Partition was successfully deleted.

Cleaning a Complete Disk

Use Diskpart to transform a drive into unallocated using the clean command if you have a disk with nothing useful saved on it and want to go nuclear.

Cleaning a disk deletes everything on that disk and cannot be reversed. If the drive is inaccessible but contains vital data, use Windows File Recovery Tool to retrieve the contents after cleaning the disk.

To clean an entire disk, just pick the disk to be cleaned and run clean.

Entire Disk was successfully cleanedEntire Disk was successfully cleaned

If you intend to create another partition from a cleaned disk, run the create partition primary command without the size parameter (See Formatting a Partition/Creating a Volume).

Conclusion

You’ve learned how to use Diskpart to create partitions, expand, remove, and shrink volumes, as well as clean a whole disk in this article. Diskpart comes in helpful for managing partitions and volumes on hard drives.

Would you use Diskpart to manage partitions on your drives again as you did today?

The “diskpart commands” is a command-line tool that allows users to partition and erase Windows volumes. The “diskpart commands” uses the DiskPart utility, which can be found in the Microsoft Windows operating system.

Related Tags

  • diskpart delete partition force protected
  • diskpart clean all
  • diskpart extend volume
  • diskpart quick format
  • diskpart delete all partitions

Table of Content