[ec9b2d7] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="raid">
|
---|
| 9 | <?dbhtml filename="raid.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info>
|
---|
| 12 | <othername>$LastChangedBy$</othername>
|
---|
| 13 | <date>$Date$</date>
|
---|
| 14 | </sect1info>
|
---|
| 15 |
|
---|
| 16 | <title>About RAID</title>
|
---|
| 17 |
|
---|
[0d7900a] | 18 | <para>The storage technology known as RAID (Redundant Array of
|
---|
[ec9b2d7] | 19 | Independent Disks) combines multiple physical disks into a logical
|
---|
| 20 | unit. The drives can generally be combined to provide data
|
---|
| 21 | redundancy or to extend the size of logical units beyond the
|
---|
| 22 | capability of the physical disks or both. The technology
|
---|
| 23 | also allows for providing hardware maintenance without powering
|
---|
| 24 | down the system.</para>
|
---|
| 25 |
|
---|
[802f7211] | 26 | <para>The types of RAID organization are described in the <ulink
|
---|
| 27 | url="https://raid.wiki.kernel.org/index.php/Overview#The_RAID_levels">
|
---|
[ec9b2d7] | 28 | RAID Wiki</ulink>.</para>
|
---|
| 29 |
|
---|
[0d7900a] | 30 | <para>Note that while RAID provides protection against disk
|
---|
[ec9b2d7] | 31 | failures, it is not a substitute for backups. A file deleted
|
---|
| 32 | is still deleted on all the disks of a RAID array. Modern backups
|
---|
| 33 | are generally done via <xref linkend='rsync'/>.</para>
|
---|
| 34 |
|
---|
[0d7900a] | 35 | <para>There are three major types of RAID implementation:
|
---|
[ec9b2d7] | 36 | Hardware RAID, BIOS-based RAID, and Software RAID.</para>
|
---|
| 37 |
|
---|
| 38 | <sect2 id="hwraid">
|
---|
| 39 | <title>Hardware RAID</title>
|
---|
[0d7900a] | 40 | <para>Hardware based RAID provides capability through proprietary
|
---|
[ec9b2d7] | 41 | hardware and data layouts. The control and configuration is generally
|
---|
| 42 | done via firmware in conjunction with executable programs made
|
---|
| 43 | available by the device manufacturer. The capabilities are
|
---|
[0d7900a] | 44 | generally supplied via a PCI card, although there are some
|
---|
[ec9b2d7] | 45 | instances of RAID components integrated in to the motherboard.
|
---|
[802f7211] | 46 | Hardware RAID may also be available in a stand-alone enclosure.</para>
|
---|
[ec9b2d7] | 47 |
|
---|
[802f7211] | 48 | <para>One advantage of hardware-based RAID is that the drives
|
---|
[ec9b2d7] | 49 | are offered to the operating system as a logical drive and no
|
---|
| 50 | operating system dependent configuration is needed.</para>
|
---|
| 51 |
|
---|
| 52 | <para>Disadvantages include difficulties in transferring drives
|
---|
| 53 | from one system to another, updating firmware, or replacing
|
---|
| 54 | failed RAID hardware.</para>
|
---|
| 55 |
|
---|
| 56 | </sect2>
|
---|
| 57 |
|
---|
| 58 | <sect2 id="biosraid">
|
---|
| 59 | <title>BIOS-based RAID</title>
|
---|
| 60 |
|
---|
| 61 | <para>Some computers offter a hardware-like RAID implementation in the
|
---|
| 62 | system BIOS. Sometime this is referred to as 'fake' RAID as the
|
---|
| 63 | capabilites are generally incorporated into firmware without any hardware
|
---|
| 64 | acceleration.</para>
|
---|
| 65 |
|
---|
| 66 | <para>The advantages and disadvantages of BIOS-based RAID are generally
|
---|
| 67 | the same as hardware RAID with the additional disadvantage that there
|
---|
| 68 | is no hardware acceleration.</para>
|
---|
| 69 |
|
---|
| 70 | <para>In some cases, BIOS-based RAID firmware is enabled by default (e.g.
|
---|
| 71 | some DELL systems). If software RAID is desired, this option must be
|
---|
| 72 | explicitly disabled in the BIOS.</para>
|
---|
| 73 |
|
---|
| 74 | </sect2>
|
---|
| 75 |
|
---|
| 76 | <sect2 id="swraid">
|
---|
| 77 | <title>Software RAID</title>
|
---|
[0d7900a] | 78 | <para>Software based RAID is the most flexible form of RAID. It is
|
---|
[ec9b2d7] | 79 | easy to install and update and provides full capability on all or
|
---|
[0d7900a] | 80 | part of any drives available to the system. In BLFS, the RAID software
|
---|
[ec9b2d7] | 81 | is found in <xref linkend='mdadm'/>.</para>
|
---|
| 82 |
|
---|
| 83 | <para>Configuring a RAID device is straight forward using
|
---|
| 84 | <application>mdadm</application>. Generally devices are created in the
|
---|
| 85 | <filename class='directory'>/dev</filename> directory as
|
---|
| 86 | <filename>/dev/mdx</filename> where <emphasis>x</emphasis> is an integer.
|
---|
| 87 | </para>
|
---|
| 88 |
|
---|
| 89 | <para>The first step in creating a RAID array is to use partitioning software
|
---|
[0d7900a] | 90 | such as <userinput>fdisk</userinput> or <xref linkend='parted'/> to define the
|
---|
[ec9b2d7] | 91 | partitions needed for the array. Usually, there will be one partition on
|
---|
| 92 | each drive participating in the RAID array, but that is not strictly necessary.
|
---|
| 93 | For this example, there will be four disk drives:
|
---|
| 94 | <filename>/dev/sda</filename>,
|
---|
| 95 | <filename>/dev/sdb</filename>,
|
---|
| 96 | <filename>/dev/sdc</filename>, and
|
---|
| 97 | <filename>/dev/sdd</filename>. They will be partitioned as follows:</para>
|
---|
| 98 |
|
---|
| 99 | <screen><literal>Partition Size Type Use
|
---|
| 100 | sda1: 100 MB fd Linux raid auto /boot (RAID 1) /dev/md0
|
---|
| 101 | sda2: 10 GB fd Linux raid auto / (RAID 1) /dev/md1
|
---|
| 102 | sda3: 2 GB 83 Linux swap swap
|
---|
| 103 | sda4 300 GB fd Linux raid auto /home (RAID 5) /dev/md2
|
---|
| 104 |
|
---|
| 105 | sdb1: 100 MB fd Linux raid auto /boot (RAID 1) /dev/md0
|
---|
| 106 | sdb2: 10 GB fd Linux raid auto / (RAID 1) /dev/md1
|
---|
| 107 | sdb3: 2 GB 83 Linux swap swap
|
---|
| 108 | sdb4 300 GB fd Linux raid auto /home (RAID 5) /dev/md2
|
---|
| 109 |
|
---|
| 110 | sdc1: 12 GB fd Linux raid auto /usr/src (RAID 0) /dev/md3
|
---|
| 111 | sdc2: 300 GB fd Linux raid auto /home (RAID 5) /dev/md2
|
---|
| 112 |
|
---|
| 113 | sdd1: 12 GB fd Linux raid auto /usr/src (RAID 0) /dev/md3
|
---|
| 114 | sdd2: 300 GB fd Linux raid auto /home (RAID 5) /dev/md2 </literal></screen>
|
---|
| 115 |
|
---|
[ec64d28] | 116 | <para>Is this arrangement, a separate boot partition is created as the
|
---|
[ec9b2d7] | 117 | first small RAID array and a root filesystem as the secong RAID array,
|
---|
| 118 | both mirrored. The third partition is a large (about 1TB) array for the
|
---|
| 119 | <filename class='directory'>/home</filename> directory. This provides
|
---|
[0d7900a] | 120 | an ability to stripe data across multiple devices, improving speed for
|
---|
[ec64d28] | 121 | botih reading and writing large files. Finally, a fourth array is created
|
---|
[ec9b2d7] | 122 | that concatenates two partitions into a larger device.</para>
|
---|
| 123 |
|
---|
| 124 | <note><para>All <application>mdadm</application> commands must be run
|
---|
| 125 | as the <systemitem class="username">root</systemitem> user.</para></note>
|
---|
| 126 |
|
---|
| 127 | <para>To create these RAID arrays the commands are:</para>
|
---|
| 128 |
|
---|
| 129 | <screen><userinput>/sbin/mdadm -Cv /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
|
---|
| 130 | /sbin/mdadm -Cv /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
|
---|
| 131 | /sbin/mdadm -Cv /dev/md3 --level=0 --raid-devices=2 /dev/sdc1 /dev/sdd1
|
---|
| 132 | /sbin/mdadm -Cv /dev/md2 --level=5 --raid-devices=4 \
|
---|
| 133 | /dev/sda4 /dev/sdb4 /dev/sdc2 /dev/sdd2 </userinput></screen>
|
---|
| 134 |
|
---|
| 135 | <para>The devices created can be examined by device. For example,
|
---|
[0d7900a] | 136 | to see the details of <filename>/dev/md1</filename>, use
|
---|
[ec9b2d7] | 137 | <userinput>/sbin/mdadm --detail /dev/md1</userinput>: </para>
|
---|
| 138 |
|
---|
| 139 | <screen><literal> Version : 1.2
|
---|
| 140 | Creation Time : Tue Feb 7 17:08:45 2012
|
---|
| 141 | Raid Level : raid1
|
---|
| 142 | Array Size : 10484664 (10.00 GiB 10.74 GB)
|
---|
| 143 | Used Dev Size : 10484664 (10.00 GiB 10.74 GB)
|
---|
| 144 | Raid Devices : 2
|
---|
| 145 | Total Devices : 2
|
---|
| 146 | Persistence : Superblock is persistent
|
---|
| 147 |
|
---|
| 148 | Update Time : Tue Feb 7 23:11:53 2012
|
---|
| 149 | State : clean
|
---|
| 150 | Active Devices : 2
|
---|
| 151 | Working Devices : 2
|
---|
| 152 | Failed Devices : 0
|
---|
| 153 | Spare Devices : 0
|
---|
| 154 |
|
---|
| 155 | Name : core2-blfs:0 (local to host core2-blfs)
|
---|
| 156 | UUID : fcb944a4:9054aeb2:d987d8fe:a89121f8
|
---|
| 157 | Events : 17
|
---|
| 158 |
|
---|
| 159 | Number Major Minor RaidDevice State
|
---|
| 160 | 0 8 1 0 active sync /dev/sda1
|
---|
| 161 | 1 8 17 1 active sync /dev/sdb1</literal></screen>
|
---|
| 162 |
|
---|
| 163 | <para>From this point, the partitions can be formated with the filesystem of
|
---|
[a3c54ef2] | 164 | choice (e.g. ext3, ext4, <xref linkend='xfsprogs'/>, <xref linkend='reiserfs'/>,
|
---|
[ec9b2d7] | 165 | etc). The formatted partitions can then be mounted. The
|
---|
| 166 | <filename>/etc/fstab</filename> ifile can use the devices created for mounting at
|
---|
| 167 | boot time and the linux command line in
|
---|
[802f7211] | 168 | <filename>/boot/grub/grub.cfg</filename> can specify
|
---|
[ec9b2d7] | 169 | <option>root=/dev/md1</option>.</para>
|
---|
| 170 |
|
---|
| 171 | <note><para>The swap devices should be specified in the <filename>/etc/fstab</filename>
|
---|
[0d7900a] | 172 | file as normal. The kernel normally stripes swap data across multiple swap
|
---|
[ec9b2d7] | 173 | files and should not be made part of a RAID array.</para></note>
|
---|
| 174 |
|
---|
| 175 | <para>For further options and management details of RAID devices, refer to
|
---|
| 176 | <userinput>man mdadm</userinput>.</para>
|
---|
| 177 |
|
---|
[a805e52] | 178 | <para>Additional details for monitoring RAID arrays and dealing with
|
---|
| 179 | problems can be found at the <ulink
|
---|
[802f7211] | 180 | url="https://raid.wiki.kernel.org/index.php/Linux_Raid">Linux RAID
|
---|
[a805e52] | 181 | Wiki</ulink>.</para>
|
---|
| 182 |
|
---|
[ec9b2d7] | 183 | </sect2>
|
---|
| 184 |
|
---|
| 185 | </sect1>
|
---|