• Aucun résultat trouvé

The /etc/raidtab File

Dans le document LINUX RAID (Page 124-128)

The current raidtools package requires a configuration file, which, by default, is named/etc/raidtab. The/etc/raidtabfile contains a stanza about each software array connected to the system. (A stanza is a collection of keywords and variables that describe a single array.) The configuration is parsed from top to bottom so that pre-viously defined arrays may be used in subsequent stanzas. This is useful when creat-ing hybrid arrays like RAID-10, but it also means that the order of the stanzas in/etc/

raidtabis extremely important. Each stanza begins with araiddevdirective and con-tinues with other directives from the following list.

raiddevmddevice

The raiddev parameter begins the configuration of an array. All subsequent directives are assumed to refer to the most recentraiddevdirective.raiddevtakes the full path to the device block special file as its argument (for example,raiddev /dev/md2). A unique raiddev directive is required for each array.

raid-levellevel

raid-level specifies the mode of the current array. This parameter takes an alphanumeric value (see Table 4-1) that corresponds to kernel RAID levels.

Each raid-level directive defined in/etc/raidtabcorresponds to the previously definedraiddeventry. In addition, support for the RAID level you have selected usingraid-level must be compiled into your kernel, or be available as a load-able module, before the array can be started.

nr-raid-disksinteger

The nr-raid-disksdirective defines the number of active member disks in the current array. This number does not include any spare disks that might be used in an array that supports failover. (Use thenr-spare-disksparameter to indicate the number of spare disks in the current array.)nr-raid-diskstakes an integer value greater than zero and is required once for each array that is defined using theraiddevparameter. Subsequently, a number ofdeviceandraid-diskentries equal to the number defined withnr-raid-disksis required to specify the block special file and disk order for each member disk.

nr-spare-disksinteger

Spare disks provide a mechanism for hot failover in the event of a drive failure.

nr-spare-diskstakes an integer value greater than zero and equal to the number of available spares. As with nr-raid-disks, spares must be specified later by using thedevice andspare-diskparameter. Spare disks are optional for arrays that support failover (mirroring, RAID-4, and RAID-5). RAID-0 and linear mode do not support the use of spare disks, sonr-spare-disksis never used with these RAID levels. Spares need to be defined in /etc/raidtab if you want automatic failover. You can manually replace a failed disk using raidhotremove and raidhotadd, but that requires user intervention.

persistent-superblockboolean

The persistent-superblock directive determines whether an array contains a RAID superblock. The RAID superblock allocates a small area for metadata at the end of each member disk. This metadata allows the kernel to identify disk Table 4-1. raid-level parameters

raidtab entry Description

linear Linear concatenation

0 Striping

1 Mirroring

4 Single parity drive

5 Distributed parity

multipath Multipath I/O

order and membership even in the event that a drive has moved to a different controller. It is essential for autodetection. persistent-superblock should be enabled for any newly created array.

This parameter should be set to zero only when you need to provide backward compatibility with versions of themddriver that did not support a RAID super-block (version 0.35 and earlier). Setpersistent-superblockto zero when a leg-acy array is being used with the newmd driver.

parity-algorithmalgorithm_name

The parity-algorithm directive specifies the algorithm used to generate parity blocks. Note that this directive is used only with RAID-5. Parity is used to recon-struct data during a drive failure. There are four choices available, and they determine how parity is distributed throughout the array (Figure 4-1). Left-sym-metric, right-symmetric, left-asymmetric, and right-asymmetric are all valid choices, butleft-symmetricis recommended because it yields the best overall per-formance.

Figure 4-1. Each algorithm distributes parity and data blocks differently.

/dev/md0

You can specify theparity-algorithmby name in/etc/raidtabor use its numeri-cal equivalent (see Table 4-2). If you fail to specify aparity-algorithm in /etc/

raidtab, the mddriver will default to left-asymmetric, which is not an optimal choice. So be certain to selectleft-symmetric explicitly.

chunk-sizesize

chunk-size specifies the size of the array stripe in kilobytes. Values may range from 4 to 4096 kilobytes and must be powers of two. A bigger chunk-sizewill work well for large, sequential operations, but a smaller chunk-size will yield better performance for smaller, random operations. Most users should choose a chunk-size of about 64 KB.

With linear mode, thechunk-sizespecifies the rounding factor for the array. The rounding factor helps evenly group I/O operations. It’s similar to thechunk-size, except it does not spread I/O across multiple disks.

chunk-size has no effect on RAID-1, but to satisfy error checking inraidtools, you must specify a validchunk-size for any RAID-1 defined in/etc/raidtab.

Thechunk-sizeis written into the RAID superblock during array ini-tialization. If you determine that you need to adjust thechunk-size after your array is up and running, you will need to rebuild the array usingmkraidormdadm. Be advised that your data will be lost if you need to change the chunk-size for an array that has already been brought online. It is possible to adjust thechunk-sizeof an existing array using raidreconf, but all the caveats regarding raidreconf still apply. See the “raidreconf” reference entry later in this chapter.

devicedevpath

The device directive specifies the block special device of an individual array member. The full path to the block device should be used. The total number of device entries must equal the sum of the numbers defined bynr-raid-disksand nr-spare-disks. In an array with four nr-raid-disksand one nr-spare-disk, a total of fivedeviceentries are required. Each deviceentry must be paired with either araid-disk or aspare-disk index entry.

Table 4-2. Parity algorithms

Name Numeric value

left-asymmetric (default) 0

right-asymmetric 1

left-symmetric (best choice) 2

right-symmetric 3

raid-diskindex

raid-disktakes an integer value that indicates the sequence number of a mem-ber disk. The value of the raid-disk directive should increase sequentially for each new device entry. After a new array is defined using raiddev, the index number for all device entries is reset. That is to say, each array has a separate list of member disks starting at zero.

spare-disk index

Thespare-disk directive also takes an integer value beginning with zero. This parameter indicates the order of spare disks in an array. In the event of a disk failure, available spare disks will be brought online in the order in which they are indexed in/etc/raidtab.

parity-diskindex

parity-disk specifies an out-of-sequence member disk as the parity drive in a RAID-4 array. Normally, the last member disk is used for parity. However, the parity-diskdirective allows administrators to flag any member disk as a parity drive. This directive is accompanied by both a device entry and a raid-disk entry.

failed-disk index

Thefailed-diskparameter lets you flag one or more member disks as failed dur-ing array initialization. Flaggdur-ing a device as failed can be useful for testdur-ing data redundancy without having to force a drive failure through a less gentle method.

Flagging a device as failed also allows you to evaluate the performance of parity algorithms. Finally, the parameter can be used to create an array with a missing disk, which is a useful trick to use as part of migrating an existing system disk to software RAID. (See “Converting to Software RAID” in Chapter 7 for more details.) failed-disktakes an integer value beginning with zero. Much like the parity-diskdirective,failed-diskshould be accompanied bydevice and raid-disk entries.

Dans le document LINUX RAID (Page 124-128)