Diskpart Command
Posted on November 2, 2007
Due to recent office work requirement, I have learned a new [tag]Microsoft[/tag] [tag]Windows[/tag] command line utilities - [tag]Diskpart[/tag] is a command-line interpreter designed as a disk management tool and utility to enable storage configuration from a script, a remote session, or another command prompt. Diskpart differs from many command-line utilities because it does not operate in a single-line mode. Instead, after you start the utility, the commands are read from standard input/output (I/O). You can direct these commands to any disk, partition, or volume.
My advise is to backup your existing hard disk drive data or use an empty hard disk for any further testing if you are not familiar with the diskpart command. Else you may screw up your own hard disk drive data. However this command tools really help me a lot on the Windows script file for automation stuffs.
For an example:
To CREATE a partition:
Open a command prompt, type: Diskpart
At the DISKPART prompt, type: LIST DISK
(Lists disks found, record the drive number)
At the DISKPART prompt, type: Select Disk n
(This selects the disk; make sure to type in the disk number from step above.)
At the DISKPART prompt, type: CREATE PARTITION PRIMARY SIZE=10000
(Change the word PRIMARY to EXTENDED to create an extended partition.) (If you do not set a size (in MB), such as the above example for 10 GB, then all available space on the disk will be used for the partition.) (Seriously consider adding the following option to the end of the above command if you are using RAID (especially RAID 5) to improve disk I/O performance: ALIGN=64)
At the DISKPART prompt, type: ASSIGN LETTER=D
(Choose a drive letter not already being used.)
At the DISKPART prompt, type: Exit
Done!
To DELETE a partition:
Open a command prompt, type: Diskpart
At the DISKPART prompt, type: LIST DISK
(Lists disks found, record the drive number)
At the DISKPART prompt, type: Select Disk x
(This selects the disk; make sure to type in the disk number from step above.)
At the DISKPART prompt, type: LIST PARTITION
(Make note of the number of the partition that you want to delete)
At the DISKPART prompt, type: SELECT PARTITION n
(Select the partition nthat you want to delete)
At the DISKPART prompt, type: DELETE PARTITION
At the DISKPART prompt, type: Exit
Done!
To extend a partition:
Verify that free space is available on the same drive and that free space is next to the partition you intend on extending (make sure no partitions in between).
At a command prompt, type: Diskpart
At the DISKPART prompt, type: Select Disk 1
(Selects the disk.)
At the DISKPART prompt, type: Select Volume 1
(Selects the volume.)
At the DISKPART prompt, type: Extend Size=20000
(If you do not set a size, such as the above example for 20 GB, then all available space on the disk will be used.)
At the DISKPART prompt, type: Exit
Done!
They are few more command such as: select volume, detail disk, detail partition, detail volume, list volume and etc.
Please refer here for more useful guide.
Possibly Related Posts:
- Argument list too long
- RSS Feed Submissions
- Geo Positions
- Interesting about Google Suggest
- Setup a Linux Highly Availability NFS servers
Comments
One Response to “Diskpart Command”
Leave a Reply
nice guide…
additional info:
if you need to extend the system partition. you need to mount the disk on the third party OS. only then you can extend the partition without damaging any original data on the disk. same to do with the virtual drive