| 0x40002ee3 | 1011 | On disks with master boot record (MBR) disk formatting, marks
the partition with focus as active.
Syntax: ACTIVE
Writes a value to the disk which is read by the basic input/output
system (BIOS) at boot. This value specifies that the partition is
a valid system partition.
A partition must be selected for this operation to succeed.
Caution:
DiskPart verifies only that the partition is capable of containing the
operating system startup files. DiskPart does not check the contents of
the partition. If you mistakenly mark a partition as active and it does
not contain the operating system startup files, your computer might not
start.
Example:
ACTIVE |
| 0x40002ee5 | 1011 | Mirrors the simple volume with focus to the specified disk.
Syntax: ADD DISK= [ALIGN=] [WAIT] [NOERR]
DISK= Specifies a disk, other than the one containing the existing
simple volume, to contain the mirror. You can mirror only
simple volumes. The specified disk must have unallocated space
at least as large as the size of the simple volume you want to
mirror.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
WAIT Waits for the volume to finish synchronizing with the added
disk before returning. Without the WAIT parameter, DiskPart
returns after the mirrored volume is created and does not wait
for the synchronization to complete.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A volume must be selected for this operation to succeed.
Fault-tolerant volumes such as RAID-5 and mirrored volumes are not
supported in any edition of Windows Vista.
Example:
ADD DISK=2 |
| 0x40002ee7 | 1011 | Assigns a drive letter or mounted folder pathname to the volume with focus.
Syntax: ASSIGN [LETTER= | MOUNT=] [NOERR]
LETTER= The drive letter to assign to the volume.
MOUNT=
The mounted folder pathname to assign to the volume.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
If no drive letter or mounted folder is specified, the next available drive
letter is assigned. If the drive letter or mounted folder is already in use,
an error is generated.
By using the ASSIGN command, you can change the drive letter associated
with a removable drive.
You cannot assign drive letters to boot volumes or
volumes that contain the paging file. In addition, you cannot assign
a drive letter to an Original Equipment Manufacturer (OEM) partition
unless booted to Windows PE, or any GUID Partition Table (GPT) partition
other than a basic data partition, an ESP partition or a recovery
partition.
A volume must be selected for this operation to succeed.
Example:
ASSIGN LETTER=D |
| 0x40002ee9 | 78.11011 | Displays, sets, or clears volume attributes for the selected volume.
Syntax: ATTRIBUTES VOLUME [SET | CLEAR]
[HIDDEN | READONLY | NODEFAULTDRIVELETTER | SHADOWCOPY] [NOERR]
SET Sets the specified attribute (HIDDEN, READONLY, and
NODEFAULTDRIVELETTER or SHADOWCOPY) for the selected volume.
CLEAR Clears the specified attribute (HIDDEN, READONLY,
NODEFAULTDRIVELETTER or SHADOWCOPY) from the selected volume.
HIDDEN Specifies that the volume is hidden.
READONLY Specifies that the volume is read-only.
NODEFAULTDRIVELETTER
Specifies that the volume does not receive a drive letter by
default.
SHADOWCOPY Specifies that the volume is a shadow copy volume.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
On basic master boot record (MBR) disks, the HIDDEN, READONLY, and
NODEFAULTDRIVELETTER attributes apply to all volumes on the disk.
On basic GUID partition table (GPT) disks, and on dynamic MBR and GPT
disks, the HIDDEN, READONLY, and NODEFAULTDRIVELETTER attributes apply
only to the selected volume.
Example:
To display the attributes on the selected volume, type:
ATTRIBUTES VOLUME
To set the attribute on the selected volume as read-only, type:
ATTRIBUTES VOLUME SET READONLY
To clear the read-only attribute from the selected volume, type:
ATTRIBUTES VOLUME CLEAR READONLY |
| 0x40002eeb | 1011 | Enables or disables the automount feature.
Syntax: AUTOMOUNT [ENABLE] [DISABLE] [SCRUB] [NOERR]
ENABLE Enables Windows to automatically assign drive letters
to volumes that are added to the system.
DISABLE Prevents Windows from automatically assigning drive letters
to volumes that are added to the system.
SCRUB Removes mounted folder pathnames, drive letters, mounted
folder directories, and registry settings, for volumes that
are no longer in the system. This prevents volumes that were
previously in the system from being automatically assigned
their former drive letters and mounted folder pathnames when
they are reintroduced to the system.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
When the AutoMount feature is enabled (the default on some versions
of Windows Server), Windows automatically brings the volume online,
and, assigns a drive letter and a volume GUID pathname to the volume,
when the volume is added to the system. In storage area network (SAN)
configurations, disabling AutoMount prevents Windows from automatically
onlining the volume and assigning drive letters or volume GUID pathnames
to any new volumes that are visible to the system.
Note that the AutoMount feature could only be applied to basic disk
volumes on Windows versions released prior to Windows Vista. Starting
with Windows Vista, the AutoMount feature can be applied to both basic
and dynamic disk volumes.
Example:
AUTOMOUNT
AUTOMOUNT ENABLE
AUTOMOUNT DISABLE |
| 0x40002eed | 1011 | Breaks the mirrored volume with focus into two simple volumes.
Syntax: BREAK DISK= [NOKEEP] [NOERR]
DISK= Specifies a disk that contains one copy of the mirror
volume. When the command has completed, this disk is
given focus, and the new volume created on this disk
using the mirror volume extents does not retain any
drive letters, volume GUID pathnames or mounted folder
paths that had been associated with the mirror volume.
If the mirror volume on the specified disk is used as a
system or boot partition, the command fails.
NOKEEP Specifies that only one copy of the mirror volume is
retained; the mirror volume extents on disk are converted
to free space. Neither the remaining copy of the mirror
volume, nor the free space on disk receives the focus.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Applies to dynamic disks only. Breaks the mirrored volume with focus into
two simple volumes. One simple volume retains the drive letter, volume
GUID pathnames or mounted folder paths that had been associated with
the mirror volume. The other simple volume receives the focus so you
can assign it a new drive letter (it will automatically be assigned a
volume GUID pathname).
By default, the contents of both copies of the mirror are retained. Each
copy becomes a simple volume. By using the NOKEEP parameter, you retain
only one copy of the mirror volume as a simple volume, and the other copy
is converted to free space. Neither volume receives the focus.
A mirror volume must be selected for this operation to succeed.
Example:
BREAK DISK=2 |
| 0x40002eef | 1011 | Removes any and all partition or volume formatting from the disk with
focus.
Syntax: CLEAN [ALL]
ALL Specifies that each and every byte\sector on the disk is set to
zero, which completely deletes all data contained on the disk.
On master boot record (MBR) disks, only the MBR partitioning information
and hidden sector information are overwritten. On GUID partition table
(GPT) disks, the GPT partitioning information, including the Protective
MBR, is overwritten. If the ALL parameter is not used, the first 1MB
and the last 1MB of the disk are zeroed. This erases any disk formatting
that had been previously applied to the disk. The disk's state after
cleaning the disk is 'UNINITIALIZED'.
Example:
CLEAN |
| 0x40002ef1 | 78.11011 | Converts an empty dynamic disk to a basic disk.
Syntax: CONVERT BASIC [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A dynamic disk must be selected for this operation to succeed.
Important:
The disk must be empty to convert it to a dynamic disk. Back up your
data, and then delete all partitions or volumes before converting the
disk.
Example:
CONVERT BASIC |
| 0x40002ef3 | 78.11011 | Converts a basic disk into a dynamic disk.
Syntax: CONVERT DYNAMIC [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Any existing partitions on the basic disk become simple volumes.
A basic disk must be selected for this operation to succeed.
Example:
CONVERT DYNAMIC |
| 0x40002ef5 | 1011 | Converts an empty basic disk with the master boot record (MBR) partition
style into a basic disk with the GUID partition table (GPT) partition
style.
Syntax: CONVERT GPT [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A basic MBR disk must be selected for this operation to succeed.
The required minimum disk size for conversion to GPT is 128MB.
Important:
The disk must be empty to convert it to a GPT disk. Back up your data,
and then delete all partitions or volumes before converting the disk.
Example:
CONVERT GPT |
| 0x40002ef7 | 78.11011 | Converts an empty basic disk with the GUID partition table (GPT) partition
style to a basic disk with the master boot record (MBR) partition style.
Syntax: CONVERT MBR [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A basic GPT disk must be selected for this operation to succeed.
Important:
The disk must be empty to convert it to an MBR disk. Back up your data,
and then delete all partitions or volumes before converting the disk.
Example:
CONVERT MBR |
| 0x40002ef9 | 78.11011 | Creates an Extensible Firmware Interface (EFI) system partition on a GUID
partition table (GPT) disk.
Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR]
SIZE= The size of the partition in megabytes (MB). If no size is
given, the partition continues until there is no more free
space in the current region.
OFFSET= The offset, in kilobytes (KB), at which the partition is
created. If no offset is given, the partition is placed in the
first disk extent that is large enough to hold it.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After the partition has been created, the focus is given to the new
partition.
A basic GPT disk must be selected for this operation to succeed.
Example:
CREATE PARTITION EFI SIZE=1000 |
| 0x40002efb | 1011 | Creates an extended partition on the disk with focus.
Applies to master boot record (MBR) disks only.
Syntax: CREATE PARTITION EXTENDED [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
SIZE= The size of the partition in megabytes (MB). If no size is
given, the partition continues until there is no more free
space in the extended partition.
OFFSET= The offset, in kilobytes (KB), at which the partition is
created. If no offset is given, the partition will start
at the beginning of the first free space on the disk that
is large enough to hold the new partition.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. The partition offset will be
a multiple of . If the OFFSET parameter is specified, it
will be rounded to the closest multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After the partition has been created, the focus automatically shifts to the
new partition. Only one extended partition can be created per disk. This
command fails if you attempt to create an extended partition within another
extended partition. You must create an extended partition before you can
create logical partitions.
A basic MBR disk must be selected for this operation to succeed.
Example:
CREATE PARTITION EXTENDED SIZE=1000 |
| 0x40002efd | 1011 | Creates a logical partition in an extended partition.
Applies to master boot record (MBR) disks only.
Syntax: CREATE PARTITION LOGICAL [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
SIZE= The size of the partition in megabytes (MB). The partition is
at least as big in bytes as the number specified by N. If you
specify a size for the logical partition, it must be smaller
than the extended partition. If no size is given, the partition
continues until there is no more free space in the extended
partition.
OFFSET= The offset, in kilobytes (KB), at which the partition is created.
If no offset is given, the partition is placed in the first disk
extent that is large enough to hold it.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. The partition offset will be
a multiple of . If the OFFSET parameter is specified, it
will be rounded to the closest multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After the partition has been created, the focus automatically shifts to the
new logical partition.
A basic MBR disk must be selected for this operation to succeed.
Example:
CREATE PARTITION LOGICAL SIZE=1000 |
| 0x40002eff | 78.11011 | Creates a Microsoft Reserved (MSR) partition on a GUID partition table
(GPT) disk.
Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR]
SIZE= The size of the partition in megabytes (MB). The partition is
at least as big in bytes as the number specified by N. If no
size is given, the partition continues until there is no more
free space in the current region.
OFFSET= The offset, in kilobytes (KB), at which the partition is
created. If no offset is given, the partition is placed in the
first disk extent that is large enough to hold it.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A basic GPT disk must be selected for this operation to succeed.
Caution:
Be very careful when using this command. Because GPT disks require a
specific partition layout, creating Microsoft Reserved partitions could
cause the disk to become unreadable. On GPT disks that are used to boot
Windows, the EFI System partition is the first partition on the disk,
followed by the Microsoft Reserved partition. GPT disks used only for
data storage do not have an EFI System partition, in which case the
Microsoft Reserved partition is the first partition.
Windows does not online Microsoft Reserved partitions. You cannot store data
on them and you cannot delete them.
Example:
CREATE PARTITION MSR SIZE=1000 |
| 0x40002f01 | 1011 | Creates a primary partition on the basic disk with focus.
Syntax: CREATE PARTITION PRIMARY [SIZE=] [OFFSET=] [ID={ | }]
[ALIGN=] [NOERR]
SIZE= The size of the partition in megabytes (MB). If no size is
given, the partition continues until there is no more
unallocated space in the current region.
OFFSET= The offset, in kilobytes (KB), at which the partition is created.
If no offset is given, the partition is placed in the first disk
extent that is large enough to hold it.
ID={ | }
Specifies the partition type.
Intended for Original Equipment Manufacturer (OEM) use only.
For master boot record (MBR) disks, you can specify a partition
type byte, in hexadecimal form, for the partition. If this
parameter is not specified for an MBR disk, the command creates
a partition of type 0x06 (specifies no file system is installed).
LDM data partition:
0x42
Recovery partition:
0x27
Recognized OEM Ids:
0x12
0x84
0xDE
0xFE
0xA0
For GUID partition table (GPT) disks you can specify a
partition type GUID for the partition you want to create.
Recognized GUIDs include:
EFI System partition:
c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Microsoft Reserved partition:
e3c9e316-0b5c-4db8-817d-f92df00215ae
Basic data partition:
ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
LDM Metadata partition on a dynamic disk:
5808c8aa-7e8f-42e0-85d2-e1e90434cfb3
LDM Data partition on a dynamic disk:
af9b60a0-1431-4f62-bc68-3311714a69ad
Recovery partition:
de94bba4-06d1-4d40-a16a-bfd50179d6ac
If this parameter is not specified for a GPT disk, the command
creates a basic data partition.
Any partition type byte or GUID can be specified with this
parameter. DiskPart does not check the partition type for
validity except to ensure that it is a byte in hexadecimal form
or a GUID.
Caution:
Creating partitions with this parameter might cause your
computer to fail or be unable to start up. Unless you are
an OEM or an IT professional experienced with GPT disks, do
not create partitions on GPT disks using this parameter.
Instead, always use the CREATE PARTITION EFI command to
create EFI System partitions, the CREATE PARTITION MSR
command to create Microsoft Reserved partitions, and the
CREATE PARTITION PRIMARY command without this parameter to
create primary partitions on GPT disks.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. The partition offset will be
a multiple of . If the OFFSET parameter is specified, it
will be rounded to the closest multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the partition, the focus automatically shifts to the new
partition. The partition does not receive a drive letter. You must use the
assign command to assign a drive letter to the partition.
A basic disk must be selected for this operation to succeed.
If a partition type is not specified, the disk is uninitialized and disk
size is greater than 2TB, it will be initialized to GPT.
Example:
CREATE PARTITION PRIMARY SIZE=1000
CREATE PARTITION PRIMARY SIZE=128 ID=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
CREATE PARTITION PRIMARY SIZE=10000 ID=12
CREATE PARTITION PRIMARY SIZE=10000 ID=DE |
| 0x40002f03 | 1011 | Creates a RAID-5 volume using three or more specified dynamic disks.
Syntax: CREATE VOLUME RAID [SIZE=] DISK=,,[,[,...]] [ALIGN=]
[NOERR]
SIZE= The amount of disk space, in megabytes (MB), that the volume
will occupy on each disk. If no size is given, the largest
possible RAID-5 volume will be created. The disk with the
smallest available contiguous free space determines the size
for the RAID-5 volume and the same amount of space is allocated
from each disk. The actual amount of usable disk space in the
RAID-5 volume is less than the combined amount of disk space
because some of the disk space is required for parity.
DISK=,,[,[,...]]
The dynamic disks on which to create the RAID-5 volume. You
need at least three dynamic disks in order to create a RAID-5
volume. An amount of space equal to the size specified in
SIZE= is allocated on each disk.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the volume, the focus automatically shifts to the new
volume.
Fault-tolerant volumes such as RAID-5 and mirrored volumes are not
supported in any edition of Windows Vista.
Example:
CREATE VOLUME RAID SIZE=1000 DISK=1,2,3 |
| 0x40002f05 | 1011 | Creates a simple volume.
Syntax: CREATE VOLUME SIMPLE [SIZE=] [DISK=] [ALIGN=] [NOERR]
SIZE= The size of the volume in megabytes (MB). If no size is given,
the new volume takes up the remaining free space on the disk.
DISK= The dynamic disk on which the volume is created. If no disk is
given, the current disk is used.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the volume, the focus automatically shifts to the new
volume.
Example:
CREATE VOLUME SIMPLE SIZE=1000 DISK=1 |
| 0x40002f07 | 1011 | Creates a striped volume using two or more specified dynamic disks.
Syntax: CREATE VOLUME STRIPE [SIZE=] DISK=,[,[,...]] [ALIGN=]
[NOERR]
SIZE= The amount of disk space, in megabytes (MB), that the volume
will occupy on each disk. If no size is given, the new volume
takes up the remaining free space on the smallest disk and an
equal amount of space on each subsequent disk.
DISK=,[,[,...]]
The dynamic disks on which the striped volume is created. You
need at least two dynamic disks to create a striped volume. An
amount of space equal to the size specified in SIZE= is
allocated on each disk.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the volume, the focus automatically shifts to the new
volume.
Example:
CREATE VOLUME STRIPE SIZE=1000 DISK=1,2 |
| 0x40002f09 | 78.11011 | Deletes a missing dynamic disk from the disk list.
Syntax: DELETE DISK [NOERR] [OVERRIDE]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
OVERRIDE Enables DiskPart to delete all simple volumes on the disk. If
the disk contains half of a mirrored volume, the half of the
mirror on the disk is deleted. The delete disk override command
fails if the disk is a member of a RAID-5 volume.
A missing dynamic disk must be selected for this operation to succeed.
Example:
DELETE DISK |
| 0x40002f0b | 1011 | Deletes the partition with focus.
Syntax: DELETE PARTITION [NOERR] [OVERRIDE]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
OVERRIDE Enables DiskPart to delete any partition regardless of type.
Typically, DiskPart only permits you to delete known data
partitions.
You cannot delete the system partition, boot partition, or any partition
that contains the active paging file or crash dump (memory dump) filed.
A partition must be selected for this operation to succeed.
Partitions cannot be deleted from dynamic disks or created on dynamic
disks.
Example:
DELETE PARTITION |
| 0x40002f0d | 1011 | Deletes the selected volume.
Syntax: DELETE VOLUME [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
You cannot delete the current system volume, boot volume, or any
volume that contains the active paging file or crash dump (memory
dump) file.
A volume must be selected for this operation to succeed.
Example:
DELETE VOLUME |
| 0x40002f0f | 78.11011 | Displays the properties of the selected disk and the list of volumes on
the disk.
Syntax: DETAIL DISK
A disk must be selected for this operation to succeed.
Example:
DETAIL DISK |
| 0x40002f11 | 78.11011 | Displays the properties for the selected partition.
Syntax: DETAIL PARTITION
A partition must be selected for this operation to succeed.
Example:
DETAIL PARTITION |
| 0x40002f13 | 78.11011 | Displays the properties for the selected volume and the list of disks on
which the volume resides.
Syntax: DETAIL VOLUME
A volume must be selected for this operation to succeed.
Example:
DETAIL VOLUME |
| 0x40002f15 | 78.11011 | Exits the DiskPart command interpreter.
Syntax: EXIT
Example:
EXIT |
| 0x40002f17 | 1011 | Extends the volume or partition with focus, and its file system, into free
(unallocated) space on a disk.
Syntax: EXTEND [SIZE=] [DISK=] [NOERR]
EXTEND FILESYSTEM [NOERR]
SIZE= Specifies the amount of space in megabytes (MB) to add to the
current volume or partition. If no size is given, all of the
contiguous free space that is available on the disk is used.
DISK= Specifies the disk on which the volume or partition is
extended. If no disk is specified, the volume or partition is
extended on the current disk.
FILESYSTEM Extends the file system of the volume with focus to cover
the entire volume. For use only on volumes where the file
system was not extended with the volume.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
On basic disks, the free space must be on the same disk as the volume or
partition with focus. The free space must also immediately follow the
volume or partition with focus (start at the next sector offset).
On dynamic disks with simple or spanned volumes, a volume can be extended
to any free space on any dynamic disk. Using this command, you can convert
a simple dynamic volume into a spanned dynamic volume. Mirrored, RAID-5 and
striped volumes cannot be extended.
If the partition was previously formatted with the NTFS file system, the
file system is automatically extended to fill the larger partition. No data
loss occurs. If the partition was previously formatted with a different
file system than NTFS, the command fails with no change to the partition.
If the partition was not previously formatted with a file system, the
partition will still be extended.
A volume or partition must be selected for this operation to succeed.
Example:
EXTEND SIZE=500 DISK=3
EXTEND FILESYSTEM |
| 0x40002f19 | 1011 | On basic GUID partition table (GPT) disks, assigns the GPT attribute(s) to
the partition with focus.
Syntax: GPT ATTRIBUTES=
ATTRIBUTES=
The hexadecimal value indicating the attributes to apply to the
partition with focus. The GPT attribute field is a 64-bit field
that contains two subfields. The higher field is interpreted
only in the context of a particular partition type GUID, while
the lower field is common to all partition types.
The following attribute can be set on any partition:
0x0000000000000001 marks the partition as required. This
indicates to all disk management utilities that the partition
should not be deleted. The EFI System partition contains only
those binaries necessary to start the operating system. This
makes it easy for original equipment manufacturer (OEM) or
operating system-specific binaries to be placed in other
partitions.
For basic data partitions, the following attributes are defined:
0x8000000000000000
GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER
Prevents the partition from having a drive
letter automatically assigned. By default, each partition is
assigned a new drive letter and a volume GUID pathname. Both
the drive letter and the volume GUID pathname can be used to
open the volume using Win32 APIs. Setting this attribute ensures
that when a disk is moved to a new computer, a new drive letter
will not be automatically generated. Instead, the user can
manually assign drive letters.
0x4000000000000000
GPT_BASIC_DATA_ATTRIBUTE_HIDDEN
Defines the partition's volume as hidden.
Setting this attribute specifies that the volume will not be
assigned a drive letter or a volume GUID pathname. Both
the drive letter and the volume GUID pathname can be used to
open the volume using Win32 APIs. A hidden partition's
volume is not reported by Win32 APIs such as FindFirstVolume
and FindNextVolume.
0x2000000000000000
GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY
Defines the partition as being a Volume Snapshot Service
shadow copy volume. Fle system filters use this flag to
prevent the filter from attaching to the volume.
0x1000000000000000
GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY
Prevents the volume from being written to.
Other attributes may be added by Microsoft at any time.
GPT partition attributes give additional information about the use of the
partition.
A basic GPT partition must be selected for this operation to succeed.
Caution:
Changing the GPT attributes might cause your basic data volumes to
fail to be assigned drive letters, or prevent the file system from
mounting. Unless you are an original equipment manufacturer (OEM)
or an IT professional experienced with GPT disks, do not change GPT
attributes.
Example:
GPT ATTRIBUTES=0x8000000000000000
GPT ATTRIBUTES=0xF000000000000001 |
| 0x40002f1b | 78.11011 | Displays a list of the available commands or detailed help information for a
specified command.
Syntax: HELP []
The command for which to display detail help.
If no command is specified, HELP will display all possible commands.
Example:
HELP
HELP CREATE PARTITION PRIMARY |
| 0x40002f1d | 78.11011 | Imports a foreign disk group into the local computer's online disk group.
Syntax: IMPORT [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
The command imports every disk that is in the same group as the disk with
focus.
A dynamic disk must be selected for this operation to succeed.
Example:
IMPORT |
| 0x40002f1f | 1011 | On disks with master boot record (MBR) disk formatting, marks
the partition with focus as inactive.
Syntax: INACTIVE
The computer may start from the next option specified in the BIOS such as a
CD-ROM drive or a Pre-Boot eXecution Environment (PXE)-based boot
environment (such as Remote Installation Services (RIS)) when you restart
the computer.
A partition must be selected for this operation to succeed.
Caution:
Your computer might not start without an active partition. Do not mark
a system or boot partition as inactive unless you are an experienced
user with a thorough understanding of Windows storage management.
Example:
INACTIVE |
| 0x40002f21 | 1011 | Displays a list of disks.
Syntax: LIST DISK
Displays a list of disks and information about them, such as their
size, amount of available free space, whether the disk is a basic
or dynamic disk, and whether the disk uses the master boot record
(MBR) or GUID partition table (GPT) partition style. The disk marked
with an asterisk (*) has focus.
Note that the FREE column does not display the total amount of free
space on the disk, but rather the amount of usable free space left
on the disk. For example, if you have a 10GB disk with 4 primary
partitions covering 5GB, there is no usable free space left (no
more partitions may be created). Another example would be you have
a 10GB disk with 3 primary partitions and an extended partition
covering 8GB. The exended partition is of size 3GB with one logical
drive of size 2GB. The disk will show only 1GB as free - the
1GB of free space in the extended partition.
Example:
LIST DISK |
| 0x40002f23 | 1011 | Displays a list of partitions in the partition table for the selected disk.
Syntax: LIST PARTITION
On dynamic disks, the partitions do not neccessarily correspond to the
dynamic volumes on the disk. Partitions may not be created or deleted
on dynamic disks.
A disk must be selected for this operation to succeed.
Example:
LIST PARTITION |
| 0x40002f25 | 1011 | Displays a list of basic and dynamic volumes which are installed on the local
machine.
Syntax: LIST VOLUME
Example:
LIST VOLUME |
| 0x40002f27 | 1011 | Brings the selected offline disk to the online state.
Syntax: ONLINE DISK [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a single disk. A disk must be selected for
this operation to succeed.
This command operates on a disk that is in SAN offline mode.
If the disk is dynamic, it is both read only and offline, and, the
desired state is read\write and online, the suggested order of
operations is to first make the disk read\write, and then bring
the disk online. If a dynamic read only disk is brought online, it's
status will be 'Errors'. The reason for this is that when a dynamic
disk is brought online, the volume manager must write to the Dynamic
Disk Database on the disk to update it's state. These writes will
fail if the dynamic disk is read only.
Examples:
ONLINE DISK |
| 0x40002f29 | 1011 | Removes a drive letter or mounted folder pathname from the volume
with focus.
Syntax: REMOVE [LETTER= | MOUNT= | ALL] [DISMOUNT] [NOERR]
LETTER= The drive letter to be removed.
MOUNT=
The mounted folder path to be removed.
ALL Removes all current drive letters and mounted folder paths.
DISMOUNT This parameter may be used if 1) all drive letters and
mounted folder paths have been removed from the volume, or
2) the ALL parameter is specified. This parameter
specifies that the file system is to be dismounted and
the volume taken offline. If other processes are using
the volume, DiskPart closes any open handles before
dismounting the file system and taking the volume offline.
You can bring the volume online by assigning it a driver
letter, by creating a mounted folder path to the volume, or
by using the ONLINE command. DISMOUNT will fail if used
on a volume that has any remaining drive letters or mounted
folder paths. For scripting, using REMOVE ALL DISMOUNT is
recommended.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
If no drive letter or mounted folder path is specified, DiskPart removes
the first drive letter or mounted folder path it encounters. If the ALL
parameter is used, all current drive letters and mounted folder paths
are removed. If the DISMOUNT parameter is used, DiskPart closes all open
handles to the volume and then dismounts the volume and takes it offline.
The REMOVE command can be used to change the drive letter associated with a
removable drive. You cannot remove the drive letters on boot or
paging volumes.
A volume must be selected for this operation to succeed.
Example:
REMOVE LETTER=K
REMOVE MOUNT=G:\MountH
REMOVE ALL DISMOUNT |
| 0x40002f2b | 1011 | Repairs the RAID-5 volume with focus by replacing the failed RAID-5 member
with the specified dynamic disk.
Syntax: REPAIR DISK= [ALIGN=] [NOERR]
DISK= Specifies the dynamic disk that will replace the failed RAID-5
member. The specified disk must have free space equal to or
larger than the total size of the failed RAID-5 member.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
The specified dynamic disk must have free space greater than or equal to
the size of the failed RAID-5 member.
A RAID-5 volume must be selected for this operation to succeed.
Example:
REPAIR DISK=1 |
| 0x40002f2d | 78.11011 | Locates new disks that may have been added to the computer.
Syntax: RESCAN
Example:
RESCAN |
| 0x40002f2f | 78.11011 | Prepares an existing dynamic simple volume to be used as a boot or system
volume.
Syntax: RETAIN
This command creates a partition entry for the dynamic simple volume with
focus.
A dynamic simple volume must be selected for this operation to succeed.
Example:
RETAIN |
| 0x40002f31 | 1011 | Selects the specified disk and shifts the focus to it.
Syntax: SELECT DISK=
SELECT DISK=SYSTEM
SELECT DISK=NEXT
SELECT DISK=
DISK=
The DiskPart disk index number of the disk to receive
focus.
DISK=
The location path of the disk to receive focus.
DISK=SYSTEM
On BIOS machines, BIOS disk 0 will receive focus.
On EFI machines, the disk containing the ESP partition
used for the current boot will receive focus. On EFI
machines, if there is no ESP, or there is more than
one ESP present, or the machine is booted from Windows PE,
the command will fail.
DISK=NEXT
Once a disk is selected, this command is used to iterate
over all disks in the disk list. The next disk in the list
will receive focus. If the next disk is the start of the
enumeration, the command will fail and no disk will have
focus.
If no options are specified, the select command lists the disk that
currently has the focus. You can view the DiskPart index numbers
for all disks on the computer by using the LIST DISK command.
Example:
SELECT DISK=1
SELECT DISK=SYSTEM
SELECT DISK=NEXT
SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C00T00L01) |
| 0x40002f33 | 78.11011 | Selects the specified partition and shifts the focus to it.
Syntax: SELECT PARTITION=
PARTITION=
The number of the partition to receive the focus.
If no partition is specified, the select command lists the current
partition with focus. You can specify the partition by its number. You can
view the numbers of all partitions on the current disk by using the list
partition command.
You must first select a disk using the DiskPart select disk command before
you can select a partition.
Example:
SELECT PARTITION=1 |
| 0x40002f35 | 1011 | Selects the specified volume and shifts the focus to it.
Syntax: SELECT VOLUME={ | }
VOLUME= The number of the volume to receive the focus.
VOLUME= The drive letter or mounted folder path of the volume
to receive the focus.
If no volume is specified, the select command lists the current volume with
focus. You can specify the volume by number, drive letter, or mounted folder
path. On a basic disk, selecting a volume also gives the corresponding
partition focus. You can view the numbers of all volumes on the computer by
using the list volume command.
Example:
SELECT VOLUME=1
SELECT VOLUME=C
SELECT VOLUME=C:\MountH |
| 0x40002f37 | 78.11011 | Provides a way to add comments to a script.
Syntax: REM
Example:
In this example script, REM is used to provide a comment about what the
script does.
REM These commands set up 3 drives.
CREATE PARTITION PRIMARY SIZE=2048
ASSIGN d:
CREATE PARTITION EXTEND
CREATE PARTITION LOGICAL SIZE=2048
ASSIGN e:
CREATE PARTITION LOGICAL
ASSIGN f: |
| 0x40002f39 | 1011 | Formats the specified volume for use with Windows.
Syntax: FORMAT [[FS=] [REVISION=] | RECOMMENDED] [LABEL=<"label">]
[UNIT=] [QUICK] [COMPRESS] [OVERRIDE] [DUPLICATE] [NOWAIT]
[NOERR]
FS= Specifies the type of file system. If no file system is given,
the default file system displayed by the FILESYSTEMS command is
used.
REVISION=
Specifies the file system revision (if applicable).
RECOMMENDED If specified, use the recommended file system and revision
instead of the default if a recommendation exists. The
recommended file system (if one exists) is displayed by the
FILESYSTEMS command.
LABEL=<"label">
Specifies the volume label.
UNIT= Overrides the default allocation unit size. Default settings
are strongly recommended for general use. The default
allocation unit size for a particular file system is displayed
by the FILESYSTEMS command.
NTFS compression is not supported for allocation unit sizes
above 4096.
QUICK Performs a quick format.
COMPRESS NTFS only: Files created on the new volume will be compressed
by default.
OVERRIDE Forces the file system to dismount first if necessary. All
opened handles to the volume would no longer be valid.
DUPLICATE UDF Only: This flag applies to UDF format, version 2.5 or
higher.
This flag instructs the format operation to duplicate the file
system meta-data to a second set of sectors on the disk. The
duplicate meta-data is used by applications, for example repair
or recovery applications. If the primary meta-data sectors are
found to be corrupted, the file system meta-data will be read
from the duplicate sectors.
NOWAIT Forces the command to return immediately while the format
process is still in progress. If NOWAIT is not specified,
DiskPart will display format progress in percentage.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A volume must be selected for this operation to succeed.
Examples:
FORMAT FS=NTFS LABEL="New Volume" QUICK COMPRESS
FORMAT RECOMMENDED OVERRIDE |
| 0x40002f3b | 1011 | Changes the partition type field for the partition with focus.
Syntax: SET ID={ | } [OVERRIDE] [NOERR]
ID={ | }
Specifies the new partition type.
For master boot record (MBR) disks, you can specify a partition
type byte, in hexadecimal form, for the partition. Any
partition type byte can be specified with this parameter except
for type 0x42 (LDM partition). Note that the leading '0x' is
omitted when specifying the hexadecimal partition type.
For GUID partition table (GPT) disks you can specify a
partition type GUID for the partition. Recognized GUIDs
include:
EFI System partition:
c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Basic data partition:
ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
Any partition type GUID can be specified with this parameter
except for the following:
Microsoft Reserved partition:
e3c9e316-0b5c-4db8-817d-f92df00215ae
LDM Metadata partition on a dynamic disk:
5808c8aa-7e8f-42e0-85d2-e1e90434cfb3
LDM Data partition on a dynamic disk:
af9b60a0-1431-4f62-bc68-3311714a69ad
Cluster Metadata partition:
db97dba9-0840-4bae-97f0-ffb9a327c7e1
Other than the limitations mentioned, DiskPart otherwise does
not check the partition type for validity except to ensure that
it is a byte in hexadecimal form or a GUID.
OVERRIDE Enables DiskPart to force the file system on the volume to
dismount before changing the partition type. When changing
the partition type, DiskPart will attempt to lock and dismount
the file system on the volume. If this parameter is not specified,
and the call to lock the file system fails, (because some other
application has an open handle to the volume), the entire
operation will fail. When this parameter is specified, the
dismount is forced even if the call to lock the file system
fails. When a file system is dismounted, all opened handles to
the volume will become invalid.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Intended for Original Equipment Manufacturer (OEM) use only.
A partition must be selected for this operation to succeed.
Caution:
Changing partition type fields with this parameter might cause your
computer to fail or be unable to start up. Unless you are an OEM or an
IT professional experienced with GPT disks, do not change partition
type fields on GPT disks using this parameter. Instead, always use the
CREATE PARTITION EFI command to create EFI System partitions, the
CREATE PARTITION MSR command to create Microsoft Reserved partitions,
and the CREATE PARTITION PRIMARY command without the ID parameter to
create primary partitions on GPT disks.
This command does not work on dynamic disks nor on Microsoft Reserved
partitions.
Example:
SET ID=07 OVERRIDE
SET ID=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 0x40002f3d | 1011 | Reduces the size of the volume with focus by the specified amount. Makes
free disk space available from unused space at the end of the volume.
Syntax: SHRINK [DESIRED=] [MINIMUM=] [NOWAIT] [NOERR]
SHRINK QUERYMAX [NOERR]
DESIRED= Specifies the desired amount of space in megabytes (MB) to
reduce the size of the volume by. If a desired amount is not
specified, the volume will be reduced by the maximum amount of
free space available on the volume.
MINIMUM= Specifies the minimum amount of space in MB to reduce the size
of the volume by.
QUERYMAX Returns the maximum number of bytes that the volume can be
reduced by (the free space available on the volume). This
value may change if applications are currently accessing the
volume.
NOWAIT Forces the command to return immediately while the shrink
process is still in progress.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
If a MINIMUM amount is not specified, the volume will be reduced by either
the DESIRED amount (if specified), or by the maximum amount of free space
available on the volume. If a MINIMUM amount is specified but not enough
free space is available, the command will fail.
This command works on basic volumes, and on simple or spanned dynamic
volumes. You can reduce the size of a volume only if it is formatted using
the NTFS file system or if it does not have a file system.
A volume must be selected for this operation to succeed.
This command does not operate on OEM, ESP or recovery partitions.
Examples:
SHRINK DESIRED=500 MINIMUM=250
SHRINK QUERYMAX |
| 0x40002f3f | 78.11011 | Displays information about the current file system for the selected
volume, and the supported file systems for formatting the volume.
Syntax: FILESYSTEMS
A volume must be selected for this operation to succeed.
Example:
FILESYSTEMS |
| 0x40002f41 | 78.11011 | Moves one or more disks from an online pack to a new offline pack.
Syntax: SPLIT DISK=[,[,...]]
DISK=[,[,...]]
Specifies the disk or disks that will be split from the online
pack.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
At least one disk must be specified for this operation to succeed. The
disk(s) must be part of a pack that is currently online. The disk(s) will
be placed in a new offline pack.
You should use this command when you are moving disks in a pack from one
computer to another. This ensures that the same pack ID is not used
in more than one computer.
Example:
SPLIT DISK=1
SPLIT DISK=1,2 |
| 0x40002f42 | 1011 | Brings selected online disk to the offline state.
Syntax: OFFLINE DISK [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a single disk. A disk must be selected for
this operation to succeed.
This command operates on a disk that is in SAN online mode.
This command does not operate on OEM, ESP or recovery partitions.
Examples:
OFFLINE DISK |
| 0x40002f43 | 1011 | Displays, sets, or clears disk attributes for the selected disk.
Syntax: ATTRIBUTES DISK [SET | CLEAR] [READONLY] [NOERR]
SET Sets the specified attribute for the selected disk.
CLEAR Clears the specified attribute for the selected disk.
READONLY Specifies that the disk is read-only.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command allows the user to set, clear, or display the attributes
for a disk. When called with no parameters, this command displays the
current disk flags. READONLY is currently the only disk flag that may
be changed. The BOOT DISK attribute denotes the disk used to boot.
For a dynamic mirrored volume, the BOOT DISK attribute is
displayed for the disk containing the boot plex of the mirrored boot
volume.
Examples:
To display the attributes on the selected disk, type:
ATTRIBUTES DISK
To set the attribute for the selected disk as read-only, type:
ATTRIBUTES DISK SET READONLY
To clear the read-only attribute for the selected disk, type:
ATTRIBUTES DISK CLEAR READONLY |
| 0x40002f44 | 1011 | Displays or sets the SAN policy for the operating system.
Syntax: SAN [POLICY={OnlineAll | OfflineAll | OfflineShared | OfflineInternal}] [NOERR]
SAN If the command is given with no parameters, the current
SAN policy is displayed.
POLICY= Sets the SAN policy for the currently booted operating
system.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command allows the user to display or change the SAN policy for the
currently booted OS. The default policy for Windows Advanced Server and
Windows Data Center is OfflineShared. In this case the boot disk will
be brought online, as will all disks that are not located on a shared bus
such as SCSI, iSCSI, SAS, etc. The offlined disks will be read-only by
default. On all other versions of Windows, the default will be to bring
all disks online. In this case, the disks will be online and read/write.
The third policy value is OfflineAll. For this case, all disks except the
boot disk will be offline and read-only by default. The forth policy value
is OfflineInternal and the default is to keep newly discovered internal
disks offline and read-only.
Examples:
SAN
SAN POLICY=OfflineAll |
| 0x40002f45 | 1011 | Displays or sets the GUID partition table (GPT) identifier or master boot
record (MBR) signature for the disk with focus.
Syntax: UNIQUEID DISK [ID={ | }] [NOERR]
ID={ | }
For MBR disks, you can specify a four-byte (DWORD) value in
hexadecimal form for the signature.
For GPT disks, specify a GUID for the identifier.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A disk must be selected for this operation to succeed. This command works
on basic and dynamic disks.
Example:
UNIQUEID DISK
UNIQUEID DISK ID=5f1b2c36
UNIQUEID DISK ID=baf784e7-6bbd-4cfb-aaac-e86c96e166ee |
| 0x40002f4e | 1011 | Refreshes the state of all disks in the selected pack, attempts recovery
on disks in the invalid pack, and, resynchronizes mirrored volumes and
RAID-5 volumes that have stale plex or parity data.
Syntax: RECOVER [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a pack. A disk that is part of a pack must be
selected for this operation to succeed.
This command is only applicable to dynamic disks. If called on a
basic disk, it will succeed but no action is taken.
Example:
RECOVER |
| 0x40002f50 | 1011 | Brings selected offline volume to the online state.
Syntax: ONLINE VOLUME [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a single volume. A volume must be selected for
this operation to succeed.
This command does not operate on OEM, ESP or recovery partitions.
Examples:
ONLINE VOLUME |
| 0x40002f51 | 1011 | Brings selected online volume to the offline state.
Syntax: OFFLINE VOLUME [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a single volume. A volume must be selected for
this operation to succeed.
Examples:
OFFLINE VOLUME |
| 0x40002f52 | 1011 | Creates a mirror volume using two specified dynamic disks.
Syntax: CREATE VOLUME MIRROR [SIZE=] DISK=, [ALIGN=] [NOERR]
SIZE= The amount of disk space, in megabytes (MB), that the volume
will occupy on each disk. If no size is given, the new volume
takes up the remaining free space on the smaller disk and an
equal amount of space on other disk.
DISK=,
The dynamic disks on which the mirror volume is created. You
need two dynamic disks to create a mirror volume. An amount
of space equal to the size specified in SIZE= is allocated
on each disk.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of N.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the volume, the focus automatically shifts to the new
volume.
Example:
CREATE VOLUME MIRROR SIZE=1000 DISK=1,2 |
| 0x40002f53 | 1011 | Creates a virtual disk file. Currently only VHD and VHDX format files are
supported and are specified through the file extensions (.vhd and .vhdx)
of the virtual disk file.
Syntax: CREATE VDISK FILE=<"filename"> MAXIMUM= [TYPE={FIXED|EXPANDABLE}]
[SD=] [PARENT=<"filename">] [SOURCE=<"filename">]
[NOERR]
FILE=<"filename">
Specifies the complete path and filename of the virtual disk
file. The file may be on a network share.
MAXIMUM= The maximum amount of space exposed by the virtual disk, in
megabytes (MB).
TYPE={FIXED|EXPANDABLE}
FIXED specifies a fixed size virtual disk file. EXPANDABLE
specifies a virtual disk file that resizes to accommodate
the allocated data. The default is FIXED.
[SD=]
Specifies a security descriptor in the security descriptor
definition language (SDDL) format. By default the security
descriptor is taken from the parent directory.
SDDL strings can be complex but flexible. In its simplest
form, a security descriptor that protects access, is known as
a discretionary access control list (DACL). It is of the form:
D:()()...()
Common DACL_FLAGS are:
"P" - The DACL should not be overiden
(protected) by any ACLs from parent containers.
The container for a VHD or VHDX file is its
directory.
"AI"- The DACL should auto-inherit from the parent
container.
STRING_ACEs are of the form
;;;;;
Common ACE_TYPEs are:
"A" - Allow access.
"D" - Deny access.
Common RIGHTS are:
"GA" - All access.
"GR" - Read access.
"GW' - Write access.
Common ACCOUNT_IDs are:
"BA" - Built in administrators
"AU" - Authenticated users.
"CO" - Creator owner.
"WD" - Everyone.
Putting all this together, for example,
D:P:(A;;GR;;;AU)
gives read-access to all authenticated users.
Similarly,
D:P:(A;;GA;;;WD)
Gives everyone full access.
Further information on the SDDL can be found
on Microsoft's MSDN website.
[PARENT=<"filename">]
Path to an existing parent virtual disk file to create a
differencing disk. With the PARENT parameter, MAXIMUM should
not be specified because the differencing disk gets the size
from its parent. Also, TYPE should not be specified since only
EXPANDABLE differencing disks can be created.
[SOURCE=<"filename">]
Path to an existing virtual disk file to be used to
pre-populate the new virtual disk file. When SOURCE is
specified, data from the input virtual disk file is copied
block for block from the input virtual disk file to the
created virtual disk file. There is no parent-child
relationship established however.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Example:
CREATE VDISK FILE="c:\test\test.vhd" MAXIMUM=1000
CREATE VDISK FILE="c:\test\child.vhdx" PARENT="c:\test\test.vhdx"
CREATE VDISK FILE="c:\test\test.vhd" MAXIMUM=1000 SD="D:P(A;;GA;;;WD)"
CREATE VDISK FILE="c:\test\new.vhdx" SOURCE="c:\test\test.vhd" |
| 0x40002f54 | 1011 | Selects the specified virtual disk by filename and shifts the focus to it.
Syntax: SELECT VDISK FILE=<"filename"> [NOERR]
FILE=<"filename">
Specifies the complete path and filename of an existing
virtual disk file.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Example:
SELECT VDISK FILE="c:\test\test.vhd"
SELECT VDISK FILE="c:\test\test.vhdx" NOERR |
| 0x40002f55 | 1011 | Attaches the specified virtual disk.
Syntax: ATTACH VDISK [NOERR] [READONLY] { [SD=] | [USEFILESD] }
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
READONLY Attaches the virtual disk as read-only. Any write operation
will return an input/output device error.
SD=
Specifies a security descriptor in the security descriptor
definition language (SDDL) format. By default the security
descriptor allows access like any physical disk. For more
information on the SDDL please see the CREATE VDISK command.
USEFILESD Specifies that the security descriptor on the virtual file
itself should be used on the virtual disk. If not specified,
the disk will not have an explicit security descriptor unless
specified with SD=(SDDL string).
NODRIVELETTER Mount all volumes on the attached virtual disk without assigning
drive letters to them.
A virtual disk must be selected for this operation to succeed.
Example:
ATTACH VDISK
ATTACH VDISK READONLY
ATTACH VDISK USEFILESD |
| 0x40002f56 | 78.11011 | Detach the specified virtual disk.
Syntax: DETACH VDISK [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A virtual disk must be selected for this operation to succeed.
Example:
DETACH VDISK |
| 0x40002f57 | 78.11011 | Displays the properties of the selected virtual disk.
Syntax: DETAIL VDISK
A virtual disk must be selected for this operation to succeed.
Example:
DETAIL VDISK |
| 0x40002f58 | 1011 | Displays a list of virtual disks.
Syntax: LIST VDISK
Displays a list of virtual disks and information about them. The disk type
is shown as Unknown until the disk is attached. The disk marked with an
asterisk (*) has focus.
Example:
LIST VDISK |
| 0x40002f59 | 1011 | Compacts the virtual disk file to reduce the physical size of the file.
Compact operation can be performed on a detached EXPANDABLE virtual disk
or an EXPANDABLE virtual disk that is attached read only.
Syntax: COMPACT VDISK
A virtual disk must be selected for this operation to succeed.
Example:
COMPACT VDISK |
| 0x40002f5a | 1011 | Merges a child disk with its parents.
Syntax: MERGE VDISK DEPTH=
DEPTH= Indicates the number of parents to merge together. For example,
MERGE=1 indicates one level of the differencing chain should be
merged.
A virtual disk must be selected for this operation to succeed.
Example:
MERGE VDISK DEPTH=1
In this example a child virtual disk is merged with its parent:
CREATE VDISK FILE="c:\vhd2.vhd" parent="c:\vhd1.vhd"
MERGE VDISK DEPTH=1 |
| 0x40002f5b | 1011 | Expands the maximum size available on a virtual disk.
Syntax: EXPAND VDISK MAXIMUM=
MAXIMUM= Indicates the new virtual size of the disk in megabytes (MB).
A virtual disk must be selected for this operation to succeed.
Only detached disks can be expanded.
Example:
EXPAND VDISK MAXIMUM=20000 |
| 0x40002f5e | 8.11011 | Disk is uninitialized, initializing it to GPT. |
| 0xc0002af9 | 78.11011 | The arguments specified for this command are not valid.
For more information on the command type: HELP %1!s! |
| 0xc0002f5c | 78.11011 | There is no virtual disk file specified to create.
Please specify a file using the FILE=<"filename"> parameter. |
| 0xc0002f5d | 78.11011 | There is no virtual disk file specified to select.
Please specify a file using the FILE=<"filename"> parameter. |
| 0x40002ee3 | 78.1 | On disks with master boot record (MBR) disk formatting, marks
the partition with focus as active.
Syntax: ACTIVE
Writes a value to the disk which is read by the basic input/output
system (BIOS) at boot. This value specifies that the partition is
a valid system partition.
A partition must be selected for this operation to succeed.
Caution:
DiskPart verifies only that the partition is capable of containing the
operating system startup files. DiskPart does not check the contents of
the partition. If you mistakenly mark a partition as active and it does
not contain the operating system startup files, your computer might not
start.
Example:
ACTIVE |
| 0x40002ee5 | 78.1 | Mirrors the simple volume with focus to the specified disk.
Syntax: ADD DISK= [ALIGN=] [WAIT] [NOERR]
DISK= Specifies a disk, other than the one containing the existing
simple volume, to contain the mirror. You can mirror only
simple volumes. The specified disk must have unallocated space
at least as large as the size of the simple volume you want to
mirror.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
WAIT Waits for the volume to finish synchronizing with the added
disk before returning. Without the WAIT parameter, DiskPart
returns after the mirrored volume is created and does not wait
for the synchronization to complete.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A volume must be selected for this operation to succeed.
Fault-tolerant volumes such as RAID-5 and mirrored volumes are not
supported in any edition of Windows Vista.
Example:
ADD DISK=2 |
| 0x40002ee7 | 78.1 | Assigns a drive letter or mounted folder pathname to the volume with focus.
Syntax: ASSIGN [LETTER= | MOUNT=] [NOERR]
LETTER= The drive letter to assign to the volume.
MOUNT=
The mounted folder pathname to assign to the volume.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
If no drive letter or mounted folder is specified, the next available drive
letter is assigned. If the drive letter or mounted folder is already in use,
an error is generated.
By using the ASSIGN command, you can change the drive letter associated
with a removable drive.
You cannot assign drive letters to boot volumes or
volumes that contain the paging file. In addition, you cannot assign
a drive letter to an Original Equipment Manufacturer (OEM) partition
unless booted to Windows PE, or any GUID Partition Table (GPT) partition
other than a basic data partition, an ESP partition or a recovery
partition.
A volume must be selected for this operation to succeed.
Example:
ASSIGN LETTER=D |
| 0x40002eeb | 78.1 | Enables or disables the automount feature.
Syntax: AUTOMOUNT [ENABLE] [DISABLE] [SCRUB] [NOERR]
ENABLE Enables Windows to automatically assign drive letters
to volumes that are added to the system.
DISABLE Prevents Windows from automatically assigning drive letters
to volumes that are added to the system.
SCRUB Removes mounted folder pathnames, drive letters, mounted
folder directories, and registry settings, for volumes that
are no longer in the system. This prevents volumes that were
previously in the system from being automatically assigned
their former drive letters and mounted folder pathnames when
they are reintroduced to the system.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
When the AutoMount feature is enabled (the default on some versions
of Windows Server), Windows automatically brings the volume online,
and, assigns a drive letter and a volume GUID pathname to the volume,
when the volume is added to the system. In storage area network (SAN)
configurations, disabling AutoMount prevents Windows from automatically
onlining the volume and assigning drive letters or volume GUID pathnames
to any new volumes that are visible to the system.
Note that the AutoMount feature could only be applied to basic disk
volumes on Windows versions released prior to Windows Vista. Starting
with Windows Vista, the AutoMount feature can be applied to both basic
and dynamic disk volumes.
Example:
AUTOMOUNT
AUTOMOUNT ENABLE
AUTOMOUNT DISABLE |
| 0x40002eed | 78.1 | Breaks the mirrored volume with focus into two simple volumes.
Syntax: BREAK DISK= [NOKEEP] [NOERR]
DISK= Specifies a disk that contains one copy of the mirror
volume. When the command has completed, this disk is
given focus, and the new volume created on this disk
using the mirror volume extents does not retain any
drive letters, volume GUID pathnames or mounted folder
paths that had been associated with the mirror volume.
If the mirror volume on the specified disk is used as a
system or boot partition, the command fails.
NOKEEP Specifies that only one copy of the mirror volume is
retained; the mirror volume extents on disk are converted
to free space. Neither the remaining copy of the mirror
volume, nor the free space on disk receives the focus.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Applies to dynamic disks only. Breaks the mirrored volume with focus into
two simple volumes. One simple volume retains the drive letter, volume
GUID pathnames or mounted folder paths that had been associated with
the mirror volume. The other simple volume receives the focus so you
can assign it a new drive letter (it will automatically be assigned a
volume GUID pathname).
By default, the contents of both copies of the mirror are retained. Each
copy becomes a simple volume. By using the NOKEEP parameter, you retain
only one copy of the mirror volume as a simple volume, and the other copy
is converted to free space. Neither volume receives the focus.
A mirror volume must be selected for this operation to succeed.
Example:
BREAK DISK=2 |
| 0x40002eef | 78.1 | Removes any and all partition or volume formatting from the disk with
focus.
Syntax: CLEAN [ALL]
ALL Specifies that each and every byte\sector on the disk is set to
zero, which completely deletes all data contained on the disk.
On master boot record (MBR) disks, only the MBR partitioning information
and hidden sector information are overwritten. On GUID partition table
(GPT) disks, the GPT partitioning information, including the Protective
MBR, is overwritten. If the ALL parameter is not used, the first 1MB
and the last 1MB of the disk are zeroed. This erases any disk formatting
that had been previously applied to the disk. The disk's state after
cleaning the disk is 'UNINITIALIZED'.
Example:
CLEAN |
| 0x40002ef5 | 78.1 | Converts an empty basic disk with the master boot record (MBR) partition
style into a basic disk with the GUID partition table (GPT) partition
style.
Syntax: CONVERT GPT [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A basic MBR disk must be selected for this operation to succeed.
The required minimum disk size for conversion to GPT is 128MB.
Important:
The disk must be empty to convert it to a GPT disk. Back up your data,
and then delete all partitions or volumes before converting the disk.
Example:
CONVERT GPT |
| 0x40002efb | 78.1 | Creates an extended partition on the disk with focus.
Applies to master boot record (MBR) disks only.
Syntax: CREATE PARTITION EXTENDED [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
SIZE= The size of the partition in megabytes (MB). If no size is
given, the partition continues until there is no more free
space in the extended partition.
OFFSET= The offset, in kilobytes (KB), at which the partition is
created. If no offset is given, the partition will start
at the beginning of the first free space on the disk that
is large enough to hold the new partition.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. The partition offset will be
a multiple of . If the OFFSET parameter is specified, it
will be rounded to the closest multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After the partition has been created, the focus automatically shifts to the
new partition. Only one extended partition can be created per disk. This
command fails if you attempt to create an extended partition within another
extended partition. You must create an extended partition before you can
create logical partitions.
A basic MBR disk must be selected for this operation to succeed.
Example:
CREATE PARTITION EXTENDED SIZE=1000 |
| 0x40002efd | 78.1 | Creates a logical partition in an extended partition.
Applies to master boot record (MBR) disks only.
Syntax: CREATE PARTITION LOGICAL [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
SIZE= The size of the partition in megabytes (MB). The partition is
at least as big in bytes as the number specified by N. If you
specify a size for the logical partition, it must be smaller
than the extended partition. If no size is given, the partition
continues until there is no more free space in the extended
partition.
OFFSET= The offset, in kilobytes (KB), at which the partition is created.
If no offset is given, the partition is placed in the first disk
extent that is large enough to hold it.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. The partition offset will be
a multiple of . If the OFFSET parameter is specified, it
will be rounded to the closest multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After the partition has been created, the focus automatically shifts to the
new logical partition.
A basic MBR disk must be selected for this operation to succeed.
Example:
CREATE PARTITION LOGICAL SIZE=1000 |
| 0x40002f01 | 7 | Creates a primary partition on the basic disk with focus.
Syntax: CREATE PARTITION PRIMARY [SIZE=] [OFFSET=] [ID={ | }]
[ALIGN=] [NOERR]
SIZE= The size of the partition in megabytes (MB). If no size is
given, the partition continues until there is no more
unallocated space in the current region.
OFFSET= The offset, in kilobytes (KB), at which the partition is created.
If no offset is given, the partition is placed in the first disk
extent that is large enough to hold it.
ID={ | }
Specifies the partition type.
Intended for Original Equipment Manufacturer (OEM) use only.
For master boot record (MBR) disks, you can specify a partition
type byte, in hexadecimal form, for the partition. If this
parameter is not specified for an MBR disk, the command creates
a partition of type 0x06 (specifies no file system is installed).
LDM data partition:
0x42
Recovery partition:
0x27
Recognized OEM Ids:
0x12
0x84
0xDE
0xFE
0xA0
For GUID partition table (GPT) disks you can specify a
partition type GUID for the partition you want to create.
Recognized GUIDs include:
EFI System partition:
c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Microsoft Reserved partition:
e3c9e316-0b5c-4db8-817d-f92df00215ae
Basic data partition:
ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
LDM Metadata partition on a dynamic disk:
5808c8aa-7e8f-42e0-85d2-e1e90434cfb3
LDM Data partition on a dynamic disk:
af9b60a0-1431-4f62-bc68-3311714a69ad
Recovery partition:
de94bba4-06d1-4d40-a16a-bfd50179d6ac
If this parameter is not specified for a GPT disk, the command
creates a basic data partition.
Any partition type byte or GUID can be specified with this
parameter. DiskPart does not check the partition type for
validity except to ensure that it is a byte in hexadecimal form
or a GUID.
Caution:
Creating partitions with this parameter might cause your
computer to fail or be unable to start up. Unless you are
an OEM or an IT professional experienced with GPT disks, do
not create partitions on GPT disks using this parameter.
Instead, always use the CREATE PARTITION EFI command to
create EFI System partitions, the CREATE PARTITION MSR
command to create Microsoft Reserved partitions, and the
CREATE PARTITION PRIMARY command without this parameter to
create primary partitions on GPT disks.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. The partition offset will be
a multiple of . If the OFFSET parameter is specified, it
will be rounded to the closest multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the partition, the focus automatically shifts to the new
partition. The partition does not receive a drive letter. You must use the
assign command to assign a drive letter to the partition.
A basic disk must be selected for this operation to succeed.
Example:
CREATE PARTITION PRIMARY SIZE=1000
CREATE PARTITION PRIMARY SIZE=128 ID=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
CREATE PARTITION PRIMARY SIZE=10000 ID=12
CREATE PARTITION PRIMARY SIZE=10000 ID=DE |
| 0x40002f03 | 78.1 | Creates a RAID-5 volume using three or more specified dynamic disks.
Syntax: CREATE VOLUME RAID [SIZE=] DISK=,,[,[,...]] [ALIGN=]
[NOERR]
SIZE= The amount of disk space, in megabytes (MB), that the volume
will occupy on each disk. If no size is given, the largest
possible RAID-5 volume will be created. The disk with the
smallest available contiguous free space determines the size
for the RAID-5 volume and the same amount of space is allocated
from each disk. The actual amount of usable disk space in the
RAID-5 volume is less than the combined amount of disk space
because some of the disk space is required for parity.
DISK=,,[,[,...]]
The dynamic disks on which to create the RAID-5 volume. You
need at least three dynamic disks in order to create a RAID-5
volume. An amount of space equal to the size specified in
SIZE= is allocated on each disk.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the volume, the focus automatically shifts to the new
volume.
Fault-tolerant volumes such as RAID-5 and mirrored volumes are not
supported in any edition of Windows Vista.
Example:
CREATE VOLUME RAID SIZE=1000 DISK=1,2,3 |
| 0x40002f05 | 78.1 | Creates a simple volume.
Syntax: CREATE VOLUME SIMPLE [SIZE=] [DISK=] [ALIGN=] [NOERR]
SIZE= The size of the volume in megabytes (MB). If no size is given,
the new volume takes up the remaining free space on the disk.
DISK= The dynamic disk on which the volume is created. If no disk is
given, the current disk is used.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the volume, the focus automatically shifts to the new
volume.
Example:
CREATE VOLUME SIMPLE SIZE=1000 DISK=1 |
| 0x40002f07 | 78.1 | Creates a striped volume using two or more specified dynamic disks.
Syntax: CREATE VOLUME STRIPE [SIZE=] DISK=,[,[,...]] [ALIGN=]
[NOERR]
SIZE= The amount of disk space, in megabytes (MB), that the volume
will occupy on each disk. If no size is given, the new volume
takes up the remaining free space on the smallest disk and an
equal amount of space on each subsequent disk.
DISK=,[,[,...]]
The dynamic disks on which the striped volume is created. You
need at least two dynamic disks to create a striped volume. An
amount of space equal to the size specified in SIZE= is
allocated on each disk.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the volume, the focus automatically shifts to the new
volume.
Example:
CREATE VOLUME STRIPE SIZE=1000 DISK=1,2 |
| 0x40002f0b | 78.1 | Deletes the partition with focus.
Syntax: DELETE PARTITION [NOERR] [OVERRIDE]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
OVERRIDE Enables DiskPart to delete any partition regardless of type.
Typically, DiskPart only permits you to delete known data
partitions.
You cannot delete the system partition, boot partition, or any partition
that contains the active paging file or crash dump (memory dump) filed.
A partition must be selected for this operation to succeed.
Partitions cannot be deleted from dynamic disks or created on dynamic
disks.
Example:
DELETE PARTITION |
| 0x40002f0d | 78.1 | Deletes the selected volume.
Syntax: DELETE VOLUME [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
You cannot delete the current system volume, boot volume, or any
volume that contains the active paging file or crash dump (memory
dump) file.
A volume must be selected for this operation to succeed.
Example:
DELETE VOLUME |
| 0x40002f17 | 78.1 | Extends the volume or partition with focus, and its file system, into free
(unallocated) space on a disk.
Syntax: EXTEND [SIZE=] [DISK=] [NOERR]
EXTEND FILESYSTEM [NOERR]
SIZE= Specifies the amount of space in megabytes (MB) to add to the
current volume or partition. If no size is given, all of the
contiguous free space that is available on the disk is used.
DISK= Specifies the disk on which the volume or partition is
extended. If no disk is specified, the volume or partition is
extended on the current disk.
FILESYSTEM Extends the file system of the volume with focus to cover
the entire volume. For use only on volumes where the file
system was not extended with the volume.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
On basic disks, the free space must be on the same disk as the volume or
partition with focus. The free space must also immediately follow the
volume or partition with focus (start at the next sector offset).
On dynamic disks with simple or spanned volumes, a volume can be extended
to any free space on any dynamic disk. Using this command, you can convert
a simple dynamic volume into a spanned dynamic volume. Mirrored, RAID-5 and
striped volumes cannot be extended.
If the partition was previously formatted with the NTFS file system, the
file system is automatically extended to fill the larger partition. No data
loss occurs. If the partition was previously formatted with a different
file system than NTFS, the command fails with no change to the partition.
If the partition was not previously formatted with a file system, the
partition will still be extended.
A volume or partition must be selected for this operation to succeed.
Example:
EXTEND SIZE=500 DISK=3
EXTEND FILESYSTEM |
| 0x40002f19 | 78.1 | On basic GUID partition table (GPT) disks, assigns the GPT attribute(s) to
the partition with focus.
Syntax: GPT ATTRIBUTES=
ATTRIBUTES=
The hexadecimal value indicating the attributes to apply to the
partition with focus. The GPT attribute field is a 64-bit field
that contains two subfields. The higher field is interpreted
only in the context of a particular partition type GUID, while
the lower field is common to all partition types.
The following attribute can be set on any partition:
0x0000000000000001 marks the partition as required. This
indicates to all disk management utilities that the partition
should not be deleted. The EFI System partition contains only
those binaries necessary to start the operating system. This
makes it easy for original equipment manufacturer (OEM) or
operating system-specific binaries to be placed in other
partitions.
For basic data partitions, the following attributes are defined:
0x8000000000000000
GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER
Prevents the partition from having a drive
letter automatically assigned. By default, each partition is
assigned a new drive letter and a volume GUID pathname. Both
the drive letter and the volume GUID pathname can be used to
open the volume using Win32 APIs. Setting this attribute ensures
that when a disk is moved to a new computer, a new drive letter
will not be automatically generated. Instead, the user can
manually assign drive letters.
0x4000000000000000
GPT_BASIC_DATA_ATTRIBUTE_HIDDEN
Defines the partition's volume as hidden.
Setting this attribute specifies that the volume will not be
assigned a drive letter or a volume GUID pathname. Both
the drive letter and the volume GUID pathname can be used to
open the volume using Win32 APIs. A hidden partition's
volume is not reported by Win32 APIs such as FindFirstVolume
and FindNextVolume.
0x2000000000000000
GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY
Defines the partition as being a Volume Snapshot Service
shadow copy volume. Fle system filters use this flag to
prevent the filter from attaching to the volume.
0x1000000000000000
GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY
Prevents the volume from being written to.
Other attributes may be added by Microsoft at any time.
GPT partition attributes give additional information about the use of the
partition.
A basic GPT partition must be selected for this operation to succeed.
Caution:
Changing the GPT attributes might cause your basic data volumes to
fail to be assigned drive letters, or prevent the file system from
mounting. Unless you are an original equipment manufacturer (OEM)
or an IT professional experienced with GPT disks, do not change GPT
attributes.
Example:
GPT ATTRIBUTES=0x8000000000000000
GPT ATTRIBUTES=0xF000000000000001 |
| 0x40002f1f | 78.1 | On disks with master boot record (MBR) disk formatting, marks
the partition with focus as inactive.
Syntax: INACTIVE
The computer may start from the next option specified in the BIOS such as a
CD-ROM drive or a Pre-Boot eXecution Environment (PXE)-based boot
environment (such as Remote Installation Services (RIS)) when you restart
the computer.
A partition must be selected for this operation to succeed.
Caution:
Your computer might not start without an active partition. Do not mark
a system or boot partition as inactive unless you are an experienced
user with a thorough understanding of Windows storage management.
Example:
INACTIVE |
| 0x40002f21 | 78.1 | Displays a list of disks.
Syntax: LIST DISK
Displays a list of disks and information about them, such as their
size, amount of available free space, whether the disk is a basic
or dynamic disk, and whether the disk uses the master boot record
(MBR) or GUID partition table (GPT) partition style. The disk marked
with an asterisk (*) has focus.
Note that the FREE column does not display the total amount of free
space on the disk, but rather the amount of usable free space left
on the disk. For example, if you have a 10GB disk with 4 primary
partitions covering 5GB, there is no usable free space left (no
more partitions may be created). Another example would be you have
a 10GB disk with 3 primary partitions and an extended partition
covering 8GB. The exended partition is of size 3GB with one logical
drive of size 2GB. The disk will show only 1GB as free - the
1GB of free space in the extended partition.
Example:
LIST DISK |
| 0x40002f23 | 78.1 | Displays a list of partitions in the partition table for the selected disk.
Syntax: LIST PARTITION
On dynamic disks, the partitions do not neccessarily correspond to the
dynamic volumes on the disk. Partitions may not be created or deleted
on dynamic disks.
A disk must be selected for this operation to succeed.
Example:
LIST PARTITION |
| 0x40002f25 | 78.1 | Displays a list of basic and dynamic volumes which are installed on the local
machine.
Syntax: LIST VOLUME
Example:
LIST VOLUME |
| 0x40002f27 | 78.1 | Brings the selected offline disk to the online state.
Syntax: ONLINE DISK [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a single disk. A disk must be selected for
this operation to succeed.
This command operates on a disk that is in SAN offline mode.
If the disk is dynamic, it is both read only and offline, and, the
desired state is read\write and online, the suggested order of
operations is to first make the disk read\write, and then bring
the disk online. If a dynamic read only disk is brought online, it's
status will be 'Errors'. The reason for this is that when a dynamic
disk is brought online, the volume manager must write to the Dynamic
Disk Database on the disk to update it's state. These writes will
fail if the dynamic disk is read only.
Examples:
ONLINE DISK |
| 0x40002f29 | 78.1 | Removes a drive letter or mounted folder pathname from the volume
with focus.
Syntax: REMOVE [LETTER= | MOUNT= | ALL] [DISMOUNT] [NOERR]
LETTER= The drive letter to be removed.
MOUNT=
The mounted folder path to be removed.
ALL Removes all current drive letters and mounted folder paths.
DISMOUNT This parameter may be used if 1) all drive letters and
mounted folder paths have been removed from the volume, or
2) the ALL parameter is specified. This parameter
specifies that the file system is to be dismounted and
the volume taken offline. If other processes are using
the volume, DiskPart closes any open handles before
dismounting the file system and taking the volume offline.
You can bring the volume online by assigning it a driver
letter, by creating a mounted folder path to the volume, or
by using the ONLINE command. DISMOUNT will fail if used
on a volume that has any remaining drive letters or mounted
folder paths. For scripting, using REMOVE ALL DISMOUNT is
recommended.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
If no drive letter or mounted folder path is specified, DiskPart removes
the first drive letter or mounted folder path it encounters. If the ALL
parameter is used, all current drive letters and mounted folder paths
are removed. If the DISMOUNT parameter is used, DiskPart closes all open
handles to the volume and then dismounts the volume and takes it offline.
The REMOVE command can be used to change the drive letter associated with a
removable drive. You cannot remove the drive letters on boot or
paging volumes.
A volume must be selected for this operation to succeed.
Example:
REMOVE LETTER=K
REMOVE MOUNT=G:\MountH
REMOVE ALL DISMOUNT |
| 0x40002f2b | 78.1 | Repairs the RAID-5 volume with focus by replacing the failed RAID-5 member
with the specified dynamic disk.
Syntax: REPAIR DISK= [ALIGN=] [NOERR]
DISK= Specifies the dynamic disk that will replace the failed RAID-5
member. The specified disk must have free space equal to or
larger than the total size of the failed RAID-5 member.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
The specified dynamic disk must have free space greater than or equal to
the size of the failed RAID-5 member.
A RAID-5 volume must be selected for this operation to succeed.
Example:
REPAIR DISK=1 |
| 0x40002f31 | 78.1 | Selects the specified disk and shifts the focus to it.
Syntax: SELECT DISK=
SELECT DISK=SYSTEM
SELECT DISK=NEXT
SELECT DISK=
DISK=
The DiskPart disk index number of the disk to receive
focus.
DISK=
The location path of the disk to receive focus.
DISK=SYSTEM
On BIOS machines, BIOS disk 0 will receive focus.
On EFI machines, the disk containing the ESP partition
used for the current boot will receive focus. On EFI
machines, if there is no ESP, or there is more than
one ESP present, or the machine is booted from Windows PE,
the command will fail.
DISK=NEXT
Once a disk is selected, this command is used to iterate
over all disks in the disk list. The next disk in the list
will receive focus. If the next disk is the start of the
enumeration, the command will fail and no disk will have
focus.
If no options are specified, the select command lists the disk that
currently has the focus. You can view the DiskPart index numbers
for all disks on the computer by using the LIST DISK command.
Example:
SELECT DISK=1
SELECT DISK=SYSTEM
SELECT DISK=NEXT
SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C00T00L01) |
| 0x40002f35 | 78.1 | Selects the specified volume and shifts the focus to it.
Syntax: SELECT VOLUME={ | }
VOLUME= The number of the volume to receive the focus.
VOLUME= The drive letter or mounted folder path of the volume
to receive the focus.
If no volume is specified, the select command lists the current volume with
focus. You can specify the volume by number, drive letter, or mounted folder
path. On a basic disk, selecting a volume also gives the corresponding
partition focus. You can view the numbers of all volumes on the computer by
using the list volume command.
Example:
SELECT VOLUME=1
SELECT VOLUME=C
SELECT VOLUME=C:\MountH |
| 0x40002f39 | 78.1 | Formats the specified volume for use with Windows.
Syntax: FORMAT [[FS=] [REVISION=] | RECOMMENDED] [LABEL=<"label">]
[UNIT=] [QUICK] [COMPRESS] [OVERRIDE] [DUPLICATE] [NOWAIT]
[NOERR]
FS= Specifies the type of file system. If no file system is given,
the default file system displayed by the FILESYSTEMS command is
used.
REVISION=
Specifies the file system revision (if applicable).
RECOMMENDED If specified, use the recommended file system and revision
instead of the default if a recommendation exists. The
recommended file system (if one exists) is displayed by the
FILESYSTEMS command.
LABEL=<"label">
Specifies the volume label.
UNIT= Overrides the default allocation unit size. Default settings
are strongly recommended for general use. The default
allocation unit size for a particular file system is displayed
by the FILESYSTEMS command.
NTFS compression is not supported for allocation unit sizes
above 4096.
QUICK Performs a quick format.
COMPRESS NTFS only: Files created on the new volume will be compressed
by default.
OVERRIDE Forces the file system to dismount first if necessary. All
opened handles to the volume would no longer be valid.
DUPLICATE UDF Only: This flag applies to UDF format, version 2.5 or
higher.
This flag instructs the format operation to duplicate the file
system meta-data to a second set of sectors on the disk. The
duplicate meta-data is used by applications, for example repair
or recovery applications. If the primary meta-data sectors are
found to be corrupted, the file system meta-data will be read
from the duplicate sectors.
NOWAIT Forces the command to return immediately while the format
process is still in progress. If NOWAIT is not specified,
DiskPart will display format progress in percentage.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A volume must be selected for this operation to succeed.
Examples:
FORMAT FS=NTFS LABEL="New Volume" QUICK COMPRESS
FORMAT RECOMMENDED OVERRIDE |
| 0x40002f3b | 78.1 | Changes the partition type field for the partition with focus.
Syntax: SET ID={ | } [OVERRIDE] [NOERR]
ID={ | }
Specifies the new partition type.
For master boot record (MBR) disks, you can specify a partition
type byte, in hexadecimal form, for the partition. Any
partition type byte can be specified with this parameter except
for type 0x42 (LDM partition). Note that the leading '0x' is
omitted when specifying the hexadecimal partition type.
For GUID partition table (GPT) disks you can specify a
partition type GUID for the partition. Recognized GUIDs
include:
EFI System partition:
c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Basic data partition:
ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
Any partition type GUID can be specified with this parameter
except for the following:
Microsoft Reserved partition:
e3c9e316-0b5c-4db8-817d-f92df00215ae
LDM Metadata partition on a dynamic disk:
5808c8aa-7e8f-42e0-85d2-e1e90434cfb3
LDM Data partition on a dynamic disk:
af9b60a0-1431-4f62-bc68-3311714a69ad
Cluster Metadata partition:
db97dba9-0840-4bae-97f0-ffb9a327c7e1
Other than the limitations mentioned, DiskPart otherwise does
not check the partition type for validity except to ensure that
it is a byte in hexadecimal form or a GUID.
OVERRIDE Enables DiskPart to force the file system on the volume to
dismount before changing the partition type. When changing
the partition type, DiskPart will attempt to lock and dismount
the file system on the volume. If this parameter is not specified,
and the call to lock the file system fails, (because some other
application has an open handle to the volume), the entire
operation will fail. When this parameter is specified, the
dismount is forced even if the call to lock the file system
fails. When a file system is dismounted, all opened handles to
the volume will become invalid.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Intended for Original Equipment Manufacturer (OEM) use only.
A partition must be selected for this operation to succeed.
Caution:
Changing partition type fields with this parameter might cause your
computer to fail or be unable to start up. Unless you are an OEM or an
IT professional experienced with GPT disks, do not change partition
type fields on GPT disks using this parameter. Instead, always use the
CREATE PARTITION EFI command to create EFI System partitions, the
CREATE PARTITION MSR command to create Microsoft Reserved partitions,
and the CREATE PARTITION PRIMARY command without the ID parameter to
create primary partitions on GPT disks.
This command does not work on dynamic disks nor on Microsoft Reserved
partitions.
Example:
SET ID=07 OVERRIDE
SET ID=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 0x40002f3d | 78.1 | Reduces the size of the volume with focus by the specified amount. Makes
free disk space available from unused space at the end of the volume.
Syntax: SHRINK [DESIRED=] [MINIMUM=] [NOWAIT] [NOERR]
SHRINK QUERYMAX [NOERR]
DESIRED= Specifies the desired amount of space in megabytes (MB) to
reduce the size of the volume by. If a desired amount is not
specified, the volume will be reduced by the maximum amount of
free space available on the volume.
MINIMUM= Specifies the minimum amount of space in MB to reduce the size
of the volume by.
QUERYMAX Returns the maximum number of bytes that the volume can be
reduced by (the free space available on the volume). This
value may change if applications are currently accessing the
volume.
NOWAIT Forces the command to return immediately while the shrink
process is still in progress.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
If a MINIMUM amount is not specified, the volume will be reduced by either
the DESIRED amount (if specified), or by the maximum amount of free space
available on the volume. If a MINIMUM amount is specified but not enough
free space is available, the command will fail.
This command works on basic volumes, and on simple or spanned dynamic
volumes. You can reduce the size of a volume only if it is formatted using
the NTFS file system or if it does not have a file system.
A volume must be selected for this operation to succeed.
This command does not operate on OEM, ESP or recovery partitions.
Examples:
SHRINK DESIRED=500 MINIMUM=250
SHRINK QUERYMAX |
| 0x40002f42 | 78.1 | Brings selected online disk to the offline state.
Syntax: OFFLINE DISK [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a single disk. A disk must be selected for
this operation to succeed.
This command operates on a disk that is in SAN online mode.
This command does not operate on OEM, ESP or recovery partitions.
Examples:
OFFLINE DISK |
| 0x40002f43 | 78.1 | Displays, sets, or clears disk attributes for the selected disk.
Syntax: ATTRIBUTES DISK [SET | CLEAR] [READONLY] [NOERR]
SET Sets the specified attribute for the selected disk.
CLEAR Clears the specified attribute for the selected disk.
READONLY Specifies that the disk is read-only.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command allows the user to set, clear, or display the attributes
for a disk. When called with no parameters, this command displays the
current disk flags. READONLY is currently the only disk flag that may
be changed. The BOOT DISK attribute denotes the disk used to boot.
For a dynamic mirrored volume, the BOOT DISK attribute is
displayed for the disk containing the boot plex of the mirrored boot
volume.
Examples:
To display the attributes on the selected disk, type:
ATTRIBUTES DISK
To set the attribute for the selected disk as read-only, type:
ATTRIBUTES DISK SET READONLY
To clear the read-only attribute for the selected disk, type:
ATTRIBUTES DISK CLEAR READONLY |
| 0x40002f44 | 7 | Displays or sets the SAN policy for the operating system.
Syntax: SAN [POLICY={OnlineAll | OfflineAll | OfflineShared}] [NOERR]
SAN If the command is given with no parameters, the current
SAN policy is displayed.
POLICY= Sets the SAN policy for the currently booted operating
system.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command allows the user to display or change the SAN policy for the
currently booted OS. The default policy for Windows Advanced Server and
Windows Data Center is OfflineShared. In this case the boot disk will
be brought online, as will all disks that are not located on a shared bus
such as SCSI, iSCSI, SAS, etc. The offlined disks will be read-only by
default. On all other versions of Windows, the default will be to bring
all disks online. In this case, the disks will be online and read/write.
The third policy value is OfflineAll. For this case, all disks except the
boot disk will be offline and read-only by default.
Examples:
SAN
SAN POLICY=OfflineAll |
| 0x40002f45 | 78.1 | Displays or sets the GUID partition table (GPT) identifier or master boot
record (MBR) signature for the disk with focus.
Syntax: UNIQUEID DISK [ID={ | }] [NOERR]
ID={ | }
For MBR disks, you can specify a four-byte (DWORD) value in
hexadecimal form for the signature.
For GPT disks, specify a GUID for the identifier.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
A disk must be selected for this operation to succeed. This command works
on basic and dynamic disks.
Example:
UNIQUEID DISK
UNIQUEID DISK ID=5f1b2c36
UNIQUEID DISK ID=baf784e7-6bbd-4cfb-aaac-e86c96e166ee |
| 0x40002f4e | 78.1 | Refreshes the state of all disks in the selected pack, attempts recovery
on disks in the invalid pack, and, resynchronizes mirrored volumes and
RAID-5 volumes that have stale plex or parity data.
Syntax: RECOVER [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a pack. A disk that is part of a pack must be
selected for this operation to succeed.
This command is only applicable to dynamic disks. If called on a
basic disk, it will succeed but no action is taken.
Example:
RECOVER |
| 0x40002f50 | 78.1 | Brings selected offline volume to the online state.
Syntax: ONLINE VOLUME [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a single volume. A volume must be selected for
this operation to succeed.
This command does not operate on OEM, ESP or recovery partitions.
Examples:
ONLINE VOLUME |
| 0x40002f51 | 78.1 | Brings selected online volume to the offline state.
Syntax: OFFLINE VOLUME [NOERR]
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command operates on a single volume. A volume must be selected for
this operation to succeed.
Examples:
OFFLINE VOLUME |
| 0x40002f52 | 78.1 | Creates a mirror volume using two specified dynamic disks.
Syntax: CREATE VOLUME MIRROR [SIZE=] DISK=, [ALIGN=] [NOERR]
SIZE= The amount of disk space, in megabytes (MB), that the volume
will occupy on each disk. If no size is given, the new volume
takes up the remaining free space on the smaller disk and an
equal amount of space on other disk.
DISK=,
The dynamic disks on which the mirror volume is created. You
need two dynamic disks to create a mirror volume. An amount
of space equal to the size specified in SIZE= is allocated
on each disk.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. Aligns all volume extents to
the closest alignment boundary. The extent offsets will be
a multiple of N.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the volume, the focus automatically shifts to the new
volume.
Example:
CREATE VOLUME MIRROR SIZE=1000 DISK=1,2 |
| 0x40002f53 | 7 | Creates a virtual disk file. Currently only VHD format files are supported.
Syntax: CREATE VDISK FILE=<"filename"> MAXIMUM= [TYPE={FIXED|EXPANDABLE}]
[SD=] [PARENT=<"filename">] [SOURCE=<"filename">]
[NOERR]
FILE=<"filename">
Specifies the complete path and filename of the virtual disk
file. The file may be on a network share.
MAXIMUM= The maximum amount of space exposed by the virtual disk, in
megabytes (MB).
TYPE={FIXED|EXPANDABLE}
FIXED specifies a fixed size virtual disk file. EXPANDABLE
specifies a virtual disk file that resizes to accommodate
the allocated data. The default is FIXED.
[SD=]
Specifies a security descriptor in the security descriptor
definition language (SDDL) format. By default the security
descriptor is taken from the parent directory.
SDDL strings can be complex but flexible. In its simplest
form, a security descriptor that protects access, is known as
a discretionary access control list (DACL). It is of the form:
D:()()...()
Common DACL_FLAGS are:
"P" - The DACL should not be overiden
(protected) by any ACLs from parent containers.
The container for a VHD file is its directory.
"AI"- The DACL should auto-inherit from the parent
container.
STRING_ACEs are of the form
;;;;;
Common ACE_TYPEs are:
"A" - Allow access.
"D" - Deny access.
Common RIGHTS are:
"GA" - All access.
"GR" - Read access.
"GW' - Write access.
Common ACCOUNT_IDs are:
"BA" - Built in administrators
"AU" - Authenticated users.
"CO" - Creator owner.
"WD" - Everyone.
Putting all this together, for example,
D:P:(A;;GR;;;AU)
gives read-access to all authenticated users.
Similarly,
D:P:(A;;GA;;;WD)
Gives everyone full access.
Further information on the SDDL can be found
on Microsoft's MSDN website.
[PARENT=<"filename">]
Path to an existing parent virtual disk file to create a
differencing disk. With the PARENT parameter, MAXIMUM should
not be specified because the differencing disk gets the size
from its parent. Also, TYPE should not be specified since only
EXPANDABLE differencing disks can be created.
[SOURCE=<"filename">]
Path to an existing virtual disk file to be used to
pre-populate the new virtual disk file. When SOURCE is
specified, data from the input virtual disk file is copied
block for block from the input virtual disk file to the
created virtual disk file. There is no parent-child
relationship established however.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Example:
CREATE VDISK FILE="c:\test\test.vhd" MAXIMUM=1000
CREATE VDISK FILE="c:\test\child.vhd" PARENT="c:\test\test.vhd"
CREATE VDISK FILE="c:\test\test.vhd" MAXIMUM=1000 SD="D:P(A;;GA;;;WD)"
CREATE VDISK FILE="c:\test\new.vhd" SOURCE="c:\test\test.vhd" |
| 0x40002f54 | 7 | Selects the specified virtual disk by filename and shifts the focus to it.
Syntax: SELECT VDISK FILE=<"filename"> [NOERR]
FILE=<"filename">
Specifies the complete path and filename of an existing
virtual disk file.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Example:
SELECT VDISK FILE="c:\test\test.vhd" |
| 0x40002f55 | 78.1 | Attaches the specified virtual disk.
Syntax: ATTACH VDISK [NOERR] [READONLY] { [SD=] | [USEFILESD] }
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
READONLY Attaches the virtual disk as read-only. Any write operation
will return an input/output device error.
SD=
Specifies a security descriptor in the security descriptor
definition language (SDDL) format. By default the security
descriptor allows access like any physical disk. For more
information on the SDDL please see the CREATE VDISK command.
USEFILESD Specifies that the security descriptor on the virtual file
itself should be used on the virtual disk. If not specified,
the disk will not have an explicit security descriptor unless
specified with SD=(SDDL string).
A virtual disk must be selected for this operation to succeed.
Example:
ATTACH VDISK
ATTACH VDISK READONLY
ATTACH VDISK USEFILESD |
| 0x40002f58 | 78.1 | Displays a list of virtual disks.
Syntax: LIST VDISK
Displays a list of virtual disks and information about them. The disk type
is shown as Unknown until the disk is attached. The disk marked with an
asterisk (*) has focus.
Example:
LIST VDISK |
| 0x40002f59 | 78.1 | Compacts the virtual disk file to reduce the physical size of the file.
Compact operation can be performed on a detached EXPANDABLE virtual disk
or an EXPANDABLE virtual disk that is attached read only.
Syntax: COMPACT VDISK
A virtual disk must be selected for this operation to succeed.
Example:
COMPACT VDISK |
| 0x40002f5a | 78.1 | Merges a child disk with its parents.
Syntax: MERGE VDISK DEPTH=
DEPTH= Indicates the number of parents to merge together. For example,
MERGE=1 indicates one level of the differencing chain should be
merged.
A virtual disk must be selected for this operation to succeed.
Example:
MERGE VDISK DEPTH=1
In this example a child virtual disk is merged with its parent:
CREATE VDISK FILE="c:\vhd2.vhd" parent="c:\vhd1.vhd"
MERGE VDISK DEPTH=1 |
| 0x40002f5b | 78.1 | Expands the maximum size available on a virtual disk.
Syntax: EXPAND VDISK MAXIMUM=
MAXIMUM= Indicates the new virtual size of the disk in megabytes (MB).
A virtual disk must be selected for this operation to succeed.
Only detached disks can be expanded.
Example:
EXPAND VDISK MAXIMUM=20000 |
| 0x40002f01 | 8.1 | Creates a primary partition on the basic disk with focus.
Syntax: CREATE PARTITION PRIMARY [SIZE=] [OFFSET=] [ID={ | }]
[ALIGN=] [NOERR]
SIZE= The size of the partition in megabytes (MB). If no size is
given, the partition continues until there is no more
unallocated space in the current region.
OFFSET= The offset, in kilobytes (KB), at which the partition is created.
If no offset is given, the partition is placed in the first disk
extent that is large enough to hold it.
ID={ | }
Specifies the partition type.
Intended for Original Equipment Manufacturer (OEM) use only.
For master boot record (MBR) disks, you can specify a partition
type byte, in hexadecimal form, for the partition. If this
parameter is not specified for an MBR disk, the command creates
a partition of type 0x06 (specifies no file system is installed).
LDM data partition:
0x42
Recovery partition:
0x27
Recognized OEM Ids:
0x12
0x84
0xDE
0xFE
0xA0
For GUID partition table (GPT) disks you can specify a
partition type GUID for the partition you want to create.
Recognized GUIDs include:
EFI System partition:
c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Microsoft Reserved partition:
e3c9e316-0b5c-4db8-817d-f92df00215ae
Basic data partition:
ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
LDM Metadata partition on a dynamic disk:
5808c8aa-7e8f-42e0-85d2-e1e90434cfb3
LDM Data partition on a dynamic disk:
af9b60a0-1431-4f62-bc68-3311714a69ad
Recovery partition:
de94bba4-06d1-4d40-a16a-bfd50179d6ac
If this parameter is not specified for a GPT disk, the command
creates a basic data partition.
Any partition type byte or GUID can be specified with this
parameter. DiskPart does not check the partition type for
validity except to ensure that it is a byte in hexadecimal form
or a GUID.
Caution:
Creating partitions with this parameter might cause your
computer to fail or be unable to start up. Unless you are
an OEM or an IT professional experienced with GPT disks, do
not create partitions on GPT disks using this parameter.
Instead, always use the CREATE PARTITION EFI command to
create EFI System partitions, the CREATE PARTITION MSR
command to create Microsoft Reserved partitions, and the
CREATE PARTITION PRIMARY command without this parameter to
create primary partitions on GPT disks.
ALIGN= Typically used with hardware RAID Logical Unit Number (LUN)
arrays to improve performance. The partition offset will be
a multiple of . If the OFFSET parameter is specified, it
will be rounded to the closest multiple of .
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
After you create the partition, the focus automatically shifts to the new
partition. The partition does not receive a drive letter. You must use the
assign command to assign a drive letter to the partition.
A basic disk must be selected for this operation to succeed.
If a partition type is not specified, the disk is uninitialized and disk
size is greater than 2TB, it will be initialized to GPT.
Example:
CREATE PARTITION PRIMARY SIZE=1000
CREATE PARTITION PRIMARY SIZE=128 ID=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
CREATE PARTITION PRIMARY SIZE=10000 ID=12
CREATE PARTITION PRIMARY SIZE=10000 ID=DE |
| 0x40002f44 | 8.1 | Displays or sets the SAN policy for the operating system.
Syntax: SAN [POLICY={OnlineAll | OfflineAll | OfflineShared | OfflineInternal}] [NOERR]
SAN If the command is given with no parameters, the current
SAN policy is displayed.
POLICY= Sets the SAN policy for the currently booted operating
system.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
This command allows the user to display or change the SAN policy for the
currently booted OS. The default policy for Windows Advanced Server and
Windows Data Center is OfflineShared. In this case the boot disk will
be brought online, as will all disks that are not located on a shared bus
such as SCSI, iSCSI, SAS, etc. The offlined disks will be read-only by
default. On all other versions of Windows, the default will be to bring
all disks online. In this case, the disks will be online and read/write.
The third policy value is OfflineAll. For this case, all disks except the
boot disk will be offline and read-only by default. The forth policy value
is OfflineInternal and the default is to keep newly discovered internal
disks offline and read-only.
Examples:
SAN
SAN POLICY=OfflineAll |
| 0x40002f53 | 8.1 | Creates a virtual disk file. Currently only VHD and VHDX format files are
supported and are specified through the file extensions (.vhd and .vhdx)
of the virtual disk file.
Syntax: CREATE VDISK FILE=<"filename"> MAXIMUM= [TYPE={FIXED|EXPANDABLE}]
[SD=] [PARENT=<"filename">] [SOURCE=<"filename">]
[NOERR]
FILE=<"filename">
Specifies the complete path and filename of the virtual disk
file. The file may be on a network share.
MAXIMUM= The maximum amount of space exposed by the virtual disk, in
megabytes (MB).
TYPE={FIXED|EXPANDABLE}
FIXED specifies a fixed size virtual disk file. EXPANDABLE
specifies a virtual disk file that resizes to accommodate
the allocated data. The default is FIXED.
[SD=]
Specifies a security descriptor in the security descriptor
definition language (SDDL) format. By default the security
descriptor is taken from the parent directory.
SDDL strings can be complex but flexible. In its simplest
form, a security descriptor that protects access, is known as
a discretionary access control list (DACL). It is of the form:
D:()()...()
Common DACL_FLAGS are:
"P" - The DACL should not be overiden
(protected) by any ACLs from parent containers.
The container for a VHD or VHDX file is its
directory.
"AI"- The DACL should auto-inherit from the parent
container.
STRING_ACEs are of the form
;;;;;
Common ACE_TYPEs are:
"A" - Allow access.
"D" - Deny access.
Common RIGHTS are:
"GA" - All access.
"GR" - Read access.
"GW' - Write access.
Common ACCOUNT_IDs are:
"BA" - Built in administrators
"AU" - Authenticated users.
"CO" - Creator owner.
"WD" - Everyone.
Putting all this together, for example,
D:P:(A;;GR;;;AU)
gives read-access to all authenticated users.
Similarly,
D:P:(A;;GA;;;WD)
Gives everyone full access.
Further information on the SDDL can be found
on Microsoft's MSDN website.
[PARENT=<"filename">]
Path to an existing parent virtual disk file to create a
differencing disk. With the PARENT parameter, MAXIMUM should
not be specified because the differencing disk gets the size
from its parent. Also, TYPE should not be specified since only
EXPANDABLE differencing disks can be created.
[SOURCE=<"filename">]
Path to an existing virtual disk file to be used to
pre-populate the new virtual disk file. When SOURCE is
specified, data from the input virtual disk file is copied
block for block from the input virtual disk file to the
created virtual disk file. There is no parent-child
relationship established however.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Example:
CREATE VDISK FILE="c:\test\test.vhd" MAXIMUM=1000
CREATE VDISK FILE="c:\test\child.vhdx" PARENT="c:\test\test.vhdx"
CREATE VDISK FILE="c:\test\test.vhd" MAXIMUM=1000 SD="D:P(A;;GA;;;WD)"
CREATE VDISK FILE="c:\test\new.vhdx" SOURCE="c:\test\test.vhd" |
| 0x40002f54 | 8.1 | Selects the specified virtual disk by filename and shifts the focus to it.
Syntax: SELECT VDISK FILE=<"filename"> [NOERR]
FILE=<"filename">
Specifies the complete path and filename of an existing
virtual disk file.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Example:
SELECT VDISK FILE="c:\test\test.vhd"
SELECT VDISK FILE="c:\test\test.vhdx" NOERR |