Thursday, February 9, 2012

Software RAID in Microsoft Windows


Today I’m writing how to create a software RAID in Windows Server 2008. Hope you enjoy it…
Might at this point you might be asking, what is a software RAID, let’s see what types of RAID we have:
  • RAID
  • Fake RAID
  • Software RAID
Which is the difference among them? Well let’s start explaining RAID, it will make things easier to understand.

RAID

Basically a RAID configuration is an arrangement of disks that allows you to gain more space and / or make your disks redundant, there are many raid configurations 0,1, 5, ADG or 6 (there are combinations as 0+1 or 10 but we are not covering them here). RAID 0 means stripping data across 2 disks, for example if you have 2 1TB disks and you configure them as a RAID 0 array your operating system will see a 2TB disk, of course if you loose one of these disks you will loose all your data. RAID 1 in exchange, implies mirroring one disk to another, so if you have 2 1TB disk and you mirror it to the other, your operating system will only see 1 disk of 1TB, but if you loose one disk of this array, you won’t loose any data because you actually had 2 disks with the same content and the RAID controller (will talk later about it) avoids the operating system from crashing because of the disk failure. Then we have RAID 5, for this configuration you will need at least 3 disks where 2 are used to store data and the other for parity, let’s talk in a minute about parity, (in RAID 4 2 disks are used for data and in for parity too, the difference is in RAID 4 one of the disks is used completely for parity while in RAID 5 parity is distributed among all the disks, this allows you to loose fewer performance if a disk fails as you would experience if you loose a disk in a RAID 4 configuration), for example if you have 3 disks of 1TB and you arrange them in a RAID 5 configuration, your operating system will see 1 disk of 2TB and if any of the three disks is broken you will suffer no loose of data. RAID 6 or ADG is basically the same as RAID 5 but there is one more disk for parity.

Parity

This will be much easier to explain with a drawing,
image
*(P) indicates the parity data block.
Imagine A and B is a file you are writing to the disk the OS sees, C and D is another and E and F another file. In other words each line of representation in the graphic in the disk data section represents a file composed of 2 data blocks, but remember when we were talking about RAID 5 we said if we have 3 disks we will be only able to use two of them and sacrifice the other in order to gain data redundancy, well this is precisely what we were talking about, now think about it this way, if we loose disk 1 and we need to obtain file 1 we can do A+B(P)-A, that would allow us to recover B block, but since parity is distributed among the 3 disks, if we need to read file 2, we wouldn’t have to run any operation (when I say we, actually I’m talking about the RAID controller), because the DISK 1 which is the one broken only contains the parity data block for file 2. That is why RAID 5 is more preforming than RAID 4, in RAID 4 if you loose the parity disk, there is no issue, you will suffer minimal performance loose, but if you loose any of the data disks which is actually 2 disk of 3, you would have to recover each single peace of data.
In real life you can imagine data is spread in much more than just 2 data blocks, but the principle is just the same.

RAID controller

If we look at the previous graphic, the RAID controller should be between the disks and the OS, it is a hardware component where the disks are plugged to, this controller is the one in charge of configuring the array and administering the RAID, and make the RAID available as a disk to the computer. For example in a server which has a RAID controller and the disks attached to it, you would see in the boot order menu the RAID controller and not the disks.

Fake RAID

Fake RAID is like RAID but in this case the OS is aware of the existence of the RAID, most Intel server motherboards can do this kind of RAID, is cheaper, the processing is done by the CPU, not by the RAID controller and as said OS is aware of the existence of the RAID.

Software RAID

And we arrived where we wanted, a software RAID is a type of RAID where the OS is fully aware of it existence and manages it. It exists at volume level, but take a look at this graphic, it might help you to understand:
image
*White squares above the disks represent the disk space.
As you might see, the main difference between software RAID and the other two methods, is that you actually group volumes across disks, while in the first two RAID methods you group disks. Of course this has advantages and disadvantages, we might say this kind of RAID allows more flexibility to administer the disk space and to take advantage of it, might be in a configuration as the one in the graphic you might have your OS installed in the RAID 1, the printing spool in RAID 0 and a DB in the RAID 5. But, as this type of RAID is created in such high level as the OS, the performance is obviously not the same as if you implement RAID using a real RAID controller, but of course, this last option is the cheapest option of the three.

How to create a software RAID in Windows?

First thing we need is to have dynamic disks, RAID configurations are not available in basic disks. The is just to go into the storage management MMC and configure the RAID type you want.

Dynamic Disks

About dynamic disks, you might find useful the following link about best practices on dynamic disks:
Basically what it says is, if you are not going to use dynamic disks features, leave your disks as basic disks. Some time ago I heard you weren’t capable of converting the disk containing the System Volume, well, actually you can. Some more interesting info:
Here you will find a very cool article about Basic and dynamic disks, considerations any many MANY tips, it was written for people upgrading from Windows NT 4.0 to Windows 2000 but the concepts are basically the same:
Another one with some other tips, written for Windows 2003:

Creating software RAIDs with Disk Management MMC Snap-in

Well, I’m going to show you how to do it with some screens, I’ve built the following environment, a server with Windows Server 2008, 3 64GB disks , one of them, the one containing the system volume has already been converted to dynamic, also have reduced the C: volume size to 62GB to make some space available in that disk:
image
1. Convert the other 2 disk to dynamic disks:

image
image
2. Start creating you volumes:
image
You will see 5 options:
  1. Simple volume
  2. Spanned volume
  3. Striped volume
  4. Mirrored volume
  5. RAID-5 volume
At this point you might be asking which type of RAID is each of them, well, simple volume is just an stand alone volume, a mirrored volume is like a RAID 1 array, RAID-5 does not require mucho more explanation, and then we have Spanned and Striped, both of them are like RAID 0, but the difference resides in, striped volume writes a data block to one disk and another data block to the other, if you loose one disk you loose all the data, in the spanned volumes, data is first written to one of the disks and then when it is filled data is written to the other, if one of the disk fails you might loose only part of your information.
In our case let’s create a mirror for C: drive, a RAID 5 using the remaining space in disk 0 and a single volume in the remaining space in disk 2.
3. Creating the mirror:
image
image
image
Then it starts synchronizing the data with the mirror.
4. Create the RAID 5 across the 3 disks:
image
image
image
Here you will see you can set any size, but actually the maximum size you can specify is equal to the space free in the most occupied disk.
image
image
image
image
5. And then you just go and create a simple volume in the remaining space, the disk management snap-in is smart enough to make you available only those RAID types you can implement according to your current conditions like how many disks have space available:
image
Hope this helps you to understand how does Dynamic disks and software RAID works and might be save some money.

0 comments:

Post a Comment