How to Use DiskPart to Troubleshoot and Create Partitions

DiskPart is a built-in Windows utility that allows you to create, delete, and manage disk partitions.
However, this tool is not very easy to use. Many users have reported that they are not sure how to use diskpart on Windows.
Here is how one user explained his problem on Microsoft Answers:
> I am trying to install Windows 7 from a flash drive. I got an error while > formatting the flash drive, and now the flash drive is inaccessible. I want > to delete the existing partition (FAT32) and create a partition of NTFS. I > am still getting an error while partitioning the flash drive, even after > trying the command prompt.
Hence, in this guide, we will explore how to use diskpart in Windows.

  • DiskPart is a command-line tool that allows you to create partitions and perform other tasks with your hard disks.
  • The tool is no longer included in Windows, but you can install its drivers and follow steps below.

Check if DiskPart.exe file is in PATH

  1. Press the Windows key + R hotkey, enter cmd in the text field, and right-click on Command prompt from the results.
  2. Select the Run as administrator option.
  3. Enter the following line in the Command prompt window, then press Enter: diskpart
  4. Next, enter the following command and press Enter: list disk
    Next, enter the following command and press Enter: list disk
  5. Now, enter sel disk X where X represents the disk number.
  6. Now, enter the following line and press Enter: select disk X
    Now, enter the following line and press Enter: select disk X
  7. Next, enter the following line and press Enter: create partition primary
  8. Enter 3 for the size in megabytes, then press Enter.
  9. Enter 1, then press Enter.
  10. Now, enter s and press Enter.
    Now, enter s and press Enter.
  11. Enter Y and press Enter.
  12. Enter Y and press Enter.

Make sure DiskPart.exe file exists

  1. If the DiskPart.exe file doesn’t exist, download the standalone version from the Microsoft site.
  2. Launch DiskPart
    Launch DiskPart
  3. Enter the disk number as 1
  4. Execute the CreatePartitions command

Check the DiskPart installation path

  1. Open Command prompt (Admin)
  2. Type DISKPART in the prompt and press Enter
  3. Type clean and press Enter
    Type clean and press Enter
  4. Type list and press Enter
  5. Type select disk and press Enter
  6. Type active and press Enter
  7. Type partition and press Enter
  8. Type create and press Enter
  9. Type “Y” and hit Enter
    Type "Y" and hit Enter
  10. Type “G” and press Enter
    Type "G" and press Enter
  11. Type “F” and press Enter
  12. Type “1” and press Enter
  13. Type “2” and press Enter
  14. Type “3” and press Enter
    Type "3" and press Enter
  15. Type “4” and press Enter
  16. Type “5” and press Enter
  17. Type “6” and press Enter
  18. Type “7” and press Enter
    Type "7" and press Enter
  19. Type “8” and press Enter
  20. Type “9” and press Enter
  21. Type “0” and press Enter
  22. Type “3” and press Enter
    Type "3" and press Enter
  23. Type “4” and press Enter
  24. Type “5” and press Enter
  25. Type “6” and press Enter
  26. Type “7” and press Enter
    Type "7" and press Enter
  27. Type “8” and press Enter
  28. Type “9” and press Enter
  29. Type “0” and press Enter
  30. Type “Y” and press Enter
    Type "Y" and press Enter
  31. Type “exit and press Enter
  32. Restart your computer

Run the DiskPart program

  1. Right-click the Start button and select Command prompt (Admin).
  2. Enter the following command and press Enter: diskpart
    Enter the following command and press Enter: diskpart
  3. Now, enter the following command and press Enter: list disk
  4. Once the list disk command is completed, you need to enter the select disk command.
  5. Now, enter the following command and press Enter: delete partition 1
  6. Finally, enter the following command and press Enter: create partition primary
    Finally, enter the following command and press Enter: create partition primary
Scroll to Top