What is DiskPart?

HDD (Hard Disk Drive)

There’s always a chance that things can go wrong when it comes to your hard drive - no matter how careful you might be when it comes to taking care of your machine, and how routinely you can apply patches.

Thankfully, there are means by which you can limit the damage that can be done before major failures occur and before they are set to take place. Partitioning your hard drive, for example, is one such way to proof your information by separating your operating system from your software and crucial files. When the software encounters a critical error, therefore, it means your files will still be retrievable.

This is not a way to completely prevent data loss, sadly, given it’s not a full failsafe, but it’s one of the best ways you can ensure your business-critical data is ringfenced away from software that can corrupt it. This should be considered in parallel with keeping regular hard drive backups.

Partitioning actually makes the backup process easier to manage, in that the Windows operating system is separated and won’t affect your data if it needs to be reinstalled at any point. The data partition won’t be touched and can be accessed as before once the reinstallation process finishes.

As for how one can partitioning their disk, there are several options at a user's disposal, including the built-in Windows Disk Management utility. There's also the command tool DiskPart, which offers more management options in order to create sophisticated portions, for example.

What is DiskPart?

This disk partition utility works through the command line and is designed to be used with all versions of Windows and Windows Server, with the exception that it's incompatible with operating systems older than Windows XP and Windows Server 2003.

This tool allows for far more control of the disk management process, including options to clean and format USB flash drives, as well as to create partitions and assign disk drive letters.

Unlike Microsoft's Disk Management tool, DiskPart can be run without Windows starting up and offers explicit control over hard drive volumes and partitions, including surfacing hidden recovery partitions. This makes it a powerful tool and not one to be used without a degree of caution, as any formatting it does on a hard drive cannot be undone once actioned.

DiskPart's power also means it is a useful tool for fixing problems such as data corruption on USB flash drives and SD cards which a simple formatting in Windows cannot fix.

How to use DiskPart

Backing up your data is the most important first step to take into account before proceeding to use DiskPart, or for that matter, any other function that affects the core of your PC. You should only begin the procedure once you’ve established a backup of the data on your hard drive.

Users will require admin access to create a partition on the hard drive, which means you may need to recruit the help of your IT team if this proves a blocker. To begin, open the Command Prompt window either by entering ‘command prompt’ into Windows’ search bar or press the Windows key in combination with ‘X’. Click ‘diskpart’ and then press the enter key, as you wait for the tool to open in a new window so you can identify which storage drive you want to partition. Then, enter ‘list disk’ to pull up a list of drives on your machine.


Flash storage fuels IT transformation

Discover the quantified impacts of organisational flash storage use


Most machines will only have one storage drive, so all you’ll need to do is pick the first and only one that shows up. If you’re confused as to which drive you should use, and you are presented with a range, you’ll have to look into which disk is the best to pick at the risk of partitioning the wrong drive.

When you have found the disk, choose 'select disk' followed by the corresponding number to select the correct one. For example, if the correct disk is the second in the list, type in 'select disk 2' to highlight it and start the partition process.

Again, you will use commands to carry out actions. The 'Extend' command will extend a disk's partition to any unused volume left on the hard drive, while the 'Shrink' command will do the opposite. You can also use 'Clear' to remove all information from a disk, or 'Create' to make a new partition.

When creating a new partition in a drive you will need to ensure you make it active and assign a letter to it using listed commands. To get these commands you can refer to an online guide or can simply type any letter after the 'DISKPART>' line and hit enter to be served up with a selection of compatible commands.

It is worth getting familiar with the command prompts before diving into DiskPart, and the utility is best reserved for IT administrators and people familiar with in-depth hard drive formatting. For those willing to delve into the command-line interface DiskPart should prove to be a powerful hard drive management tool native to Windows.

Keumars Afifi-Sabet

Keumars Afifi-Sabet is a writer and editor that specialises in public sector, cyber security, and cloud computing. He first joined ITPro as a staff writer in April 2018 and eventually became its Features Editor. Although a regular contributor to other tech sites in the past, these days you will find Keumars on LiveScience, where he runs its Technology section.