diskpart – What is diskpart?

Diskpart is a built-in Windows utility. This is a command tool that has been used as Command Prompt to manage drives, partitions, and volumes. Where other tools like Disk Management and Format won’t work to fix the problem. Diskpart can be used to solve these problems. The diskpart command interpreter helps you manage your computer’s drives in command prompt.

Before you can use diskpart commands, you must first list, and then select an object to give command. After an task identified, any diskpart commands that you type will act on that object.

List available objects
You can list the available objects and determine an object’s number or drive letter by using:

list disk – Displays all the disks on the computer.
list volume – Displays all the volumes on the computer.
list partition – Displays the partitions on the disk that has focus on the computer.
list vdisk – Displays all the virtual disks on the computer.

Determine focus
When you select an object, the focus remains on that object until you select a different object. For example, if the focus is set on disk 0 and you select volume 8 on disk 2, the focus shifts from disk 0 to disk 2, volume 8.
Some commands automatically change the focus. For example, when you create a new partition, the focus automatically switches to the new partition.

You can only give focus to a partition on the selected disk. After a partition has focus, the related volume (if any) also has focus. After a volume has focus, the related disk and partition also have focus if the volume maps to a single specific partition. If this isn’t the case, focus on the disk and partition is lost.


To start the diskpart command interpreter, at the command prompt type:
diskpart
You must be in your local Administrators group, or a group with similar permissions, to run diskpart.

You can run the following commands from the Diskpart command interpreter:

PARAMETERSCommand Description
activeMarks the disk’s partition with focus, as active.
addMirrors the simple volume with focus to the specified disk.
assignAssigns a drive letter or mount point to the volume with focus.
attributesDisplays, sets, or clears the attributes of a disk or volume.
automountEnables or disables the automount feature.
breakBreaks the mirrored volume with focus into two simple volumes.
cleanRemoves any and all partition or volume formatting from the disk with focus.
compact vdiskReduces the physical size of a dynamically expanding virtual hard disk (VHD) file.
convertConverts file allocation table (FAT) and FAT32 volumes to the NTFS file system, leaving existing files and 
createCreates a partition on a disk, a volume on one or more disks, or a virtual hard disk (VHD).
deleteDeletes a partition or a volume.
detach vdiskStops the selected virtual hard disk (VHD) from appearing as a local hard disk drive on the host computer.
detailDisplays information about the selected disk, partition, volume, or virtual hard disk (VHD).
exitExits the diskpart command interpreter.
expand vdiskExpands a virtual hard disk (VHD) to the size that you specify.
extendExtends the volume or partition with focus, along with its file system, into free (unallocated) space on a disk.
filesystemsDisplays information about the current file system of the volume with focus and lists the file systems that are supported for formatting the volume.
formatFormats a disk to accept Windows files.
gptAssigns the gpt attribute(s) to the partition with focus on basic GUID partition table (gpt) disks.
helpDisplays a list of the available commands or detailed help information on a specified command.
importImports a foreign disk group into the disk group of the local computer.
inactiveMarks the system partition or boot partition with focus as inactive on basic master boot record (MBR) disks.
listDisplays a list of disks, of partitions in a disk, of volumes in a disk, or of virtual hard disks (VHDs).
merge vdiskMerges a differencing virtual hard disk (VHD) with its corresponding parent VHD.
offlineTakes an online disk or volume to the offline state.
onlineTakes an offline disk or volume to the online state.
recoverRefreshes the state of all disks in a disk group, attempt to recover disks in an invalid disk group, and resynchronizes mirrored volumes and RAID-5 volumes that have stale data.
remProvides a way to add comments to a script.
removeRemoves a drive letter or mount point from a volume.
repairRepairs the RAID-5 volume with focus by replacing the failed disk region with the specified dynamic disk.
rescanLocates new disks that may have been added to the computer.
retainPrepares an existing dynamic simple volume to be used as a boot or system volume.
sanDisplays or sets the storage area network (san) policy for the operating system.
selectShifts the focus to a disk, partition, volume, or virtual hard disk (VHD).
set idChanges the partition type field for the partition with focus.
shrinkReduces the size of the selected volume by the amount you specify.
uniqueidDisplays or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature for the disk with focus.



Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top