FEEDBACK
X

The software RAID monitoring and recovery in Linux

The software RAID 1 management in RHEL

The status monitoring

Information on all RAID-arrays:

   # more /proc/mdstat

or

   # cat /proc/mdstat

or

   # watch -n .1 cat /proc/mdstat

Information on a specific disk partition:

   # mdadm -E /dev/sd<a-b><1-10>

for example:

   # mdadm -E /dev/sdb2

Read more: The software RAID monitoring and recovery in Linux

Recovering a software RAID after a failure

We decided to write a little note on the partition "fallout" from the software RAID 1

cat /proc/mdstat

In RAID activity we see the following:

Personalities : [raid1]

md2 : active raid1 sdb3[1]
34178176 blocks [2/1] [_U]
md1 : active raid1 sda2[0] sdb2[1]
19534976 blocks [2/2] [UU]
md0 : active raid1 sda1[0] sdb1[1]
240832 blocks [2/2] [UU]

Read more: Recovering a software RAID after a failure

How does it work?

3 hard drives is the minimum requirement to setup a RAID 5 array, and what happens inside the array is that the RAID controller will strip the drives together like in RAID 0, but will also add something called “parity”. Parity is the end result of a comparison between sets of data written to different drives. I’m going to show an e.g which is hopefully going to be understandable.

Advantages:

You have an increased Read speed, and also Redundancy

Disadvantages:

Capacity yield.

Example here is you have 3 hard drives and all of them are 1TB each. With RAID 0 you would have a 3TB virtual hard drive. With RAID 5 you’ll lose the capacity of 1 drive. So in this case RAID controller presents them to the operating system as 2TB hard drive.

HDD #1 (1TB)

HDD #2 (1TB)

HDD #3 (1TB)

 

Virtual HDD (2TB)

         
         
     

RAID

 
         
         

When we take a close look at what happens when the operating system is trying to write some bits of to the disk drives. The RAID controller will take the first half of the 8bits and write it to the hard drive #1.

HDD #1 (1TB)

HDD #2 (1TB)

HDD #3 (1TB)

 

Virtual HDD (2TB)

1010

     

10101010

         
     

RAID

 
         
         

It will take the second half of the 8bits and write it to hard drive #2. Keep in mind, this is simplified because it writes in much bigger junks of data but this is just simplified on how it works. As we see now there’s no difference from what it happened in RAID 0. We took half each from the data and wrote it to two hard drives and why still do we need the third hard drive. It’s because of the parity.

HDD #1 (1TB)

HDD #2 (1TB)

HDD #3 (1TB)

 

Virtual HDD (2TB)

1010

1010 

   

10101010

         
     

RAID

 
         
         

When the RAID controller creates the parity bits it uses a table called Exclusive OR which will compare bits and will output a parity bit as a result of the bits it compares. We are going to see how it works.

   

XOR

   

0

 +

0

0

0

 +

1

1

1

 + 

0

=

1

1

 +

1

  =

0

Read more: RAID-5 internals, data storage, performance and recovery

RAID: RAID 1+0 recovery and converting into 2 RAID 1 arrays on the same drives

I want to tell you how I converted RAID 1+0 into 2 RAID 1 arrays without any backup disks and on 2 different RAID controllers as well.

I used to have out of curiosity a RAID 1+0 array on 4 SATA drives using NVRAID controller from NVidia, built in the motherboard. Yes, I knew that that was not a hardware controller and a software RAID array on a non-dedicated computer was the evil, but I was eager to try.

In order to simplify, let us number the drives after numbers of controller ports they are connected to - drives #1, #2, #3 and #4 respectively.

Experience has proven that there was no particular use from speeding up RAID 0 (striped) array. The reason for that probably was large RAM (8 GB), most of which was used by the operating system as the disk cache.

Knowing that if anything cropped up it would not be easy to access data due to the presence of the RAID 0 (striped) array, I decided to switch over from RAID 1+0 to 2 RAID 1 arrays. The excellent reason - a motherboard replacement - cropped up at that time. This time I chose a motherboard with the Intel ICH10R controller I supposed that it wouldn't support the NVidia RAID array.

Yes, I do know that in such cases it is just recommended to copy data from the RAID in the old system (especially as the situation is not extremal), recreate a RAID in a new system and then copy data back to the RAID. But I had to transfer data firstly. And secondly it was very interesting to me to simulate the situation of recovering data from RAID, especially as the presence of the mirror, with a copy of which I wasn't going to do anything serious, was instilling confidence in the results.

Read more: RAID: RAID 1+0 recovery and converting into 2 RAID 1 arrays on the same drives

How does it work?

It requires minimum of 2 hard drives, and what happens in the RAID system is that RAID-controller will keep two identical sets of data.

Advantages:

It has increased Read speed which we’ll take a look at later in the video, and Redundancy.

Disadvantages:

Low Capacity yield.

Here we have the example. It is the same as in RAID 0 video; we have two hard drives 1TB each. We have our trusty RAID controller, and below is how operating system sees them as 1TB hard drive. This is what I meant by low capacity yield. The operating only sees as 1TB hard drive though you have two 1TB hard drives. So you only get half of the total capacity.

HDD #1 (1TB)

HDD #2 (1TB)

Virtual HDD (1TB)

RAID

When the operating system you are using is writing data to the drive, the RAID controller will simply take the data represented by this 8bits and will write them to both the hard drives. So hard drive #1 and #2 will be identical. That’s why it is called as mirrored RAID array. If you see below it just takes data and puts them on both drives, and it’s going to keep doing like that forever hopefully!

 

Read more: RAID-1 (Mirrored Drives): closer look.