Diskpart and its Commands Examples

Diskpart and its Commands Examples

What is Diskpart?

Diskpart is a command line utility in Microsoft windows operating system and it is use for performing different disk related tasks like creating, formatting, deleting a partition. In this article I will show you how to perform the basic disk tasks using Diskpart. The great thing with diskpart is that you can take help typing “?” at any part of command, for example you want to know the options available with list command then you need to type the “list ?” in diskpart-command line  and it will show you all available option with list command.

How to open or run diskpart:

You can run the diskpart utility by typing the diskpart in command prompt, please note you need to open the command prompt as administrator and also keep in mind that some of diskpart commands are case sensitive for example if you use “list partition” instead of “list PARTITION” then it will not work for you.

 

Checking DISK Info using Diskpart:

You can use the list command for determining the disks information that are connected to you system.

List disk will show the storage devices attached to your system. You can select any disk using select disk command followed by disk number. After selecting a disk you can check its partition detail using command “list PARTITION”.

List volume will show all the drive attached to your system including flash drive and DVD drive.

Diskpart

Create Partition using diskpart:

First select a disk where you want to create a partition and use the command create partition primary or create partition extended for creating primary or extended partition.

Format a Disk:                                                

For formatting the selected disk by using command format quick. 

Following are the all command available commands of Diskpart, you can explore them yourself, most of them are self explanatory.

Diskpart Commands:

ACTIVE Mark the selected partition as active.
ADD Add a mirror to a simple volume
ASSIGN      Assign a drive letter or mount point to the selected volume.
ATTRIBUTES  Manipulate volume or disk attributes.
ATTACH      Attaches a virtual disk file.
AUTOMOUNT   Enable and disable automatic mounting of basic volumes.
BREAK       Break a mirror set.
CLEAN       Clear the configuration information, or all information, off the disk.
COMPACT     Attempts to reduce the physical size of the file.
CONVERT     Convert between different disk formats.
CREATE      Create a volume, partition or virtual disk.
DELETE Provide details about an object.
DETAIL      Provide details about an object.
DETACH      Detaches a virtual disk file.
EXIT        Exit DiskPart.
EXTEND  Extend a volume
EXPAND Expands the maximum size available on a virtual disk.
FILESYSTEMS Display current and supported file systems on the volume.
FORMAT      Format the volume or partition.
GPT         Assign attributes to the selected GPT partition.
HELP        Display a list of commands.
IMPORT      Import a disk group.
INACTIVE Mark the selected partition as inactive.
LIST        Display a list of objects.
MERGE       Merges a child disk with its parents.
ONLINE      Online an object that is currently marked as offline.
OFFLINE Offline an object that is currently marked as online.
RECOVER     Refreshes the state of all disks in the selected pack. Attempts recovery on disks in the invalid pack, and resynchronizes mirrored volumes and RAID5 volumes that have stale plex or parity data.
REM         Does nothing. This is used to comment scripts.
REMOVE      Remove a drive letter or mount point assignment.
REPAIR      Repair a RAID-5 volume with a failed member.
RESCAN      Rescan the computer looking for disks and volumes.
REPAIR      Repair a RAID-5 volume with a failed member.
SAN Display or set the SAN policy for the currently booted OS.
SELECT      Use to select an object or Shift the focus to an object.
SETID       Shift the focus to an object.
SHRINK      Reduce the size of the selected volume.
Waqas Azam
Me Waqas Azam and I am a professional blogger & freelance writer. I also working in the IT industry for over 7 years. I am graduated in Computer Science and information technology.