The Disk Management Tool is a useful, effective tool for managing your Windows disks and partitions, but it isn’t as powerful to use as Diskpart. This command-line tool lets you delete, create and modify partitions on any hard drives or USB storage your PC can detect.

We’d recommend using the Disk Management Tool for most situations, but if Windows isn’t starting up properly, or if you prefer to use the PowerShell terminal, Diskpart is the perfect alternative. Here are some of the more common Diskpart commands to help you learn how to use Diskpart effectively.

Table of Contents
    How to Use DiskPart Utility in Windows image 1

    How To Use Diskpart

    If you want to use Diskpart, you need to open up a Windows command line or PowerShell terminal. Diskpart is a destructive tool, so you’ll need to open a terminal window with the right administrative privileges.

    • To open Diskpart in Windows, right-click your Windows Start menu button and click Windows PowerShell (Admin).
    How to Use DiskPart Utility in Windows image 2
    • In your admin-level PowerShell terminal (or similar Windows command line), type diskpart and hit enter.
    How to Use DiskPart Utility in Windows image 3
    • The Diskpart tool will launch within the window, ready for you to use. Type exit at the “DISKPART>” prompt and hit enter once you’ve finished using it.
    • Diskpart is also available for users booting into the Windows Recovery Environment, available when you boot your PC using the Advanced Startup mode in your Settings > Windows Update & Security > Recovery menu.
    • Click Restart Now to boot to WinRE.
    How to Use DiskPart Utility in Windows image 4

    We’ll explore some of the most common Diskpart commands in this article, but if you want to quickly see the full list of available Diskpart commands, type help at the “DISKPART>” prompt and hit enter.

    How to Use DiskPart Utility in Windows image 5

    Listing Existing Hard Drives, Volumes & Partitions

    Once Diskpart is open, the first thing you should do is check the current layout of your hard drives and attached storage.

    • At the “DISKPART>” prompt, type list disk and hit enter. This will list all of the available storage drives (including hard drives, USB storage, SD cards, etc.) that your PC can currently detect.
    How to Use DiskPart Utility in Windows image 6
    • Starting with the number zero, Diskpart will list any detected disks. You’ll need to remember the disk number (for instance, “0” for your Windows hard drive) to use with future Diskpart commands.
    • Along with your list of disks, you can also ask Diskpart for a list of detected volumes. At the “DISKPART>” prompt, type list volume.
    How to Use DiskPart Utility in Windows image 7
    • Diskpart can also let you list individual hard drive partitions (some of which may match the volumes listed with the “list volume” command). You’ll need to select a hard disk first with the list disk command.
    • At the “DISKPART>” prompt, type select disk followed by the disk number (for instance, select disk 0). Diskpart will confirm that the disk is selected at this point.
    • Once a disk is selected, type list partition. This will list the current partitions on your drive. You’ll be able to delete or modify these partitions from here, using the partition number in a later Diskpart command.
    How to Use DiskPart Utility in Windows image 8

    Deleting a Hard Drive Partition Or Volume Using Diskpart

    A hard drive (disk) is separated into partitions, which are often the same as listed volumes. If your hard drive is separated into several partitions or volumes, and you wish to delete one, you can do that using Diskpart commands.

    • Select your hard drive using select disk. 
    • At the “DISKPART>” prompt, type list partition, then select partition #, replacing # with your partition number.
    How to Use DiskPart Utility in Windows image 9
    • Once a partition is selected, type delete partition. Diskpart will confirm whether or not the partition has been deleted afterward.
    • You can also delete disk volumes directly if you’d prefer.  Type list volume, locate your chosen volume number, then type select volume #, replacing # with your volume number.
    How to Use DiskPart Utility in Windows image 10
    • Type delete volume to delete the volume completely. Diskpart will confirm if the command was successful or not afterward.

    Wiping a Hard Drive Completely Using Diskpart Clean

    Rather than removing individual volumes or partitions on a drive, you can wipe a hard drive completely using the Diskpart clean command. You can also use this command if you’re looking to wipe a USB flash drive, ready for formatting.

    You won’t be able to do this on your system drive (nor would you want to!) unless you’re using Diskpart on a Windows installation

    • At the “DISKPART>” prompt, select the disk you wish to wipe by typing select disk #, replacing # with your disk number. If you don’t know your disk number, type list disk first.
    How to Use DiskPart Utility in Windows image 11
    • If you’re sure you want to wipe the disk completely (deleting all drive volumes/partitions), then type clean and hit enter. You won’t be asked for confirmation, so be sure you wish to do this before you begin.
    How to Use DiskPart Utility in Windows image 12
    • Diskpart will confirm that the drive has been “cleaned”, ready for new partitions to be created.

    Creating & Formatting New Hard Drive Partitions 

    With a “clean” drive, you’re ready to create a partition in the free space using the Diskpart create partition command. You can then format that new partition with a Windows-friendly file system like NTFS or FAT32 using the Diskpart format command.

    • Start by selecting your chosen disk with select disk #, replacing # with your disk number (and using list disk to find your disk number, if you don’t know.)
    • With your disk selected, type create partition primary to create a partition using the entire space on that drive.
    • If you want to create a partition to take up only some of the free space (letting you create more than one partition), type create partition primary size=X instead, replacing X with the partition size, measured in megabytes (for example, size=1024 for 1GB of space).
    How to Use DiskPart Utility in Windows image 13
    • Type list partition to make sure that your new partition is listed, then type select partition 1 to select it. Mark the partition as active by typing active at the “DISKPART>” prompt. This is necessary if you want to use it as a bootable drive.
    How to Use DiskPart Utility in Windows image 14
    • To quickly format the drive with the NTFS file system, type format fs=NTFS label=Y quick. You can replace Y with any label you’d prefer to use.
    How to Use DiskPart Utility in Windows image 15
    • Once formatted, Windows will likely assign a drive letter automatically. If it doesn’t, type assign letter Z, replacing Z with a free drive letter.
    How to Use DiskPart Utility in Windows image 16

    Extend a Hard Drive Volume

    If you have an existing hard drive volume that doesn’t take up all of the free space on a drive, and you wish to enlarge it, Diskpart commands allow you to do that.

    • Start by selecting your chosen disk with select disk #, replacing # with your disk number (and using list disk to find your disk number, if you don’t know.)
    • Type list volume to list all the available volumes on your PC, then type select volume #, replacing # with the volume you’re looking to extend.
    • Type extend to expand it to the maximum size available. Diskpart will confirm whether or not the extend command has worked correctly.  Confirm the size of the volume has increased by typing list volume for a second time afterward.
    How to Use DiskPart Utility in Windows image 17

    Diskpart has other options available, as the help command briefly explains. If you need further information on how to use Diskpart, Microsoft has further Diskpart support information available.

    Leave a Reply

    Your email address will not be published. Required fields are marked *