RAID

From MythTV Official Wiki
Revision as of 14:43, 11 January 2006 by Steveadeff (talk | contribs)

Jump to: navigation, search
Clock-green.png
This article is being created or undergoing major editing at this time.
As a courtesy, please do not edit this article while this message is displayed. The person who added this notice will be listed in its edit history should you wish to contact him or her.

R.A.I.D.

Quick Overview

Okay, with properly run hardware RAID, RAID 1 is the slowest (Data's
written to both drives at the speed of the slowest drive), RAID 5 is
next fastest (As the data spans the drives, so it's 1/3 faster than a
single drive or RAID 1), and RAID 0 is the very fastest (Data's
written to both drives simultaneously).

If you have the drives to spare (4 drives), and you don't mind
"Losing" half the capacity for the backup, then RAID 0+1 is the best
combination, giving high speed AND data redundancy (50% capacity, 200%
preformance).

If you don't have the drives (3 drives), or you wish to get more
capacity from the drives you have, then RAID 5 is best, as it gives
you 66% of the capacity of the drives and 133% of the performance.

If you have only 2 drives, you can opt to use them as RAID 1 (Which
will give you 50% capacity and 100% performance) or RAID 0 (Which
gives you 100% capacity (And 0% redundancy), and 200% performance).

This is all assuming you're using hardware RAID, which is not reliant
on CPU overheads or anything like that. Software RAID changes this, as
it uses the CPU and the regular IDE controller, but can't (generally)
write to multiple drives simultaneously.
-- 
Robert "Anaerin" Johnston

RAID For Recordings Drive

A few Options exist for using RAID for the Recordings drive, epending on the goal you have for your recordings drive, speed or redundency, or both. RAID 1 Will allow you to gain the most speed from your drives, RAID 01(or RAID 0+1) will give you speed and 1:1 redundency, and RAID 5 sits inbetween, giving you a slight speed increase over RAID 0 but with parity to recreate the data on a failed drive.

With HD becoming the prevalent standard...

RAID For Archives Drive

Having an independent drive array for archival of shows one wishes to keep allows the user to setup a RAID for speed for the recordings drive and a RAID for backup for the archival drive. This way, once a show has been recorded, commercial flagged and possibly even transcoded to another format or for permanent commercial removal, it can be moved to the archive. In such a case, RAID 5 and RAID 10 make the most sense. If you plan on a large amount of access to the archive, a RAID 10 may make more sense as it will most easily keep up with the transfer rate requirement while still allowing for redundency, but at the cost of the price for obtaining the number of drives requried. RAID 5 will have a slight speed advantage over just having numerous drives (JBOD, Just a Bunch Of Disks in hardware RAID, linear in mdadm), but will also have the advantage of getting the most archival bang-for-your-buck while still maintaining parity for the case of a lost drive.

Setup

Creating a RAID array with mdadm is quite easy. The Software-RAID HOWTO Performance section will help here, as different RAID types have different best values for chunk and block sizes. Since we will be dealing with only large files (recorded mpegs. music files, etc) it is recommended to choose the largest chunk and block value that combine for the highest performance.

Before a RAID array can be created on a disk it must be partitioned, again you can use cfdisk. The easiest way is to create a full drive partition.

RAID 5

The following line will create a 3-drive RAID 5 array with a chunk size of 32K, it will be created from /dev/sda1, /dev/sdb1, and dev/sdc1

# mdadm -v --create /dev/md0 --chunk=32 --level=raid5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1

RAID 10

RAID 10 is really the creation of 2 or more arrays. First you create the number of RAID 1, mirrored, arrays you wish to have,

<nowiki>
# mdadm -v --create /dev/md0 --chunk=32 --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1
# mdadm -v --create /dev/md1 --chunk=32 --level=raid1 --raid-devices=2 /dev/sdc1 /dev/sdd1
</nowiki>

and so on until you have the number of drives you wish to concatenate into a RAID 0.

Once these have completed building (see below), you can create the RAID 0, striped, array,

<nowiki>
# mdadm -v --create /dev/md2 --chunk=32 --level=raid0 --raid-devices=2 /dev/md0 /dev/md1
</nowiki>

RAID Creation Confirmation

You will be prompted with the RAID parameters, and asked to continue,

mdadm: layout defaults to left-symmetric
mdadm: /dev/sdc1 appears to contain a reiserfs file system
    size = -192K
mdadm: size set to 293049600K
Continue creating array?

Status of RAID Creation

Upon confirmation you will only see

mdadm: array /dev/md0 started.

Once you run the command to create the RAID array, if you want to see the progress run,

# cat /proc/mdstat

and you will see something along the lines of,

# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5] [multipath] [raid6] [raid10]
md0 : active raid5 sdc1[3] sdb1[1] sda1[0]
      586099200 blocks level 5, 32k chunk, algorithm 2 [3/2] [UU_]
      [=>...................]  recovery =  5.8% (17266560/293049600) finish=69.8min speed=65760K/sec

unused devices: <none>

RAID Filesystem Creation

Once your RAID array is created you can place a filesystem on it. JFS and XFS are the two recommended filesystems for large file arrays, especially for the recordings drive in Myth. Again, we will use The Software-RAID HOWTO Performance section and go with a 4K (4096) block size.

For XFS (replace md0 with your final RAID array if using a mixed mode array),

mkfs.xfs -b size=4096 -L Recordings /dev/md0 -f

or for JFS,

mkfs.jfs -c -L Recordings /dev/md0 -f

(It is not recommended to use a JFS partition for your boot drive when using GRUB)

Mounting

Thats it, now your ready to mount the filesystem! You can add a line to your /etc/fstab similar to,

/dev/md0       /MythTV/tv             xfs     defaults        0       0

or

/dev/md0       /MythTV/tv             jfs     defaults        0       0

Links

Great page with information on the different hardware and software raid chipsets, their current linux support

Wikipedia Entry for RAID

mdadm MAN page (via man-wiki)

Software-RAID HOWTO


--Steveadeff 19:00, 8 January 2006 (UTC)