All Lessons

Disk management cmd

One of the basic principles followed by the developers of Windows Server 2008 is the ability to manage many components of the operating system from the command line. If you need to create a RAID array, as a rule, this is most easily done using the disk management console, but this is on condition that you need to perform such an operation on a single machine, and this machine has a GUI interface. If you need to perform these actions on multiple machines, it is better to write a script (script) for this purpose. In addition, if you use Server Core 2008 in your environment, you may have no choice but to manage the disk subsystem from the command line.

Diskpart Team


Windows Server 2008 contains the Diskpart.exe command line utility, which allows you to manage the server disk subsystem from the command line. To use this command, simply open a command prompt window and enter the Diskpart.exe command. After that you will be taken to the Diskpart command shell. From here you can run various commands to control the disk subsystem.

diskpart commant line

Diskpart command syntax


A typical Diskpart command consists of a verb and a noun. The verb says what actions to perform, and the noun indicates the object with which you want to perform the action. One of the simplest examples of Diskpart commands is the List Disk command. In this example, List is a verb, and Disk is a noun. After entering this command, Windows will display a list of all physical disks installed on the server.

Command diskpart: list disk

Pay attention to the above picture, it shows that each disk is assigned a number. If you need to perform operations with a specific disk, you must specify the disk by entering the Select command. For example, to perform an operation with disk 0, you need to type Select Disk 0.

In many cases, disk management includes the creation of fault-tolerant volumes, and you can easily create them using the Diskpart command. For example, your system has 4 hard drives, and these hard drives are numbered 0, 1, 2, and 3. We also assume that drive 0 is our system drive, and drives 1, 2, and 3 are empty hard drives that we want turn in RAID 5 volume.

Before we can create a RAID 5 volume, we need to make sure that each of the disks is connected as a dynamic disk. If you look at the picture, you can see that the List Disk command displays whether the disk is dynamic or not. Assuming that none of the disks are dynamic, you can convert them from basic to dynamic by entering the following commands:

Select Disk 1
Convert dynamic
Select Disk 2
Convert dynamic
Select Disk 3
Convert dynamic
Now that we have converted our drives, we can create a RAID 5 volume by entering the following commands:

Select Disk 1
Create Volume RAID Disk 1, 2, 3
By entering the List Volume command, you will verify that the RAID volume has been created. Please note that each volume is assigned a number.

Team Diskpart List Volume

The last thing we have to do is format the volume and assign it a letter. You can do this by typing the following commands:

Select volume 2
Format FS = NTFS Label = MyNewVolume
Assign Letter = F
Using the List Volume command, you can make sure that the volume is formatted and a letter is assigned to it. Finally, enter the Exit command to exit the Diskpart shell.

Related Articles

Back to top button