NeoSmart Knowledgebase

diskpart – Guide for Windows XP, Vista, 7, 8, 10

This guide explains how to use the diskpart utility for the following Windows versions: Windows XP, Vista, 7, 8, 8.1 or 10.

What is diskpart

The diskpart utility (available in Windows 2000, XP, Vista, 7, 8, 8.1 and 10) can be used to create or delete partitions on your PC.

Command Prompt: list disk

The utility allows you to:

Most commands that you can perform in Disk Management (see Boot partitions) are available with diskpart. Because it’s a command line utility, you need to open Command Prompt and type diskpart.

On Windows Vista, 7, 8 and 10 systems, you can type diskpart at Run, click OK or press Enter and Command Prompt will automatically open with diskpart loaded.

When the utility is loaded, you will notice the version installed on your computer:

Microsoft DiskPart version 6.1.7600
Copyright  1999-2008 Microsoft Corporation.
On Computer: MY_COMPUTER

Commands and parameters

The diskpart tool has the following commands and parameters available:

Error Codes

You can find a list error codes to debug various errors:

diskpart in Windows XP

Note that the fdisk utility found in pre-Windows XP systems is now known as diskpart on Windows XP systems.

If you can boot into Windows XP

If you can boot into your computer, you simply need to open Command Prompt to access diskpart:

  1. Boot into Windows XP
  2. Click Start
  3. Click Run
  4. Type cmd
  5. Press Enter or click OK
  6. At the Command Prompt window, type diskpart
  7. Press Enter

If you can’t boot into Windows XP

If you can’t boot into Windows XP to access diskpart, you have 2 options:

If you have the original CD:

If you can’t boot into Windows XP, but you have the original CD, you can access the Recovery Console:

  1. Insert the Windows XP CD
  2. Reboot the computer
  3. Press any key to boot from the CD
  4. At the Microsoft Setup menu, press R
  5. Select the operating system and enter the Administrator password, if requested
  6. When Command Line appears, type diskpart
  7. Press Enter

If you use Easy Recovery Essentials:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

diskpart in Windows Vista

You need to run these steps as an Administrator on Windows Vista systems.

If you can boot into Windows Vista with no errors, follow the If you can boot into Windows Vista set of instructions. Otherwise, follow If you can’t boot into Windows Vista.

If you can boot into Windows Vista

You simply need to open Command Prompt, if you can boot into Windows Vista:

  1. Boot into Windows Vista
  2. Click Start
  3. Type cmd
  4. Click Command Prompt from the search results list. You may need to right-click Command Prompt > Run as Administrator, if you are not logged in as Administrator already
  5. Type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you can’t boot into Windows Vista

If you can’t boot into your system, you have the following options:

If you have the installation disc:

If you can’t boot into Windows Vista, but you have the Windows Vista disc, follow these steps to open diskpart:

  1. Insert the original CD/DVD in the optical drive
  2. Boot your computer
  3. Press any key to boot from the CD/DVD
  4. Select your language, time and keyboard
  5. Click Next
  6. Click Repair your computer
  7. Select the operating system
  8. Click Next
  9. When the System Recovery Options screen appears, click Command Prompt
  10. Type diskpart:
    diskpart
  11. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you don’t have the installation disc:

If your Windows Vista has the System Recovery Options installed and is available at the Advanced Boot Options menu, you can run Command Prompt from there. Otherwise, see the “If you use Easy Recovery Essentials” set of instructions below.

Follow these steps below to access diskpart without the installation disc:

    1. Reboot the computer
    2. Press F8 as your computer starts to boot, but before the Windows Vista logo appears
    3. Select Repair Your Computer, at the Advanced Boot Options menu

If a “Repair Your Computer” option isn’t listed, System Recovery Options is not installed on your computer. Use the original installation disc or go to the “If you use Easy Recovery Essentials”set of instructions below .

 

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you use Easy Recovery Essentials:

If you don’t have the installation disc available, can’t boot into Windows Vista or you don’t have the “Repair Your Computer” option listed at the Advanced Boot Options menu, you can use Easy Recovery Essentials to access Command Prompt and load diskpart.

Follow these steps:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

diskpart in Windows 7

On Windows 7 systems, you can access diskpart just as you do Windows Vista systems.

Note that you need to run these steps as an Administrator on Windows 7 computers.

If you can boot into Windows 7

If you can boot into your Windows 7 system, simply open Command Prompt:

  1. Boot into Windows 7
  2. Click Start
  3. Type cmd
  4. Click Command Prompt from the search results list. Right-click on Command Prompt > Run as Administrator.
  5. When Command Prompt loads, type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you can’t boot into Windows 7

Similar to Windows Vista, if you can’t boot into your system, you have the following options:

If you have the installation disc:

If you can’t boot into Windows 7, but you have the installation disc, you can run diskpart using the disc. To do so, follow these steps:

    1. Insert the disc in the optical drive of your computer
    2. Restart the computer
    3. Press any key to boot from the disc
    4. Select your preferred language, time and keyboard
    5. Click Next
    6. Click Repair your computer at the Install Windows screen
    7. Select the operating system from the list
    8. Click Next
    9. Select Command Prompt
    10. Type diskpart
diskpart
  1. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you don’t have the installation disc:

