What is Diskpart Utility and How to Use it?
Diskpart is a command line utility tool for managing disks, partitions, and volume. It was first introduced by Microsoft with Windows 2000 on 17th Feb, 2000. Diskpart supports administrative tasks when it comes to managing the disk partitions, creating partitions, managing partitions of USB flash drives etc. To use the diskpart utility you first need to start the diskpart interpreter. After that you have to list the disks and choose or focus the disk which you need to manage. Once chosen, you can type the diskpart commands which you want to execute.
The ‘fdisk’ is the predecessor of the diskpart utility tool. Disk Management is another similar tool for disk management but is available in GUI. Diskpart utility tool on the other hand is command line utility and is more enhanced. It has more control over disk management process. One important point is that diskpart supports scripting therefore any disk related tasks can be automated using scripts.
Diskpart utility is also very helpful in fixing issues related to USB flash drives or SD cards. Device is corrupt or cannot be opened etc are the common errors while using plug n play storage devices. You might have tried troubleshooting or formatting in windows but might not been able to solve the problem. To use diskpart to fix your flash drive it is important that the computer should be able to detect the device.
Initializing Windows Diskpart Utility Tool
In order to use diskpart utility, you need to open command prompt. Once you get the command prompt window then type diskpart and press enter. The diskpart command initiates the diskpart interpreter and new command line window will appear with DISKPART> prompt. To check the list of commands in diskpart command utility just type help and press enter.
Note: In case diskpart command doesn’t work on your computer then open command prompt as an administrator and try again.
The newer versions of windows now use Windows PowerShell over command prompt as it supports more administrative tasks. Therefore you can also use Windows PowerShell instead of command prompt to access diskpart utility.
To check what objects you can manage via diskpart utility, type list and press enter.
We will use the list command as below to list the disk attached. This command will represent the data in the below format.
Understanding diskpart list disk output
Disk – List of disks available starting from Disk 0.
Status – Status of the disk whether it is online or offline.
Size – Size of the disks attached.
Free – This column indicate the total un-partitioned space on your physical drive not the free space.
Dyn – ‘*‘ reflects the disk is dynamic if it’s blank its basic .
Gpt – The ‘‘” symbol indicate that the disk is of GPT partitioning style.
Disk 0 in the above image represent that there is only one hard drive. If your computer has more drives connected then you may find more disks like Disk 1, Disk 2 etc in every next row. To manage the disk you need to select the disk you want to manage. Let’s say you want to manage Disk 0 then you need to type in select disk 0. If more disks attached you can type the command ‘select disk’ followed by the disk number mentioned in Disk ### column.
Similarly you can list the volumes, partitions and virtual disks. The common step to proceed with the disk management using diskpart utility is:
- First, you have to initialize diskpart utility via command prompt.
- Use the ‘list’ command to list the disks, volumes or virtual disks.
- Select the Disk, Volume, or Virtual Disk you want to manage.
You have to perform above mentioned common steps to manage for managing the disk or volumes. Without selecting the disk or volume the related command will not work. Even if you go ahead and try to enter the related commands, it will ask you to first select the disk or volume.
Clean or Wipe Data of Hard Drive or USB Flash Drive using Diskpart Utility
Let’s say you want to clean the hard drive or the USB flash drive. Then use the above 3 steps and then type the command ‘clean’ after the DISKPART> prompt and enter. Clean command will wipe the data from the selected disk or USB flash drive. You need to be sure about the disk you are choosing to wipe because there will be no prompted for the confirmation before deleting.
Deleting Disk Partition using Diskpart Utility
In order to delete the partition first you need to select the disk on which you want to perform the deletion. Then list the partition within the selected disk by typing the command ‘select partition #’. Replace # with the partition number. Then use the command ‘delete partition’ to delete the partition. Similarly you can delete the volume by selecting the volume and running delete volume command.
Extending Hard Drive Size using Diskpart
To extend the hard drive size, select the volume instead of disk. After that type the command extend size=<size in Mb>. Let’s say you want to increase the size of the volume by 500 Mb then you need to type the below command.
Once the size is mentioned, diskpart will confirm once the disk size has been increased.
Make disk offline/online using Diskpart
If you want to change the status of the disk to Ofline or Online then select the disk. After that type to command ‘offline disk’ or ‘online disk’. Next time when you will use the list command under Diskpart, you will be able to see the status of the disk.
Diskpart utility is an easy to understand utility tool but it needs to be used with caution due to explicit control. Knowledge of such utility tools come handy when you want to manage your disk with more control. We have just seen how to use access diskpart utility tool and how to use few commands in it. There are may such commands which are useful and come handy. To know more about various diskpart commands you can check the Microsoft documentation on diskpart.
What is Diskpart?
How to initialize Diskpart?
Understanding diskpart command parameter.
How to use diskpart commands for disks or volumes?
Documentation source for diskpart.
So now you know all about diskpart utility tool and what is does. Do let me know in the comment section if you are using any other utility tools apart from the 2 mentioned in this article. Also if you are a MAC or Linux users the let me know what utility tools do you use to manage or automate disk management.
For any queries or inquiries do reach out to us via Contact Us page.