| diskpart | new in WS2003 | 
from the command line.
Syntax
diskpart
diskpart /s script
Options
- None
 Enters interactive mode and displays the
 DISKPART> prompt, waiting for you to enter
 diskpart commands
- /s
 Specifies a script containing a series of diskpart
 commands to execute sequentially
Commands
The following is a summary of diskpart commands
that can be used either interactively or in scripts. Note that each
command has its own unique syntax, which is summarized briefly.
- active
 Marks the selected basic partition as active.
- add disk=N
 Adds the specified disk as a mirror to the selected simple volume.
- assign {letter=D | mount=path}
 Assigns the specified drive letter or mount point to the selected
 volume. If assign is used alone, the next
 available drive letter is used. Does not work with system/boot
 volumes or volumes where a paging file resides.
- automount [enable | disable]
 Enables and disables automatic mounting of basic volumes.
 Automounting is enabled by default and should be disabled only for
 storage area networks.
- break disk=N [nokeep]
 Breaks a mirror set into two simple volumes and changes the focus to
 the specified volume so you can assign it a drive letter. The
 nokeep option causes the mirrored volume to be
 converted to free space instead.
- clean [all]
 Deletes the configuration information from the selected disk by
 overwriting the MBR. The all option sets every
 sector to zero to delete all data on the disk.
- convert basic
 Converts a dynamic disk to basic (must delete all volumes first).
- convert dynamic
 Converts a basic disk to dynamic.
- create partition primary [size=N]
 Creates a primary partition of size N
 megabytes and shifts focus to the new partition (if no size is
 specified, the partition is as large as possible).
- create partition extended [size=N]
 Creates an extended partition of size N
 megabytes and shifts focus to the new partition (if no size is
 specified, the partition is as large as possible).
- create partition logical [size=N]
 Creates a logical drive of size N
 megabytes within the extended partition and shifts focus to the new
 logical drive (if no size is specified, the partition is as large as
 possible).
- create volume raid [size=N] disk=N,N,N[,N,...]
 Creates a RAID-5 volume from simple volumes of size
 N megabytes on the specified dynamic
 disks. If no size is specified, the largest possible volume size is
 used. After the RAID-5 volume is created, it assumes the focus.
- create volume simple [size=N] [disk=N]
 Creates a simple volume of size N
 megabytes on the specified dynamic disk. If no size is specified, the
 partition is as large as possible, and if no disk is specified, the
 currently selected disk is used. After the volume is created, it
 assumes the focus.
- create volume stripe [size=N] disk=N,N[,N,...]
 Creates a striped volume from simple volumes of size
 N megabytes on the specified dynamic
 disks. If no size is specified, the largest possible volume size will
 be used. After the striped volume is created, it assumes the focus.
- delete disk [override]
 Deletes a missing dynamic disk from the disk list. The
 override option deletes all simple volumes on the
 disk but doesn't work if the disk is part of a
 RAID-5 volume.
- delete partition [override]
 Deletes the selected partition on a basic disk. The
 override option deletes nonstandard partitions.
- delete volume
 Deletes the selected volume (won't work for
 system/boot volumes or volumes containing the pagefile).
- detail {disk | partition | volume}
 Displays properties of disk, partition, or volume.
- exit
 Exits diskpart when running in interactive mode.
- extend [size=N]
 Extends the selected partition on a basic disk using adjacent
 contiguous free space (if any) from the disk on which the partition
 resides.
- extend [size=N] disk=N
 Extends the selected volume on a dynamic disk using contiguous free
 space on the specified dynamic disk.
- import
 Imports every disk that belongs to the foreign disk group to which
 the currently selected disk belongs.
- inactive
 Marks the current basic partition as inactive.
- list {disk | partition | volume}
 Lists the disks on the local machine or the partitions/volumes on the
 currently selected disk. If volume option is used
 with basic disks, logical volumes are displayed instead.
- online
 Brings online a disk that is currently marked offline.
- rem
 Used to comment scripts.
- remove {letter=D | mount=path | all} [dismount]
 Removes the specified drive letter or mount point assignment or all
 drive letters and mount points. The dismount
 option closes all handles to the partition or volume before
 dismounting it. Does not work with system/boot volumes or volumes on
 which the pagefile resides.
- repair disk=N
 Repairs a failed disk on a RAID-5 volume using the specified disk.
