Friday, June 16, 2006

What is Diskpart.exe in Microsoft Windows?

Ever ran out of disk space on a particular partition / volume with ample of free space in the server? If yes, the only options are to either backup the data, break partitions, and recreate them again with more appropriate size, or to figure out ways in which the existing partition which is running out of space can be extended. There have been non-Microsoft tools available in the market to extend the partition. A similar tool from Microsoft was much desired for uniformity of the tools by a single manufacturer.

Diskpart.exe is a tool introduced by Microsoft, to extend the data volumes in Windows 2000, Windows XP and Windows 2003.

It is a command line utility to extend the existing partitions by using the unallocated space displayed in Disk Management.

Diskpart.exe can be used to extend both Basic as well as Dynamic partitions. When extending a NTFS partition, Microsoft recommends to perform the action in Safe Mode or Active Directory Restore Mode in order to prevent the open handles to the drive from causing to fail the process.

There are some requirements for extending the partitions by using the Diskpart.exe utility with 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 example, consider F: needs to be extended and there are 3 Hard Disks on the server. F: is on the second disk and the unallocated free space is on the third disk. This does not satisfies the condition for running the Diskpart utility with the extend command. Also if the F: and the unallocated space are in the same drive, but there is another partition created in between them, does not meet the requirement.

• For Dynamic Volumes, the unallocated space can be any empty space on any Dynamic disk on the system.

• Only the extension of data volumes is supported. System or boot volumes may be blocked from being extended, and you may receive the following error:
Diskpart failed to extend the volume. Please make sure the volume is valid for extending

• 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 wish to extend.

Following are the steps to extend the partition using Diskpart:

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 take up all of 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 quit with an error code.

5. Type exit to quit Diskpart.exe.

Diskpart will notify about the successful completion of the command and the space will be added to the existing partition.

There is a special condition when extending a Simple Volume on a Dynamic Disk in Windows 2000 and Windows XP. If the volume was created originally in the Basic Disk and then the disk was upgraded to a Dynamic disk, the volume cannot be extended. However, if the disk was already Dynamic when the volume was created, then Diskpart can be run successfully. The above condition applies only to Simple Volumes and not the Striped Sets and the rest. This condition was removed from Windows 2003 and does not apply in its case.

Diskpart comes built-in with Windows 2003 and Windows XP. However, for Windows 2000, the utility needs to be downloaded from Microsoft’s web site.

Diskpart can also be used to perform other disk related tasks like adding disks to or breaking a mirror, making a particular partition active, assign drive letters to partitions, converting basic disks to dynamic and empty dynamic disks to basic and more.

0 Comments:

Post a Comment

<< Home

Free Website Counter
Free Web Counter Technology Blogs by Indian Bloggers Technology Blog Top Sites