diskpart command to add,delete,extend partitions

The diskpart command is a Recovery Console command used to create or delete partitions on hard drives.

You can use Diskpart to convert a basic disk to a dynamic disk. The basic disk can either be empty or contain either primary partitions or logical drives. The basic disk can be a data disk or system or boot drive. The basic disk cannot have fault-tolerant disk driver (FtDisk) sets such as stripes or mirrors.

You can use Diskpart to convert a dynamic disk to a basic disk. You must delete any dynamic volumes before the conversion process. It is recommended that you delete all volumes on the drive, and then convert the disk to basic. You must delete all dynamic data partitions. Also, never mix the basic primary and dynamic partitions on the same drive.

DISKPART> help

Microsoft DiskPart version 5.1.3565

ADD         – Add a mirror to a simple volume.
ACTIVE      – Marks the current basic partition as an active boot partition.
ASSIGN      – Assign a drive letter or mount point to the selected volume.
BREAK       – Break a mirror set.
CLEAN       – Clear the configuration information, or all information, off the
disk.
CONVERT     – Converts between different disk formats.
CREATE      – Create a volume or partition.
DELETE      – Delete an object.
DETAIL      – Provide details about an object.
EXIT        – Exit DiskPart
EXTEND      – Extend a volume.
HELP        – Prints a list of commands.
IMPORT      – Imports a disk group.
LIST        – Prints out a list of objects.
INACTIVE    – Marks the current basic partition as an inactive partition.
ONLINE      – Online a disk that is currently marked as offline.
REM         – Does nothing. Used to comment scripts.
REMOVE      – Remove a drive letter or mount point assignment.
REPAIR      – Repair a RAID-5 volume.
RESCAN      – Rescan the computer looking for disks and volumes.
RETAIN      – Place a retainer partition under a simple volume.
SELECT      – Move the focus to an object.

DISKPART> list disk

Disk ###  Status      Size     Free     Dyn  Gpt
——–  ———-  ——-  ——-  —  —
* Disk 0    Online        75 GB      0 B

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> detail disk

ST380815AS
Disk ID: D42AD42A
Type   : IDE
Bus    : 0
Target : 0
LUN ID : 0

Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
———-  —  ———–  —–  ———-  ——-  ———  ——–
Volume 1     C                NTFS   Partition     65 GB  Healthy    System
Volume 2     D   HP_RECOVERY  NTFS   Partition     10 GB  Healthy

DISKPART> select volume 1

Volume 1 is the selected volume.

DISKPART> detail volume

Disk ###  Status      Size     Free     Dyn  Gpt
——–  ———-  ——-  ——-  —  —
* Disk 0    Online        75 GB      0 B

Using Diskpart.exe to extend a data volume in Windows Server 2003 and XP

Conditions for extending a drive

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. 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 want to extend.

At a command prompt, type diskpart.exe.

Type list volume to display the existing volumes on the computer.

Type Select volume volume number where volume number is number of the volume that you want to extend.

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.

Type exit to exit Diskpart.exe.

Advertisements

Posted on July 29, 2011, in General, Uncategorized, Windows. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: