Reference articles on history, science, culture and more
Encyclopedia

Diskpart

Command line program

Image credit is listed at the end of this article.

In computing, diskpart is a command-line disk partitioning utility included in Windows XP and later Microsoft operating systems, replacing its predecessor, fdisk. The command is also available in ReactOS.

01Overview

The diskpart utility is used for partitioning internal hard drives but can also format removable media such as flash drives.

It has long been possible, theoretically, to partition removable drives, such as flash drives or memory cards, from within Windows NT 4.0 / 2000 / XP; e.g., during system installation. In reality, however, it was not possible to create, for instance, a recovery console, for such a device. A message would appear: 'Cannot format removable disk'. Microsoft noticed this error and responded by disabling the functionalities of creating and viewing partitions on the device from within Windows, beginning with Vista up to Windows 10.

With diskpart, scripts are supported to facilitate such functions. For example, the code below would create a new partition:

create partition logical size=2048 assign letter=F

Specifically, the above will create a 2 GB logical partition, provided that adequate space is available, and assign it the drive letter 'F:'.

The installed disks and their associated volumes and/or partitions can be viewed using these commands:

list disk list volume list partition

The sel command will select them. The command clean will perform a "quick" disk wipe, and clean all zeroes out the entire partition/disk. The ReactOS version was developed by Lee Schroeder and is licensed under the GPLv2.

The Windows 7 diskpart command
The Windows 7 diskpart command

02Recovery Console

On the Recovery Console, which is included in all Windows 2000, Windows XP and Windows Server 2003, there is a diskpart command which is significantly different from the one included in the actual operating system. It only provides functionality for adding and deleting partitions, but not for setting an active partition.

The ReactOS diskpart command
The ReactOS diskpart command
Watch videos about DiskpartExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article Diskpart, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Images, from Wikimedia Commons:

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.

Continue exploring

Related topics

Logical Disk Manager

The Logical Disk Manager is an implementation of a logical volume manager for Microsoft Windows NT, developed by Microsoft and Veritas Software. It was introduced with the Windows 2000 operating system, and is supported in Windows XP, Windows Server 2003, Windows Vista, Windows 7, Windows 8, Windows 10 and Windows 11.

Disk Utility

Disk Utility is a system utility for performing disk and disk volume-related tasks on macOS. Features include: Create, convert, backup, compress, and encrypt logical volume images from a wide range of formats to .dmg or, for CD/DVD images, .cdr Mount, unmount and eject disk volumes Enable or disable journaling Verify a disk's integrity, and repair it if damaged (works for both Mac-compatible partitions and for FAT32 partitions with Windows installed) Erase, format, partition, and clone disks Securely delete free space or disk using a "zero out" data, a 7-pass DOD 5220-22 M standard, or a 35-pass Gutmann algorithm Add or change partition table between Apple Partition Map, GUID Partition Table, and master boot record (MBR) Restore volumes from Apple Software Restore (ASR) images Check the S.M.A.R.T. status of a hard disk Disk Utility functions may also be accessed via the command line with commands diskutil and hdiutil. The commands also can create and manage RAM disk images.

GNU Parted

GNU Parted is a free partition editor, used for creating and deleting partitions. This is useful for creating space for new operating systems, reorganising hard disk usage, copying data between hard disks, and disk imaging.