Sometimes the disk on your Windows 10 system may not work correctly, or the Windows fails to start because of the hard disk error. To rectify such disk errors, Windows 10 comes with an excellent tool known as DiskPart.
The DiskPart is a powerful command tool that lets you manage the Windows disks and partitions using Command Prompt or Windows PowerShell. This command interpreter allows you to delete, create, and modify partitions on any drives your PC can detect, even the external hard drives and USB storage. It is quite useful when any Pendrive or hard disks get corrupted because of logical errors and stopped working. Using DiskPart commands, you can wipe out the data and start clean.
To fix various Windows 10/11 problems, we recommend Outbyte PC Repair:
This software will repair common computer errors, protect you from file loss, malware damage, hardware failure, and optimise your computer for peak performance. In three simple steps, you can resolve PC issues and remove virus damage:
- Download Outbyte PC Repair Software
- Click Start Scan to detect Windows 10/11 issues that may be causing PC issues.
- Click Repair All to fix issues with your computer's security and performance.
This month, Outbyte has been downloaded by 23,167 readers.
DiskPart is not a new concept. It has been the part of the Windows even before Windows 10. It is the best alternative when other disk utility such as Disk Management Tool fails to work.
In this guide, we would learn to use the common DiskPart commands to fix ‘Drive not Working’ and other disk errors.
How to open DiskPart on Windows 10?
Launching the DiskPart is not a big task. You just require to open the command terminals, either the Command Prompt or Windows PowerShell with the administrative rights.
In this guide, we would use the Command Prompt to run the DiskPart commands. The same commands can be directly used in Windows PowerShell without any changes.
Search Command Prompt in the Windows search bar and launch it with admin rights.
In the command window, type diskpart and hit enter. The DISKPART tool would be open and ready to use.
If you want to glance on the full list of available commands of DiskPart type help in the command window and press the enter key.
After using it, type Exit and hit the enter key to exit the tool.
Common DiskPart Commands
We would now explore the common DiskPart Command Prompt commands that you will mostly require.
Command | Description |
ACTIVE | Mark the selected partition as active. |
ADD | Add a mirror to a simple volume. |
ASSIGN | Assign a drive letter or mount point to the selected volume. |
ATTRIBUTES | Manipulate volume or disk attributes. |
ATTACH | Attaches a virtual disk file. |
AUTOMOUNT | Enable and disable automatic mounting of basic volumes. |
BREAK | Break a mirror set. |
CLEAN | Clear the configuration information, or all information, off the disk. |
COMPACT | Attempts to reduce the physical size of the file. |
CONVERT | Convert between different disk formats. |
CREATE | Create a volume, partition, or virtual disk. (No virtual disk management in Windows XP.) |
DELETE | Delete an object. |
DETAIL | Provide details about an object. |
DETACH | Detaches a virtual disk file. |
EXIT | Exit DiskPart. |
EXTEND | Extend a volume. |
EXPAND | Expands the maximum size available on a virtual disk |
FILESYSTEMS | Display current and supported file systems on the volume. |
FORMAT | Format the volume or partition. |
GPT | Assign attributes to the selected GPT partition. |
HELP | Display a list of commands. |
IMPORT | Import a disk group. |
INACTIVE | Mark the selected partition as inactive. |
LIST | Display a list of objects. |
MERGE | Merges a child disk with its parents. |
ONLINE | Online an object that is currently marked as offline. |
OFFLINE | Offline an object that is currently marked as online. |
RECOVER | Refreshes the state of all disks in the selected pack. Attempts recovery on disks in the invalid pack, and resynchronizes mirrored volumes and RAID5 volumes that have stale plex or parity data |
REM | Does nothing. This is used to comment scripts. |
REMOVE | Remove a drive letter or mount point assignment. |
REPAIR | Repair a RAID-5 volume with a failed member. |
RESCAN | Rescan the computer looking for disks and volumes. |
RETAIN | Place a retained partition under a simple volume. |
SAN | Display or set the SAN policy for the currently booted OS. |
SELECT | Shift the focus to an object. |
SETID | Change the partition type. |
SHRINK | Reduce the size of the selected volume. |
UNIQUEID | Displays or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature of a disk. |
Listing Existing Hard Drives, Volumes & Partitions using DiskPart
Before applying any destructive commands, you can first check the current internal and external hard disks and USB storage layout.
To check the available disks:
- Open the DiskPart and after “DISKPART>” prompt type list disk and hit enter. This command will list all the available and detectable storage disks, including internal and external drives and USB storage.
- To apply the DiskPart commands on the disks, you need to remember the disk number. For example, the windows disk is “Disk 0.“
To display the list of detected Volumes:
- Launch DiskPart and next to “DISKPART>” prompt type list volume.
- All volumes would be listed.
Check the list of partitions:
- To check the partition list, you must first select the hard disk with the list disk command.
- After the disk list is displayed, type select disk followed by the disk number.
- Once the disk is selected, type list partition, and hit the enter key, the selected disk’s partition list will be displayed. You can further modify the partitions using the partition number.
How to Delete Hard Drive, Volume, and Partition using DiskPart ?
If you want to delete the Volume or Partition of your system’s hard disk using Diskpart, follow these steps:
- First, select the hard drive using the select disk command, followed by the disk number.
- Now open the partition list of the chosen disk using list partition command.
- Chose the partition using select partition # command, replace # with the required partition number.
- Once the partition is selected, you can delete it using the delete partition command. The partition will be deleted.
- Similarly, you can delete the disk volume. Type list volume, check your chosen volume number, then type select volume #, replacing # with your volume number.
- Type delete volume, to delete the chosen volume.
How to Completely Wipe Out the Hard Disk using DiskPart?
If you face a problem in formatting the system hard disk, external hard drive, or the USB Pendrive, then using DiskPart, you can easily wipe them out. Obviously, you won’t be able to clean the disk on which your OS is installed.
- Similar to previous steps, on the DISKPART prompt window, type list disk.
- By typing select disk # command where # is your disk number, choose the disk that you want to format completely.
- After selecting the disk, type clean command to format it completely. Remember that it would not warn you, so make sure that you have selected the correct disk.
- After the cleanup, DiskPart would display the success message, and the disk would be ready for creating the new partitions.
How to Create and Format New Hard Drive Partitions using DiskPart?
Using the steps from the last section, you might have cleaned your hard disk. Now its time to create the new partitions and format them with Windows-friendly file systems like NTFS or FAT32.

