The Windows DISKPART Command Explained

DISKPART can be used to overcome the limitations of the Disk management tool. It offers several commands to manage your disks and in this article we shall discuss about the most popular ones. This article will explain all you need to know about the DISKPART Command.

The DISKPART Command

Diskpart is a command line tool which allows you to manage disks, as such some commands can only be accessed via diskpart and not by the disk management tool of Windows. The use of this tool involves a lot of caution!

DISKPART can be useful in such situations:

Access to disks that no longer appear in the disk management tool.

Convert a basic disk to a dynamic disk.

Create partitions.

The clean command allows you to delete all information stored on the disk.

Manage the partitions (create, delete, edit).

Assign, edit and delete a drive letter.

Format a partition (several options available).

The Different Ways to Use Diskpart

Script

CMD (command prompt)

Using Diskpart Via a Script

Click on Start > Run.

Type cmd and press Enter.

The command prompt shall open.

From there we will simply indicate where diskpart will find the file containing the commands.

Move to the folder containing the files using the cd command.

In our case we will use the examplet file. diskpare /s exemplet

The examplet file will contain the commands. In our example we will list the details of disk 1:

list disk

select disk 1

detail disk

Using DISKPART Via the Command Prompt

Click on Start > Run.

Type cmd and press Enter.

Once the command prompt is open

Type: DISKPART

You have now accessed the diskpart tool.

Listing the Disks

You can list the disks, partitions or volumes.

You can use both the disk management tool of Windows and the diskpart tool, by positioning both of the windows side by side.

Selecting a Specific Disk

Type the following command: select disk n

Replace n with the disk number of your choice.

Getting Info About a Disk

For more information use the detail disk command.

To get information about a specific disk, first you need to select it and the use the detail disk command.

Example using the disk 2 :

list disk

select disk 2

detail disk

Selecting a Partition

First you need to select the disk:

list disk

select disk n

Then use the below command to select the partition of your choice:

select partition n

Replace n with the partition number

To get additional information about a partition:

list partition

select partition n

detail partition

Selecting a Volume

First you must select your disk:

list disk

select disk n

List the volumes present using the below command:

list volume

To select a specific volume:

select volume n

Where n is the the volume number

To get information about the selected volume, type:

detail volume

Additional commands

The help command

The help command will give you access to all the diskpart commands:

help

Example :

help clean

The Clean Command - Clear All Information

The CLEAN command deletes all partitions, the configuration information and all the information stored on the disk.

command deletes all partitions, the configuration information and all the information stored on the disk. The CLEAN ALL command deletes all partitions on the selected disk and permanently deletes the information stored on the disk.

Example of use (disk 1):

list disk

select disk 1

clean

The ASSIGN Command - Manage Partitions Letters

The Remove letter command:

list volume

select volume n

remove letter =N

To assign a new letter to a partition:

assign letter =N

The Format Command: Format a Partition

Format the active partition or volume.

Photo: Unsplash

Leave A Comment