Build a mirrored volume on Windows Server 2008 r2

Original author: Neil Smyth
  • Transfer
  • Tutorial

Disk Mirroring Overview (RAID 1)

When using a mirrored raid array, two identical volumes are located on two different physical disks. Any data recorded in the mirrored volume is actually written to both disks, so that if one of the disks fails, the data is available on the second. Unlike stripe, when I / O speed increases due to the distribution of one logical volume across several physical disks and parallel block write / read, mirroring reduces performance due to the fact that all data write transactions are duplicated to each disk in the array.

Mirroring (RAID 1) Using Disk Management

To create a mirrored disk array, disks must be converted from normal to dynamic. In this section we will analyze the possibility of creating a “mirror” from two identical hard drives in Windows 2008.

To do this, run “Disk Management”. This can be done from the command line by executing the compmgmt.msc command or from the Start menu by choosing Storage -> Disk Management.
In our example, the system contains 3 disks, numbered 0, 1, and 2, respectively. Disk 0 is a system disk 1 and 2 will be used to create a “mirror”.
In "Disk Management", right-click on the unallocated area in the graphic display of the first disk used for the mirrored volume. Select “New Mirrored Volume ...” to launch the Create New Mirrored Volume Wizard. By clicking “Next” on the welcome screen, you will be taken to the drive selection window. As mentioned earlier, a mirrored array should consist of two disks. In the “Selected” column, the wizard displays only the currently selected drive. Continuation requires more than one drive. To add a disk to the mirrored volume, select the second disk from the available disks in the left column and click "Add":

After selecting drives, click Next to create and assign a drive letter or mount point to it. The "Next" button will display the "Format Volume" window, where you can select the type of file system and the ability to compress. To display the summary information about the operation being performed, click Next. To confirm the operation, click "Finish"; formatting volumes and creating a mirrored volume ready for use will be performed.

If you use only two disks, you can get the following picture:

And to get rid of the reserved area, which is present on only one disk, we will do the following:
Run the command with administrative privileges
bcdboot c: \ windows / sc:

This command creates a system partition. More information on using bcdboot is on the Microsoft technical site .
After receiving the message “Boot files successfully created.” Go to disk management and mark the C: partition as active. After that, reboot and delete this volume using "Disk Management"

Creating a mirrored (RAID 1) array on the command line

You can also create a mirrored volume from the command line using the diskpart application. It can be launched from an open command prompt window or from Start by typing “diskpart” on the line. The DISKPART> prompt that appears indicates that diskpart is up and running.
First of all, we find out which drives are connected to the server. This information can be found using the “list disk” command:
DISKPART> list disk
  Disk ### Status Size Free Dyn Gpt
  -------- ---------- ------- ------- --- ---
  Disk 0 Online 30 GB 0 B
  Disk 1 Online 8 GB 8189 MB
  Disk 2 Online 8 GB 8189 MB

As an example, we will combine disks 1 and 2 into a mirrored volume. To do this, first create a simple volume on the first disk and add a second disk for mirroring.
The first volume is created using the "create volume" command and the "disk =" parameter. The size of the volume can be set with the additional parameter “size =”. Without this option, diskpart will create a volume the size of all available disk space. For instance:
DISKPART> create volume simple disk = 1

The first volume has been created and now we add disk 2 as a mirrored volume. To do this, a simple command is executed:
add disk = 2

To check the new configuration, use the list volume command:
DISKPART> list volume
  Volume ### Ltr Label Fs Type Size Status Info
  ---------- --- ----------- ----- ---------- ------- ---- ----- --------
  Volume 0 C NTFS Partition 30 GB Healthy System
* Volume 1 RAW Mirror 8189 MB Healthy

As you can see, the new volume is displayed as “Volume 1” with type “Mirror”. “RAW” is specified as the file system because the file system has not yet been formatted. This can be done using the same diskpart application:
DISKPART> select volume 1
DISKPART> format fs = ntfs label = "Mirrored Volume"
  100 percent completed
