Windows Command Prompt- A to N by Prometheus MMS - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

DISKPART COMMANDS

 

Microsoft DiskPart version 6.3.9600

 

Copyright (C) 1999-2013 Microsoft Corporation.

On computer: XMEN

 

Microsoft DiskPart syntax:

        diskpart [/s <script>] [/?]

 

        /s <script> - Use a DiskPart script.

        /?          - Show this help screen.

 

 

 

HELP:

DISKPART> help

 

Microsoft DiskPart version 6.3.9600

 

ACTIVE      - Mark the selected partition as active.

ADD         - Add a mirror to a simple volume.

ASSIGN      - Assign a drive letter or mount point to the selected volume.

ATTRIBUTES  - Manipulate volume or disk attributes.

ATTACH      - Attaches a virtual disk file.

AUTOMOUNT   - Enable and disable automatic mounting of basic volumes.

BREAK       - Break a mirror set.

CLEAN       - Clear the configuration information, or all information, off the

              disk.

COMPACT     - Attempts to reduce the physical size of the file.

CONVERT     - Convert between different disk formats.

CREATE      - Create a volume, partition or virtual disk.

DELETE      - Delete an object.

DETAIL      - Provide details about an object.

DETACH      - Detaches a virtual disk file.

EXIT        - Exit DiskPart.

EXTEND      - Extend a volume.

EXPAND      - Expands the maximum size available on a virtual disk.

FILESYSTEMS - Display current and supported file systems on the volume.

FORMAT      - Format the volume or partition.

GPT         - Assign attributes to the selected GPT partition.

HELP        - Display a list of commands.

IMPORT      - Import a disk group.

INACTIVE    - Mark the selected partition as inactive.

LIST        - Display a list of objects.

MERGE       - Merges a child disk with its parents.

ONLINE      - Online an object that is currently marked as offline.

OFFLINE     - Offline an object that is currently marked as online.

RECOVER     - Refreshes the state of all disks in the selected pack.

              Attempts recovery on disks in the invalid pack, and

              resynchronizes mirrored volumes and RAID5 volumes

              that have stale plex or parity data.

REM         - Does nothing. This is used to comment scripts.

REMOVE      - Remove a drive letter or mount point assignment.

REPAIR      - Repair a RAID-5 volume with a failed member.

RESCAN      - Rescan the computer looking for disks and volumes.

RETAIN      - Place a retained partition under a simple volume.

SAN         - Display or set the SAN policy for the currently booted OS.

SELECT      - Shift the focus to an object.

SETID       - Change the partition type.

SHRINK      - Reduce the size of the selected volume.

UNIQUEID    - Displays or sets the GUID partition table (GPT) identifier or

              master boot record (MBR) signature of a disk.

 

 

ACTIVE:

DISKPART> ACTIVE

 

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

 

 

ADD:

DISKPART>ADD

 

Mirrors the simple volume with focus to the specified disk.

 

Syntax:  ADD DISK=<N> [ALIGN=<N>] [WAIT] [NOERR]

 

    DISK=<N>    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=<N>   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>.

 

    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

 

 

ASSIGN:

DISKPART>  ASSIGN

 

    Assigns a drive letter or mounted folder pathname to the volume with focus.

 

Syntax:  ASSIGN [LETTER=<D> | MOUNT=<PATH>] [NOERR]

 

    LETTER=<D>  The drive letter to assign to the volume.

 

    MOUNT=<PATH>

 

                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

 

 

ATTRIBUTES:

DISKPART> ATTRIBUTES

 

Microsoft DiskPart version 6.3.9600

 

VOLUME      - Manipulate volume attributes.

DISK        - Manipulate disk attributes.

 

 

ATTACH:

DISKPART> ATTACH

 

Microsoft DiskPart version 6.3.9600

 

VDISK       - Attaches a virtual disk file.

 

 

AUTOMOUNT:

DISKPART> AUTOMOUNT

 

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

 

 

BREAK:

DISKPART> BREAK

 

Breaks the mirrored volume with focus into two simple volumes.

 

Syntax:  BREAK DISK=<N> [NOKEEP] [NOERR]

 

    DISK=<N>    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 <N> are converted

                to free  space. Neither the remaining copy of the mirror

                volume, nor the free space on disk <N> 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

 

 

CLEAN:

DISKPART> CLEAN

 

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

 

 

COMPACT:

DISKPART> COMPACT

 

Microsoft DiskPart version 6.3.9600

 

VDISK       - Attempts to reduce the physical size of the file.

 

 

CONVERT:

DISKPART> CONVERT

 

Microsoft DiskPart version 6.3.9600

 

BASIC       - Convert a disk from dynamic to basic.

DYNAMIC     - Convert a disk from basic to dynamic.

GPT         - Convert a disk from MBR to GPT.

MBR         - Convert a disk from GPT to MBR.

 

 

CREATE:

DISKPART> CREATE

 

Microsoft DiskPart version 6.3.9600

 

PARTITION   - Create a partition.

VOLUME      - Create a volume.

VDISK       - Creates a virtual disk file.

 

 

DELETE:

DISKPART>DELETE

 

Microsoft DiskPart version 6.3.9600

 

DISK        - Delete a missing disk from the disk list.

PARTITION   - Delete the selected partition.

VOLUME      - Delete the selected volume.

 

 

DETAIL:

DISKPART> DETAIL

 

Microsoft DiskPart version 6.3.9600

 

DISK        - Display the properties of the selected disk.

PARTITION   - Display the properties of the selected partition.

VOLUME      - Display the properties of the selected volume.

VDISK       - Displays the properties of the selected virtual disk.

 

 

DETACH :

DISKPART> DETACH

 

Microsoft DiskPart version 6.3.9600

 

VDISK       - Detaches a virtual disk file.

 

 

EXIT

DISKPART> EXIT

 

Exits the DiskPart command interpreter.

 

Syntax:  EXIT

 

Example:

 

    EXIT

 

 

EXTEND:

DISKPART>EXTEND

 

Extends the volume or partition with focus, and its file system, into free

    (unallocated) space on a disk.

 

Syntax:  EXTEND [SIZE=<N>] [DISK=<N>] [NOERR]

        EXTEND FILESYSTEM [NOERR]

 

    SIZE=<N>    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=<N>    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

 

 

EXPAND:

DISKPART>EXPAND

 

Microsoft DiskPart version 6.3.9600

 

VDISK       - Expands the maximum size available on a virtual disk.

 

 

FILEYSTEMS:

DISKPART> FILESYSTEMS

 

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

 

 

FORMAT:

DISKPART> FORMAT

 

Formats the specified volume for use with Windows.

 

Syntax:  FORMAT [[FS=<FS>] [REVISION=<X.XX>] | RECOMMENDED] [LABEL=<"label">]

                [UNIT=<N>] [QUICK] [COMPRESS] [OVERRIDE] [DUPLICATE] [NOWAIT]

                [NOERR]

 

    FS=<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=<X.XX>

 

                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=<N>    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

 

 

GPT:

DISKPART> GPT

 

On basic GUID partition table (GPT) disks, assigns the GPT attribute(s) to

    the partition with focus.

 

Syntax:  GPT ATTRIBUTES=<N>

 

    ATTRIBUTES=<N>

 

                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.

 

       ?