Usually, Windows 7 systems should have the System Recovery Options installed on the hard drive. If it’s not (follow steps below), go to the “If you use Easy Recovery Essentials” set of instructions below for an alternative to access diskpart.

Follow these steps to access diskpart without an installation disc on a Windows 7:

  1. Restart the computer
  2. Press F8 as the computer starts to boot. Press F8 before the Windows 7 logo appears.
  3. Select Repair Your Computer at the Advanced Boot Options screen

    If Repair Your Computer is not listed, System Recovery Options is not installed on your PC. Go to If you use Easy Recovery Essentials for an alternative.

  4. Press Enter
  5. Select Command Prompt
  6. Type diskpart
  7. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you use Easy Recovery Essentials:

Easy Recovery Essentials can run from any CD, DVD or USB flash drives.

To access diskpart using Easy Recovery Essentials, follow these steps:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

diskpart in Windows 8

If you can boot into Windows 8

If you can boot into your Windows 8 system, you simply need to open Command Prompt to access diskpart. To do so, follow these steps:

  1. Boot into Windows 8
  2. Press the Windows key and C to open the charm bar
  3. Type cmd
  4. Click Command Prompt
  5. When Command Prompt opens, type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you can’t boot into Windows 8

If you can’t boot into your Windows 8, you have these options available:

If you have the installation disc:

If you can’t boot, but you have the installation disc, follow these steps:

  1. Insert the Windows 8 DVD or 8.1 USB
  2. Restart the computer
  3. Press any key to boot from the media
  4. Click Repair your computer or press R
  5. Select Troubleshoot
  6. Select Command Prompt
  7. Type diskpart
  8. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you don’t have the installation disc:

If you don’t have the installation disc, you can boot into System Recovery Options or use Easy Recovery Essentials.

To access diskpart without an official Windows 8 or Windows 8.1 disc, follow these steps:

  1. Reboot the system
  2. Press Shift and F8 very quickly
  3. At Choose an option, select Troubleshoot
  4. Select Command Prompt
  5. Type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you use Easy Recovery Essentials:

Easy Recovery Essentials can run from any CD, DVD or USB flash drives.

To access diskpart using Easy Recovery Essentials, follow these steps:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

diskpart in Windows 10

If you can boot into Windows 10

If you can boot into your Windows 10 system, you simply need to open Command Prompt to access diskpart. To do so, follow these steps:

  1. Boot into Windows 10
  2. Press the Windows key and C to open the charm bar
  3. Type cmd
  4. Click Command Prompt
  5. When Command Prompt opens, type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you can’t boot into Windows 10

If you can’t boot into your Windows 10, you have these options available:

If you have the installation disc:

If you can’t boot, but you have the installation disc, follow these steps:

  1. Insert the Windows 10 or USB
  2. Restart the computer
  3. Press any key to boot from the media
  4. Click Repair your computer or press R
  5. Select Troubleshoot
  6. Select Command Prompt
  7. Type diskpart
  8. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you don’t have the installation disc:

If you don’t have the installation disc, you can boot into System Recovery Options or use Easy Recovery Essentials.

To access diskpart without an official Windows 10 media, follow these steps:

  1. Reboot the system
  2. Press Shift and F8 very quickly
  3. At Choose an option, select Troubleshoot
  4. Select Command Prompt
  5. Type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you use Easy Recovery Essentials:

Easy Recovery Essentials can run from any CD, DVD or USB flash drives.

To access diskpart using Easy Recovery Essentials, follow these steps:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

Troubleshooting

Download diskpart

You can not download diskpart utility. This utility is a command line utility part of Windows.

To access diskpart, you have the following options:

Instructions on how to access diskpart if you use Easy Recovery Essentials:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

Instructions on how to access diskpart if you have the installation disc:

Instructions on how to access diskpart if you don’t have the installation disc:

Format USB with diskpart

To format a USB flash drive with diskpart, follow these steps:

  1. Open the utility by typing diskpart in Command Prompt
  2. Press Enter
  3. Once loaded, type list disk:
    list disk
  4. Press Enter
  5. Determine which of the disks listed is your USB flash drive, e.g. Disk 2.
  6. Type select disk 2, if #2 is the USB flash drive presented by the list disk command
  7. Press Enter
  8. Type clean to clean the USB flash drive:
    clean
  9. Press Enter
  10. Type this command:
    create partition primary
  11. Press Enter
  12. Type active:
    active
  13. Press Enter
  14. You should now receive this confirmation message:
    DiskPart marked the current partition as active.
  15. Type this command to format the USB flash drive:
    format fs=ntfs label="MY USB DRIVE"

    where ntfs is the NTFS file system (you can also use fs=fat32) and “MY USB DRIVE” is the label given to the USB drive.

  16. Type assign:
    assign
  17. Press Enter
  18. Quit diskpart by typing exit:
    exit
  19. Press Enter

Bootable USB with diskpart

To create a bootable USB using diskpart, follow the steps from Format USB with diskpart.

Once successfully formatted the drive, simply copy the files to the USB drive.

USB not showing in diskpart

diskpart will not list external media, e.g. USB flash drive, if you’re using Windows XP.

Windows Vista to Windows 8 systems will show the USB flash drives in diskpart.

More Information

Support Links

Applicable Systems

This Windows-related knowledgebase article applies to the following operating systems:

Propose an edit