Using Disk Management and Diskpart to Mange Disks in Windows 7

Before you start

Objectives: Learn how to manage disks in Windows 7 using Disk Management console and Diskpart command line tool.

Prerequisites: you have to know the difference between the basic and dynamic disk, what is partition or volume, and what is file system.

Key terms: disk, volume, space, create, partition, command, management, volume, mb, dynamic


Create Simple Volume using Disk Management

To open Disk Management console, we can  right-click Computer and select the Manage option. Then we will go to the Disk Management section. We can also type “compmgmt.msc” in search to open the same management console.

 Initialization

Initialization

For the purpose of this demo we have added a new disk to the system which is 512 MB in size. This disk is completely new, and the space on it is unallocated. Because of that, when we opened Disk Management we got a prompt to initialize that disk. We have to do that before Logical Disk Manager can access it. In our case we will select the MBR partition style and click OK. When we do that, notice that the status of the disk changed to Basic and Online. Notice however that the disk is still unallocated.

 Disk 1

Disk 1

To create a new volume on the disk, we can right-click it and select the appropriate option. In this example we will right-click on the unallocated space on our new Disk 1, select the “New Simple Volume” option and click next. The first thing we have to do is to specify the volume size. In our case we will use 256 MB.

 Volume Size

Volume Size

On the next screen we have to choose the drive letter. We will use letter E.

 Drive Letter

Drive Letter

On the next screen we will choose the NTFS file system and type in the volume name. We will perform a quick format.

 Format Partition

Format Options

When we click Next and then Finish, we will see our new volume in the Disk Management Console.

 Simple Volume

Simple Volume

Now, let’s add additional disks to the system to perform more advanced disk management. We will add two more disks, each having 512 MB of free space. Those two new disks have never been used before so we have to initialize them before we can use them. To initialize disk, we can right click on the disk name and select the Initialize Disk option.

 Initialize Disk 2

Initialize Disk 2

If we want, we can now extend or shrink our simple volumes. In our case we will right-clickSimpleVolume, select the “Extend Volume” option, and then click Next. We will get a list of all disks on our system. Notice that the Disk 1 is already selected.

 Select Disks

Amount of Space

If we extend our volume by using free space from the same disk, our disk can remain a Basic disk. If we choose some other physical disk, we will have to convert our disks to the Dynamic ones. We have to do the conversion because when we use multiple disks, we are actually creating a Spanned volume. As you should already know, Spanned volumes can not be created on Basic disks. So, when we try to select multiple disks in this case, we will get a warning about the conversion to Dynamic disks.

 Dynamic Disk Conversion Warning

Dynamic Disk Warning

If we choose to extend our volume, we will be able to do that without the conversion to Dynamic disk. In our case we will extend our volume with the remaining space on our Disk 1, which is 253 MB in our case. Our volume now has 509 MB in total.

 Disk 1 Extended

Disk 1 Extended

Create Simple Volume using Diskpart

We can do the same thing with Diskpart command line tool. We will open elevated (with administrative privileges) CMD. To do that, simply right-click it and select the “Run as administrator” option. Next, we will enter diskpart tool and list all disks that are available on our system (all commands are highlighted).

 Diskpart

Diskpart

Notice that we have 4 disks available, and notice that all of them are initialized (status is online). The next thing we will try to do is create a simple volume on Disk 2. First we have to select the disk and then enter the appropriate command. To select the disk we will enter: select disk 2. To create a simple volume with the size of 256 MB we will enter the command: create partition primary size=256.

 Create Partition

Create Partition

The next thing we have to do is format the partition and assign a drive letter to it. In order to do that we first have to select the appropriate partition on the already selected disk. First we will list all partitions by using the list partition command. Notice that we only have one partition on our disk so we will select it by using the select partition 1 command. When we select the partition, we will format it by using theformat fs=ntfs label=SimpleDiskpartVolume quick command. So, the file system will be NTFS, the label will be SimpleDiskpartVolume and we will do a quick format. After that we will assign a drive letter F by using the assign letter=F command.

 Formating Partition

Format Partition

And that’s it. Our partition is now ready to use. To leave Diskpart we can enter the exit command.

Working With Dynamic Disks using Disk Management

For the purpose of this demo we will delete all simple volumes that we created up to now and convert our disks to dynamic disks. To do that we can right-click on some disk and select the “Convert to Dynamic Disk” option. After that, let’s create a Striped volume by using two available hard disks. We will right-click on unallocated space on Disk 1 and select the “New Striped Volume” option. In our case we will use Disk 1 and Disk 2, and the amount of space will be 256 MB.

 Striped Volume

Amount of Space on Striped Volume

Drive letter will be E again, we will use NTFS file system and perform a quick format. Our disks now look like this. Notice that we have one striped volume across two hard drives. This is actually software RAID

 15 List of Volumes

Volumes

In the similar way we can create a spanned volume as well. We will right click unallocated space on Disk 1 and select the “New Spanned Volume” option. We will use remaining space from Disk 1 and Disk 2. Our disks now look like this.

 Spanned Volume

Volumes 2

Let’s now create a mirrored volume. As you should know, we have to have two disks available in order to create this type of volume. We have only one disk left so we will delete our spanned volume for now. Now, we will select the mirrored volume from the remaining space on Disk 2 and the free space on Disk 3. Notice that we have to have the same amount of space on both disks. We could not use the whole 512 MB from Disk 3 since we only have 255 MB available on Disk 2. Our disks now look like this (mirrored volume is red).

 Mirrored Volume

Volumes 3

Mirrored volume is fault tolerant. The same information is written to both disks at the same time. That way if one of the disks dies, we have another one with the same data. Also remember that we can only have two disks in a mirrored volume. In contrast, striped volume can have more disks.

Now let’s simulate a hard drive failure. Let’s right click on Disk 2 and select the Offline option. Now let’s see the statuses of our disks. Notice that for mirrored volume the status is “Failed Redundancy”. That means that the data only exists on one disk and the other one doesn’t contain the duplicates. However, we can still access data on that volume. On the other hand, striped volume failed completely and we can’t access data on that volume any more.

 Disk Failure

Disk Failure

As we can see, one failed disk can cause a lot of damage. Remember that it is always recommended to use the hardware RAID device instead of software RAID, as we did here in this demo. If you use software RAID, always make sure you have a proper backup set up.