Managing RAID on Linux - Derek Vadala [49]
Set partitions to type Linux Raid Auto (0xFD) if you want the kernel to automatically start arrays at boot time. Otherwise, leave them as Linux (0x83).
RAID-1 and RAID-4/5 arrays should contain member disks that have partitions of the same size. If these arrays contain partitions of differing sizes, the larger partitions will be truncated to reflect the size of the smallest partition.
RAID-0 and linear mode arrays can contain partitions that have varying sizes without losing any disk space. Remember that when the smaller disks that belong to a RAID-0 become full, only the remaining disks are striped. So you might see variable performance on a RAID-0 with member disks of differing sizes as the array fills up.
Using matched drives is strongly recommended when working with any nonlinear mode array. Please see the Matched drives section in Chapter 2 for further details.
* * *
Once partitions are created, you can use fdisk to compare each of the new partitions. Make certain that they meet your specifications and that partitions for arrays are the same size when necessary:
# fdisk -l
Disk /dev/sda: 255 heads, 63 sectors, 553 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 16 128488+ 83 Linux
/dev/sda2 17 33 136552+ 82 Linux swap
/dev/sda3 34 84 409657+ 83 Linux
/dev/sda4 85 553 3767242+ 5 Extended
/dev/sda5 85 276 1542208+ 83 Linux
/dev/sda6 277 407 1052226 83 Linux
/dev/sda7 408 553 1172713+ 83 Linux
Disk /dev/sdb: 255 heads, 63 sectors, 1116 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1116 8964238+ fd Linux raid autodetect
Disk /dev/sdc: 255 heads, 63 sectors, 1116 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 1116 8964238+ fd Linux raid autodetect
Disk /dev/sdd: 255 heads, 63 sectors, 1116 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
In addition to the system drive, two partitions are defined in the preceding listing. There is a partition on each of the second and third SCSI drives: /dev/sdb1 and /dev/sdc1. A fourth drive with no partitions defined resides at /dev/sdd.
Linear (Append) Mode
Linear mode requires a minimum of two disks, but does not require that member disks be the same size or type. Since the system writes to each disk until it is full, the speed and size of individual disks is largely irrelevant, in terms of aggregate RAID performance.
The following is a very simple linear array using /etc/raidtab:
# A linear array with two member disks
raiddev /dev/md0
raid-level linear
chunk-size 64
persistent-superblock 1
nr-raid-disks 2
device /dev/sdb1
raid-disk 0
device /dev/sdc1
raid-disk 1
raiddev begins the definition of a new array, /dev/md0 in this case. All entries that follow apply to the previously defined array, until another raiddev entry is parsed. raid-level, as the name implies, sets the array type for the current array.
As I mentioned earlier, chunk-size would normally define the number of kilobytes to write to each member disk for arrays that support disk striping. However, when working with linear mode arrays, the chunk-size defines the rounding factor. Each component disk is sized so that it is a multiple of the rounding factor. Because of the way the RAID superblock is placed on each array member, rounding factors of less than 64 KB are effectively equal to 64 KB.
The chunk-size, regardless of what type of array is used, must be defined as any power of two. In fact, for the rest of this chapter, we'll create arrays with a 64 KB chunk-size. You might notice some errors in the system boot messages and your log files, which warn about using a chunk-size with linear mode (or RAID-1). These warnings arise from the inconsistencies between the kernel RAID driver and the requirements of raidtools for parsing /etc/raidtab. These warnings can be safely ignored.
persistent-superblock takes