Managing RAID on Linux - Derek Vadala [128]
I've already discussed using hdparm -t as a way of performing some elementary data throughput tests. But hdparm doesn't test a broad range of I/O operations, nor does it test performance over long periods of time, on large and small files, or on filesystem metaoperations such as file creation and deletion. For that reason, I recommend downloading and familiarizing yourself with some other performance test suites.
The two programs that I recommend are bonnie++ (http://www.coker.com.au/bonnie++/) and tiobench (http://tiobench.sourceforge.net/). You can use either program to run a variety of throughput tests on both individual block devices, as well as arrays (software and hardware). I urge you to perform tests at each stage of array deployment and performance tuning to get a better idea of the overall effect of the various adjustments on your system performance.
Booting with Software RAID
One of the most frequently asked questions on the linux-raid mailing list is how to boot directly to software RAID. The answer depends on your situation. If you have an existing system and you want to move from a standalone, non-RAID situation to a software RAID system, you can use some very straightforward conversion steps that I've outlined below in the Converting to Software RAID section. If you are installing a new system for the first time, many distributions now support direct installation to a software RAID. I've listed some of these distributions here and outlined any noteworthy pitfalls that I've encountered.
Installing Directly to Software RAID
First, all /boot and / partitions must be on a RAID-1. So if you have only two disks, you can't create a RAID-1 for /boot and root and then create a few RAID-0 partitions for /usr, /home, and /var. While some installers and the md driver will allow this, it's strongly discouraged. There's no reason that you couldn't create non-boot and non-root partitions on separate arrays on a separate set of disks. However, considering the large size of even today's smaller hard disks, it would be quite a waste of space to house only /boot and root filesystems on a two-disk RAID-1.
Second, always use LILO in combination with bootable software RAID devices. Although GRUB provides some limited support, it's not as evolved as the support that LILO provides for md devices. Some installers might default to GRUB, so don't forget to manually select LILO as necessary.
There's also one drawback to direct installation to software RAID. Since RAID-1 is a requirement for booting, that means initial synchronization for every partition you create must occur in parallel with the installation process. This increases the time it takes to install the system. But the benefits of RAID-1 do provide a reward for this imposition.
Red Hat
Red Hat has supported software RAID directly in its installation process for some time. That means system administrators don't need to go through all of the extra steps that I'm about to outline when using Red Hat for a first-time installation onto software RAID.
The process for creating a bootable RAID-1 in Red Hat is very straightforward, but it does require using Disk Druid. Those of you who would like switch to a virtual terminal and use fdisk to manually create the partition tables should remember an important requirement: you must create the same partitions on each RAID-1 component disk. When Disk Druid executes, you can choose the software RAID filesystem type for each partition (on both disks). Next, use the Make RAID button to create each software array. If I wanted to create root, /boot, and swap filesystems for my new Linux machine, I'd create the same partitions for each filesystem on my first (/dev/sda) and second (/dev/sdb) hard disks.
Red Hat provides some good documentation for this process at the URL http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/custom-guide/ch-software-raid.html. The documentation describes the software RAID installation process step-by-step, with screenshots. If you purchased a boxed copy of Red Hat, you should be able