Microsoft improved the features of Disk Management in Windows Vista, Windows 7 and Windows Server 2008, you can shrink and expand a partition in Disk Management of these Windows operating system. What about Windows XP and Windows Server 2003? In fact, you cannot do this in Disk Management, but Microsoft provides a command line – diskpart.exe, so this in this article we’ll discuss how to expand Windows Server 2003 with Diskpart command line.

What is diskpart command line?

Diskpart differs from many command-line utilities because it does not operate in a single-line mode. Instead, after you start the utility, the commands are read from standard input/output (I/O). You can direct these commands to any disk, partition, or volume.

Diskpart enables a superset of the actions that are supported by the Disk Management snap-in. The Disk Management snap-in prohibits you from inadvertently performing actions that may result in data loss. It is recommended that you use the Diskpart utility cautiously because Diskpart enables explicit control of partitions and volumes.

You can use the Diskpart.exe utility to manage disks, partitions, and volumes from a command-line interface. You can use Diskpart.exe on both Basic disks and Dynamic disks. If an NTFS volume resides on a hardware RAID 5 container that can add space to the container, you can extend the NTFS Volume with Diskpart.exe while the disk remains a Basic disk.

Basic requirements for the extend command

  • The volume must be formatted with the NTFS file system.
  • For Basic volumes, the unallocated space for the extension must be the next contiguous space on the same disk.
  • For Dynamic Volumes, the unallocated space can be any empty area on any Dynamic disk on the system.
  • Only the extension of data volumes is supported.
  • You cannot extend the partition if the system page file is located on the partition. Move the page file to a partition that you do not want to extend.

Note: To extend a partition or volume, you must first select the volume to give it the focus, and then you can specify how large to make the extension.

How to extend partition with diskpart command line?

  1. At a command prompt, type diskpart.exe.
  2. Type list volume to display the existing volumes on the computer.
  3. Type Select volume volume number where volume number is number of the volume that you want to extend.
  4. Type extend [size=n] [disk=n] [noerr]. The following describes the parameters:

size=n
The space, in megabytes (MB), to add to the current partition. If you do not specify a size, the disk is extended to use all the next contiguous unallocated space.

disk=n
The dynamic disk on which to extend the volume. Space equal to size=n is allocated on the disk. If no disk is specified, the volume is extended on the current disk.

noerr
For scripting only. When an error is thrown, this parameter specifies that Diskpart continue to process commands as if the error did not occur. Without the noerr parameter, an error causes Diskpart to exit with an error code.

  1. Type exit to exit Diskpart.exe.

When the extend command is complete, you should receive a message that states that Diskpart successfully extended the volume. The new space should be added to the existing drive while maintaining the data on the volume.

More information about diskpart you need to know

1. In Windows XP and in Windows 2000, you cannot use Diskpart.exe to extend a simple volume on a Dynamic disk that was originally created on a Basic disk. You can extend only simple volumes that were created after the disk was upgraded to Dynamic disk. If you try to extend a simple volume on a Dynamic disk that was originally created on a Basic disk, you receive the following error message. This restriction was removed in Windows Server 2003.

“Diskpart failed to extend the volume.
Please make sure the volume is valid for extending.”

2. Windows Server 2003 and Windows XP include Diskpart.exe as part of the base operating system.

3. The link to download Diskpart.exe is only for Windows 2000. For Windows Server 2003 and for Windows XP, use the Diskpart.exe tool that is built in to these operating systems.

Disadvantage of diskpart command line

This command line could work only when there is unallocated space behind the partition that you want to expand, but in fact, you do not have this unallocated space until you delete a partition. The huge disadvantage of diskpart command line is that it cannot move the unallocated space and it is inconvenient to resize partitions. Furthermore, you cannot see the operation process or cancel the incorrect operations. So you’d better try other professional partition magic software or partition manager

Some screenshots of diskpart command line

Command line detail disk
Command line detail disk
Command line detail partition
Command line detail partition
Command line detail volume
Command line detail volume
Command line list partition
Command line list partition
Command line list volume
Command line list volume

The advantage of diskpart is that it provides by Microsoft and is free, but it is not a good idea to extend partition with Diskpart, as there are many disadvantages, such as,

  • Not every Windows edition integrated Diskpart.
  • You cannot extend a partition until there is unallocated space behind this partition.
  • Hard to use.
  • Risk of losing data, no Undo features.
  • Operations cannot be previewed.

Windows Vista/7 and Server 2008 provides more features under Disk Management that older versions. You can shrink and extend partitions with the guide under Disk Management. For detailed steps, please refer how to shrink and extend partition under Server 2008 (the same with Windows Vista/7).

To better resize, extend and manage your disk partition, you’d better run third-party partition software.

For Windows XP/Vista/7 uers, please refer professional partition software.

For Windows Server 2000/2003/2008 users, please refer Server partition software.