The command-line DISKPART utility in Windows

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

Requires Free Membership to View

  1. volume designated by the SELECT command. Use the syntax ASSIGN LETTER=<drive_letter>.

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

  3. 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).

  4. 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.

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

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

  7. 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.

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

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

  10. 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 SearchWinComputing.com and SearchSQLServer.com.

This was first published in March 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.