- Open the disk list using the list disk command and select the disk using the select disk # command, where # is the disk number.
- After selecting the disk type the create partition primary command to create a partition using the entire space on that drive.
- If you want to create multiple partitions, you can assign how much space a partition could take. For that type, create partition primary size=X, where X is the size that you wish to set to the partition.
- To ensure that the new partition is listed, type list partition command.
- Use active command to activate the partition. It is required to use the partition as a bootable drive.
- To format the partition with the NTFS file system, use format FS=NTFS label=Data quick command. You can replace Data with any label you want.
- After it gets format, the DiskPart would automatically assign the letter to the partition. If it doesn’t, you can manually set it. For that type, assign letter=g, where you can replace g with any drive letter that you want.

Conclusion
These are the top used DiskPart commands that you can use to fix your hard drive problems and clean the USB drives and hard disks.
There are more commands, too, if you want to know about them, type help after launching DISKPART in the command window.
You can open DiskPart utility through Command Prompt or Windows PowerShell in Windows 10. After launching any of the command terminals, type diskpart to launch DiskPart.
DiskPart utility is specifically available for solving the disk issues on Windows 10. After launching the diskpart, type the help command to know about all the commands supported by diskpart. This post guides you on how to use the most common DiskPart commands.
Peter is an Electrical Engineer whose primary interest is tinkering with his computer. He is passionate about Windows 10 Platform and enjoys writing tips and tutorials about it.