Diskpart

{{Short description|Command line program}}

{{lowercase|title=diskpart}}

{{Infobox software

| name = diskpart

| screenshot = Windows 10 Diskpart.png

| screenshot_size = 300px

| caption = Screenshot of diskpart in Windows 10

| developer = Microsoft, Lee Schroeder

| released = {{Start date and age|2000|02|17}}

| latest release version =

| latest release date =

| replaces = fdisk

| operating system = Windows, ReactOS

| platform = Cross-platform

| genre = Command

| license = Windows: Proprietary commercial software

ReactOS: GPLv2

| website = {{URL|https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/diskpart}}

}}

File:Create partition primary.jpg diskpart command]]

File:ReactOS-0.4.13 diskpart command 667x434.png diskpart command]]

In computing, diskpart is a command-line disk partitioning utility included in Windows 2000 and later Microsoft operating systems, replacing its predecessor, fdisk.{{cite web|title=DiskPart|url=https://technet.microsoft.com/en-us/library/bb490893.aspx|work=Windows XP Command-line reference A-Z|publisher=Microsoft|access-date=3 April 2015}}{{cite web |url=http://support.microsoft.com/kb/325590 |title=How to extend a data volume in Windows Server 2003, in Windows XP, in Windows 2000, and in Windows Server 2008 |publisher=Microsoft |work=Support |date=11 September 2011}} The command is also available in ReactOS.{{Cite web|url=https://github.com/reactos/reactos/tree/master/base/system/diskpart|title = Reactos/Reactos|website = GitHub}}

Overview

The diskpart utility is used for partitioning internal hard drives but can also format removable media such as flash drives.{{cite web|title=DiskPart Commands|url=https://technet.microsoft.com/en-us/library/cc770877%28WS.10%29.aspx|work=Windows Server 2008 R2 and Windows Server 2008 Command-Line Reference|publisher=Microsoft|access-date=3 April 2015}}

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{{Huh?|date=August 2023}} Windows 10.{{cn|date=June 2020}}

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:'.{{cite book |first1=Pawan K. |last1=Bhardwaj |first2=Kimon |last2=Andreou |first3=Brian |last3=Barber |first4=Dave |last4=Kleiman |author-link4=Dave Kleiman |first5=Mahesh |last5=Satyanarayana |title=How to cheat at Windows System Administration using command line scripts |date=2006 |publisher=Syngress |location=Rockland, MA |isbn=1-59749-105-5 |url-access=registration |url=https://archive.org/details/isbn_9781597491051 }}

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.{{Cite web|url=https://github.com/reactos/reactos/blob/master/base/system/diskpart/diskpart.c|title=Reactos/Reactos|website=GitHub|date=3 January 2022}}

Recovery Console

{{Main|Recovery 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.{{cite web |url=http://support.microsoft.com/kb/314058 |title=Description of the Windows XP Recovery Console for advanced users |publisher=Microsoft |work=Support |date=11 July 2013}}{{Cite web|title=Partition Diskpart - Create, Extend or Delete a Disk Partition|url=https://readus247.com/partition-diskpart/|access-date=2021-02-28|language=en-US}}

See also

References

{{Reflist}}

Further reading

  • {{Cite book|first=Æleen|last=Frisch|year=2001|title=Windows 2000 Commands Pocket Reference|publisher=O'Reilly|isbn=978-0-596-00148-3}}
  • {{Cite book|author=John Paul Mueller|year=2007|title=Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000|publisher=John Wiley & Sons|isbn=978-0470165799}}