DiskPart successfully formatted the volume.

After formatting is completed, assign a literal value or mount point to it:
Assign a literal value:
DISKPART> assign letter = E:
DiskPart successfully assigned the drive letter or mount point.

Assign mount point:
DISKPART> assign mount = \ MIRROR
DiskPart successfully assigned the drive letter or mount point.

After all operations have completed successfully, the new mirrored volume is ready for use.

Adding a mirrored volume to an existing one

You can create a mirrored raid array by adding a volume to an existing one using disk management or diskpart from the command line. When adding a mirror to an existing volume, Windows creates a second volume of the same size and type of file system on the second disk and copies (this process is also called synchronization) data to the mirror.
To mirror an existing volume in disk management, right-click on the volume and select “Add Mirror” to open the add mirror dialog:

The window above displays the mirrors available for mirroring. Select the desired drive and click "Next". A warning may appear if additional steps are required (for example, converting a regular disk to a dynamic one). Click Yes. The synchronization process will begin and the execution status will be displayed graphically.
To do the same from the command line, start diskpart and check for the required volumes with the command:
DISKPART> list volume
  Volume ### Ltr Label Fs Type Size Status Info
  ---------- --- ----------- ----- ---------- ------- ---- ----- --------
  Volume 0 C NTFS Partition 30 GB Healthy System
  Volume 1 E My Volume NTFS Partition 8189 MB Healthy

Let's analyze the possibility of mirroring the volume “Volume 1”. The disk where mirroring will be configured can be seen with the “list disk” command:
DISKPART> list disk
  Disk ### Status Size Free Dyn Gpt
  -------- ---------- ------- ------- --- ---
  Disk 0 Online 30 GB 0 B
* Disk 1 Online 8 GB 0 B
  Disk 2 Online 8 GB 8189 MB

It was seen above that Volume 1 is 8GB in size. Thus, to mirror it, you will need a disk with a size of at least 8GB. Note that if the disks are not dynamic, they will need to be converted using the commands:
select disk 1
convert dynamic
select disk 2
convert dynamic

Next, select the desired volume on disk 1:
DISKPART> select disk 1
DISKPART> select volume 2
Volume 2 is the selected volume.

And finally, we mirror them with the “add =” command, indicating the disk number used for this (in our case, this is disk 2):
DISKPART> add disk = 2
DiskPart succeeded in adding a mirror to the volume.

After that, Windows Server 2008 starts synchronization, the time of which depends on the size of the mirrored volume. During synchronization, the mirrored (with the Mirror type) will have the “Rebuild” state in the volume list. After graduation - Healthy.

Disassembling and removing a mirrored disk array

Windows Server 2008 includes the functions of disassembling the mirror raid array (two separate and independent volumes are created containing identical data) and deleting the “mirror” (in this case, all data on the “mirror” is deleted).
To parse a disk array using "Disk Management", right-click on one of the volumes and select "Break Mirrored Volume" in the menu that appears.
From the command line, in the diskpart application, use the “break” command with a reference to one of the two disks in the mirror raid array:
DISKPART> break disk = 2

To remove a mirror from the array, delete all synchronized data, right-click on the mirror volume in "Disk Management" and select "Remove Mirror". Alternatively, you can use the “break” command in diskpart with the NOKEEP parameter:
DISKPART> break nokeep disk = 2

Recovering a Mirror Raid Array

If one of the drives of the RAID array is out of order, then even in this case there is good news - unlike the “strip", all the data relevant at the time of the accident remained on the second disk. In this case, it is important to replace the failed disk and rebuild the mirror before the second disk stops working.
Right-click on the damaged volume and select “Remove Mirror”. Next, connect a new drive of sufficient capacity to create a mirror. Right-click on the working volume from the current mirror and select “Add Mirror” in the menu that appears, select a new disk and click “Add Mirror”. Windows will rebuild the mirrored raid array using the new disk. As mentioned earlier, the time to reassemble and synchronize data depends on the performance of the disks and their size.

Also popular now: