Manage Learn to apply best practices and optimize your operations.

The command-line DISKPART utility in Windows

Some of the do's and don't of the DISKPART utiltiy and a list of the commands used by the utility.

Diskpart is a command-line utility for manipulating disk partitions in Windows 2000, Windows XP Home and Professional and Windows Server 2003. It is included by default in Server 2003 and all versions of XP, and is available as part of the Windows 2000 Resource Kit. It is not available for Windows 95, 98 or Me.

Aside from the user typing in commands, Diskpart can be scripted to perform multiple commands via a text file script, making it possible for an admin to automate creating complex partition arrangements not possible through unattended setup files. (Script files are simply lists of commands separated by line breaks, and are used by issuing the command Diskpart /S <script_name>.)

Diskpart should not be used to modify dynamic disks except to down-convert a dynamic disk to a basic disk. Doing anything else can destroy the partition table of a dynamic disk. You can also use DISKPART to convert a basic disk to a dynamic disk, but if you do so, that should be the last command issued through Diskpart for a particular disk.

Some of the most common commands that Diskpart uses includes:

  1. ACTIVE: Activates the current basic partition.

  2. ADD/BREAK: Creates or breaks a mirror for a selected volume.

  3. ASSIGN/REMOVE: Assigns or removes a drive letter or mount point to a volume designated by the SELECT command. Use the syntax ASSIGN LETTER=<drive_letter>.

  4. CLEAN: Removes all configuration information from the SELECTed disk. This is useful for removing boot sector metadata.

  5. CONVERT: Converts a SELECTed disk. Valid choices include BASIC, DYNAMIC (to convert dynamic disks to basic and vice versa), GPT and MBR (to convert GUID partition table disks to master boot record partition table disks).

  6. CREATE/DELETE: Creates a new partition or volume, or deletes a SELECTed partition or volume. Deleting an entire disk requires that the drive first be unmounted with REMOVE.

  7. DETAIL DISK | PARTITION | VOLUME: -- Returns detailed information about the SELECTed disk, partition or volume.

  8. EXTEND -- Extends a volume to fill available (unpartitioned) space on a drive.

  9. LIST DISK | PARTITION | VOLUME: -- Lists the disks, partitions, or volumes available on the current system. LIST DISK or LIST PARTITION requires that a disk or partition be selected with the SELECT command.

  10. ONLINE: Set online any SELECTed disk or volume that is currently marked as offline.

  11. RESCAN: Search the computer for newly-installed disks and volumes.

  12. SELECT DISK | PARTITION | VOLUME: Changes the context of the program to work with a specific disk, partition or volume. Disks are selected by number starting with 0, so SELECT DISK 1 would select the second enumerated hard drive in a system. Partitions are selected on the currently-selected disk by number as well, starting with 1. Volumes are selected independent of disk or partition and start at 0.

- Introduction
- Diskpart: A command-line for manipulating disk partitions in Windows
- Diskpart utility scans for newly added disks
- Diskpart: Create, extend or delete a partition

About the Author:
Serdar Yegulalp is editor of the Windows Insight, (formerly the Windows Power Users Newsletter), a blog site devoted to hints, tips, tricks and news for users and administrators of Windows NT, Windows 2000, Windows XP, Windows Server 2003 and Vista. He has more than 12 years of Windows experience under his belt, and contributes regularly to and

Dig Deeper on Windows administration tools