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