No matter how you started DiskPart, the utility opens in a black window, which can be resized and customized very roughly. When the tool is launched, DISKPART> appears at the beginning of the line, it is “the command prompt”, and this is where you can type the commands. Further, we can also use CMD to format a USB drive.
- Until the DISKPART> prompt is visible, don’t type anything, DiskPart hasn’t finished the last action.
- If the display of the characters is for example too small, or if you wish to discover the options of the utility of Microsoft, click on the small icon in the upper left corner of this window, then in the menu which unfolds, on Properties.
- Explore the tabs to find the option that’s right for you. For example the font and its size.
- If you change the color to Background, you may need to restart DiskPart for the option to take effect.
How to type a command in DiskPart?
- The DiskPart command prompt has a few rules that you should be familiar with, and which also apply to the Windows command interpreter and its enhanced version PowerShell.
- When you’ve typed a command, until you’ve hit Enter , use the Left / Right arrow keys on your keyboard to move around the command line and correct a mistake.
- On a command line where words are already entered, press the Ctrl + Left or Right Arrow keys to switch from one word to another.
- Use the Up / Down arrow keys to scroll through the commands you have previously typed. This saves you from having to retype them. You can modify the command before pressing Enter .
- To view or review messages (returned by previous commands) that are no longer visible on the screen, roll the central mouse wheel, or grab and roll up the scroll bar located to the right of the DiskPart window.
- In DiskPart, the HELP command allows you to get the complete list of commands, or help with the syntax of a specific command. For example below is the syntax of the FORMAT command.
How to list disks, partitions and volumes with DiskPart?
This is important: to work on a disk or a partition or any other object, you must first list ( LIST command ) the elements to know the number of the element on which to act, then select this object to assign it the ” focus “( SELECT command ). Any DiskPart commands you type next will affect or act on the object with the focus. For example, the DETAIL command to obtain more information on the object.
Here are the four commands of the LIST command:
- LIST DISK
- LIST VDISK (to list virtual disks)
- For help, type for example HELP LIST DISK.
Below, we type list disk and DiskPart indicates with the star (*) to the left of the number that Disk 0, which corresponds to our disk C, has the focus. When starting DiskPart, no disk has the focus, you must specify one with the SELECT command.
The stated size of drives is always smaller than the one mentioned by the manufacturer (above 238 GB for a 256 GB SSD), with a small part of the space devoted to disk management. And in the Free column, a value of 0 does not indicate that the disk is full, but that all the space is occupied by the existing partitions. Above, No media (disks 2 to 5) means that no storage medium is plugged into the USB sockets.
Partitions of a Disk
To list the partitions of a disk, you must first select the disk with the SELECT command. Here is an example of commands that list the two partitions of a C drive that has Windows installed; the Recovery partition is not visible in Windows File Explorer, it can be used to repair Windows in the event of a problem:
- LIST DISK
- SELECT DISK 0
- LIST PARTITION
LIST VOLUME allows you to list the volumes, in other words, the drives (C, D, E…) connected to the computer.
The LIST VOLUME command does not indicate which disk the volume belongs to, you have to select a volume and then ask for its details:
- SELECT VOLUME 1
- DETAIL VOLUME
The DETAIL command is accompanied by a parameter:
- DETAIL DISK
How to erase a disk with DiskPart?
Be careful, don’t forget to select the correct disk number, not all DiskPart commands require confirmation! The DETAIL DISK command allows you to check which disk is selected.
Use the CLEAN command to clear configuration information or all data ( CLEAN ALL ) from a disk.
Here is an example:
- LIST DISK
- SELECT DISK 6
- DETAIL DISK
If you type CLEAN ALL instead of CLEAN, the operation is longer (and definitive) because all bytes on the disk are reset to zero to prevent data recovery.