- rescan
 Rescans the computer looking for new disks and volumes that may have
 been added.
- retain
 Prepares a simple volume to be used as a system/boot volume during
 unattended Setup.
- select disk=N
 Changes the focus of diskpart to the specified
 disk.
- select partition=N
 Changes the focus of diskpart to the specified
 partition.
- select volume=N
 Changes the focus of diskpart to the specified
 volume.
Examples
Run diskpart interactively:
diskpart
Microsoft DiskPart version 5.2.3763
Copyright (C) 1999-2001 Microsoft Corporation.
On computer: ESRV210D
DISKPART>
List the fixed disks on the computer:
list disk
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 37 GB 27 GB
Select disk 0 to give it the focus for further
diskpart commands:
select disk=0
Disk 0 is now the selected disk.
List the partitions on the selected basic disk:
list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Primary 10 GB 32 KB
Partition 2 Primary 502 MB 10 GB
List the logical volumes on the selected basic disk:
list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -----
Volume 0 D CD-ROM 0 B Healthy
Volume 1 C NTFS Partition 10 GB Healthy System
Volume 2 E New Volume NTFS Partition 502 MB Healthy
Note that the CD-ROM drive shows up as a logical volume because it
has a drive letter assigned. Note also that volume 1 is the system
volume.Create a new primary partition 2 GB in size:
create partition primary size=2048
DiskPart succeeded in creating the specified partition.
Verify the result:
list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -----
Volume 0 D CD-ROM 0 B Healthy
Volume 1 C NTFS Partition 10 GB Healthy System
Volume 2 E New Volume NTFS Partition 502 MB Healthy
* Volume 3 RAW Partition 2055 MB Healthy
The asterisk beside volume 3 indicates that this newly created volume
has the focus. Note also that volume 3 has no drive letter assigned,
so let's assign one to it:
assign letter=G
DiskPart successfully assigned the drive letter or mount point.
Verify:
list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -----
Volume 0 D CD-ROM 0 B Healthy
Volume 1 C NTFS Partition 10 GB Healthy System
Volume 2 E New Volume NTFS Partition 502 MB Healthy
* Volume 3 G RAW Partition 2055 MB Healthy
Change the focus to volume 2 so it can be deleted:
select volume=2
Volume 2 is the selected volume.
delete volume
DiskPart successfully deleted the volume.
Verify:
list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -----
Volume 0 D CD-ROM 0 B Healthy
Volume 1 C NTFS Partition 10 GB Healthy System
Volume 3 G RAW Partition 2055 MB Healthy
Now no volume has the focus, so let's select volume
3 and extend it 1 GB:
select volume 3
Volume 3 is the selected volume.
extend size=1024
DiskPart successfully extended the volume.
Verify:
list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -----
Volume 0 D CD-ROM 0 B Healthy
Volume 1 C NTFS Partition 10 GB Healthy System
* Volume 3 G RAW Partition 3083 MB Healthy
Display properties of selected volume:
detail volume
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
* Disk 0 Online 37 GB 24 GB
Display properties of selected disk:
detail disk
MAXTOR 6L040J2
Disk ID: C95AC95A
Type : ATA
Bus : 0
Target : 0
LUN ID : 0
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -----
Volume 1 C NTFS Partition 10 GB Healthy System
* Volume 3 G RAW Partition 3083 MB Healthy
Quit diskpart interactive mode:
exit
Leaving DiskPart...
C:\>
Notes
- When running diskpart commands from a script, you
 can redirect the output to a text file to view later by:diskpart /s script > file.txt 
- If you use more than one script with diskpart in a
 batch file, add timeout /t
 15 before each diskpart
 /s script command to ensure the first tasks are
 completed before the next tasks are begun.
- If an error occurs while running a diskpart
 command, the task stops, and an error code is displayed. If you add a
 noerr option to the command, the command is
 processed as if the error never occurred. diskpart
 error codes are as follows:- 0
 No errors. The script ran successfully.
- 1
 Fatal exception.
- 2
 Incorrect parameters for the diskpart command.
- 3
 Unable to open the specified script or output file.
- 4
 A service has returned an error.
- 5
 Invalid command syntax.
 
See Also
chkdsk, chkntfs,
convert, defrag,
Disks , format,
label, mountvol
 لطفا منتظر باشید ...
        لطفا منتظر باشید ...
     
                     
                
                 
            
            
 Publisher
Publisher