Diskpart is a powerful Windows CMD command that can be used to manage drives, create a partition on your disk drive(SD card, Pen drive, hard drive, SSD, etc). To format the disk drive, you can use the Windows Disk Management user interface tool, or you can directly go to the My Computer and right-click on the disk drive and select the Format. But these two methods will fail if your Disk drive is corrupted. So the only method is left to fix your corrupted disk drive is the Windows Diskpart Format command-line tool.
Windows Diskpart command-line tool can fix the corrupted disk drive by partitioning it again. So if your disk drive is not responding when you connect it to your computer then you can fix it by doing repartition/format using the Diskpart Windows command-line tool.
In this tutorial, I am going to fix my corrupted pen drive by using the
DISKPART format command-line tool. So I have created a bootable pen drive for installing the Linux operating system on my PC. But after installing the Linux OS on my PC, when I connectthe same pen drive to my computer, the size of memory is reduced to 2MB. Now the only to fix this is to partition or format the pen drive using Diskpart to restore its space. There are many other situations as well where the Diskpart format command will solve your issue with your pen drive, memory card, SSD, and even with your hard drive as well.
How to format disk partition with DiskPart
Follow the below steps to fix your corrupted disk drive with the help of the Diskpart Command-line tool.
Disclaimer: This process will erase all your data and impossible to undo the changes. So please backup of your all data before going to format your disk drive using the Diskpart command line partition tool. Disconnect other external devices if possible to reduce the risk of formating the wrong disk drive. And be very careful about selecting the disk drive to format in CMD.
The Firstly step is to connect your corrupted disk drive(Pen drive, Memory card, Hard drive) to the computer through USB cable. Your disk drive may or may not be shown on
MY COMPUTER. For this article, I am using an 8GB memory card which reduces to 2MB while creating a bootable drive.
Run the next command for selecting the disk drive.
select disk x
Here x is a disk drive number. Just replace the x by disk number that you want to partition. Please be careful about selecting the disk drive.
Now run the below commands in CMD to format your selected disk drive with the DISKPART.
create partition primary
When you type format quick and hit enter then format process is started and takes some time to partition. When the format finishes, you will see the actual size of the disk drive.
Type and run the below command to exit from the DISKPART.
If you want to know more about How to use Diskpart and format disk drive with Diskpart command-line tool then watch the below video.