RAID 6 – Fedora Core 6

You’ve probably heard of RAID 0, RAID 1, and even RAID 5. But RAID 6?

What is Raid 6 you ask? Well, first we need to take a look at RAID 5 and understand how it works. If you understand RAID 5, then RAID 6 is an easy transition.

RAID 5 is what is referred to as a striped set with distributed parity. Essentially, the data is spread across the disk, and one bit is flipped each time a piece of data is written. This helps the RAID 5 set compute the missing data if one of the drives fails.

RAID 6 extends this concept one further by providing an additional drive for distributing the parity. Essentially, there is one more disk that can fail before data is lost. Comparing this with RAID 5, you get more redundancy. Comparing this with RAID 10 might be something you’d consider as well, but RAID 6 is better if for nothing more than the cost and efficiency.

So how do you configure linux with Software RAID 6? With Fedora Core 6 and Red Hat Enterprise Linux 5, RAID 6 is easily configured. Here’s how:

Four disk drives are recommended (3 are required) to set up the raid, five if you want a hot spare. This initial sacrifice of two (or three) drives will come in handy later on when something fails. This demonstration will use 4 512MB usb drives, sdb, sdc, sdd and sde.

First we need to partition the drives and assign them the correct partition type. As a general rule, partitioning the entire space on the disk is appropriate:

# fdisk /dev/sdd

Create a new partition using the entire disk:

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1019, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1019, default 1019):
Using default value 1019

Change the type of the partition from the default (83 Linux):

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l

. . . snip . . .

17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto

Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Now the device is created, lets have a look at it and write it out to the partition table:

Command (m for help): p

Disk /dev/sdd: 501 MB, 501088256 bytes
16 heads, 60 sectors/track, 1019 cylinders
Units = cylinders of 960 * 512 = 491520 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 1019 489090 fd Linux raid autodetect

Command (m for help): w
The partition table has been altered!

Make sure to do this for each of your devices. Once that the partitions are created, we need to load the module that will support RAID 6.

# modprobe raid6
# lsmod | grep raid
raid456 123985 0
xor 18249 1 raid456

Now create the software RAID 6 device:

# mdadm --create /dev/md0 --level=6 --raid-devices=4 /dev/sd{b,c,d,e}1
mdadm: array /dev/md0 started.

Yes, the array is started, but it does take some time to build. Try the watch command to show the array build in real time (almost).

# watch cat /proc/mdstat

Every 2.0s: cat /proc/mdstat Tue May 22 20:12:47 2007

Personalities : [raid6] [raid5] [raid4]
md0 : active raid6 sde1[3] sdd1[2] sdc1[1] sdb1[0]
978048 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]
[====>................] resync = 21.3% (104760/489024) finish=23.8min speed=266K/sec

Personalities : [raid6] [raid5] [raid4]
md0 : active raid6 sde1[3] sdd1[2] sdc1[1] sdb1[0]
978048 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]
[===================>.] resync = 95.6% (468472/489024) finish=1.2min speed=267K/sec

Personalities : [raid6] [raid5] [raid4]
md0 : active raid6 sde1[3] sdd1[2] sdc1[1] sdb1[0]
978048 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]

Make a filesystem on the new RAID 6:

# mkfs -t ext3 -b 4096 /dev/md0
. . . snip . . .

Mount the new filesytem:

# mkdir /storage; mount /dev/md0 /storage
# mount
. . . snip . . .
/dev/md0 on /storage type ext3 (rw)

Enjoy the RAID 6. Later on, I’ll write another tutorial on failing and recovering this RAID 6 and other software raid devices.

RAID 6 will grow more and more as its adopted and understood, get your Software RAID 6 configured soon.

Cheers,

Herlo

This entry was posted in RAID, Tech, Tools. Bookmark the permalink.

3 Responses to RAID 6 – Fedora Core 6

  1. Shawn says:

    Thank you, will give it a try in FC7.

  2. Josh says:

    Did you not end up writing an article about failing and recovering? I didnt see it anyway. This is great info though, thanks!

  3. herlo says:

    Josh,

    I did write a failure and recovery article about LVM. Its here: http://fedoratutorials.com/2006/09/15/lvm-from-failure-to-recovery/. Unfortunately, I didn’t write one for RAID, but that’d be a great topic for the future. I’ll look into that soon.

    Cheers,

    Clint

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>