How to use DiskPart to clean and format on Windows 10

On your Windows which you’re using from e list (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. Or Here you can click Start, type “cmd”, right click it and select “Run as Administrator“,

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

Microsoft DiskPart version 6.1.7601

Copyright 1999-2008 Microsoft Corporation.

On Computer: LeveSpace

 

What will allows you to?

  • Partition
  • Remove partitions
  • Remove formatting
  • Assign and remove drive letters and mount points
  • Convert disks from basic to dynamic
  • Create and extend volumes

1. To use the command line to format a hard drive, you need to open the command prompt first. Here you can click Start, type “cmd“, right click it and select “Run as Administrator“, or you can press “WIN+X” and select Command Prompt (Admin)to open the command prompt.

or open Run with “Window+R” and type the diskpart at Run, click OK or press Enter and Command Prompt will automatically open with diskpart loaded.

2. Type the following command and press Enter:

diskpart

 

  1. Type the following command to list all the available drives and press Enter:

list disk

4. Type the following command to list all the available partition and press Enter:

list volume

5. Use the following command to select the drive and press Enter:

select disk 0

 

6. use the following command to view list of all command.

list

DISK = Display a list of disks. For example, LIST DISK

PARTITION – Display a list of partitions on the selected disk. for example, LIST PARTITION

VOLUME – Display a list of volumes, for example. LIST VOLUME.

VDISK – Display a list virtual disk.

 

Delete Volume

To delete a volume, please Type to the following command:

  • Type  – “list volume”.
  • Type  – “select volume 1” (Partition D).
  • Type  – “delete volume”.

 

Create Partition

To create a partition, please refer to the following command:

  • Type “create partition primary size=204800”.

 

Format Partition

Type list volume command, you will find the new created partition is RAW, which means you must format partition before you can use it. To format a partition, please refer to the following command:

  • Type “format fs=ntfs label=”Windows 10″ quick”.

 

 

  • Assign Drive Letter

A partition without a drive letter will be hidden under “My Computer“. To assign a drive letter to an existing partition, please refer to the following command:

  • Type “assign letter=F”

 

 

Other Commends

  • select partition – use the select partition command to set the focus on a specific partition
  • select volume – use this command to set the focus on a specific volume
  • detail disk will deliver information about the current disk
  • detail partition will deliver information about the current partition
  • detail volume will deliver information about the current volume
  • list disk – use list disk to get summary information about the available disks on your computer
  • list partition – use this command to get information about each partition available on a specific disk
  • list volume – use list volume to get information about each volume available on the computer
  • active – use the active command to set the focus on the current partition to be active
  • assign – use assign to assign a letter or a mount point to the current active partition
  • create partition primary size=SIZE_IN_MB – use this command to create a new primary partition. The SIZE_IN_MB is the size of the partition you want to create, in MB.
  • create partition extended size=SIZE_IN_MB – use this command to create a new extended partition. The SIZE_IN_MB is the size of the partition you want to create, in MB.
  • create partition logical size=SIZE_IN_MB – use this command to create a new logical partition. The SIZE_IN_MB is the size of the partition you want to create, in MB.
  • delete partition will delete the current active partition
  • extend will extend the current volume
  • remove will remove a letter or a mount point from the current active partition
  • active – use this to set the current volume as active
  • add disk – use this command to add a mirror to the current active volume
  • break disk – use this command to break the mirror added
  • create volume stripe – use this to create a stripe set volume on a specified disk
  • create volume raid – use this command to create a Raid-5 volume on a specified disk
  • delete disk – use this command to delete a missing dynamic disk
  • delete partition – use this command to delete the current active partition
  • extend disk – use this command to extend the current volume
  • import can be used to import disks from a foreigh disk group
  • online can be used to bring a disk or a volume online that was previously offline
  • remove can be used to remove a letter or a mount point from the current active volume
  • retain is used to prepare a volume to be used as a boot or system volume
  • convert mbr will set the partition style of the current disk to MBR
  • convert gpt will set the partition style to GPT
  • convert dynamic will change a basic disk into a dynamic one
  • convert basic will convert a dynamic disk (empty disk) into a basic disk
  • exit will exit the utility
  • clean will remove the partition or volume formatting from the current disk
  • rescan can rescann the I/O buses and can discover new disks added to the computer
  • help will display the list of all available commands

Error Codes

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

  • Code 0 means that no errors occurred
  • Code 1 means that a fatal exception occurred
  • Code 2 means that the parameters you specified for a command are incorrect
  • Code 3 means that diskpart is unable to open the specified file
  • Code 4 means that diskpart (one of the services used by the utility) returned a failure
  • Code 5 means a command syntax error

 

 

 

 

 

 

 

 

 

 

 

 

 

We will be happy to hear your thoughts

Leave a reply