Software Raid Mirroring on RedHat 8.0
© Tony Lawrence, aplawrence.com
I installed RedHat 8.0 on a spare machine here to see how the software raid works. I have always used hardware raid in the past, but various internet articles and posts convinced me that Linux software raid wasn't a Bad Thing. I do think I still prefer hardware raid, though. BTW, always remember that raid is no substitute for regular and reliable backup!
Let me first say that, to my way of thinking, RedHat goes about this completely backwards. With a hardware raid, you usually set the raid configuration first, selecting the drives that will make up logical volumes, and then the OS is free to transparently build whatever file systems it wants on those volumes. The hardware raid makes the OS think it is just working with an ordinary disk, so once you have configured it, your OS install is just the same as it would be without raid.
Obviously software raid can't be quite that transparent. But it seems to me that it could be a lot easier than it is. The approach here is to first divide the disks into the partition sizes desired, create logical raid devices from those partitions, and then create filesystems on the logical devices. I didn't expect that at all: I expected that I could create a logical volume from physical disks, and then divide that into the filesystems I want. I think that approach is much more logical. Linux, of course, is heavily wedded to the idea of filesytems being built on fdisk partitions (contrast that with SCO, for example, where one fdisk partition is carved into multiple filesystems), and that's probably why this is the way software raid is approached. Yet, 8.0 also offers LVM (Logical Volume Manager) setup, and this DOES work much more like hardware raid does, so there's no reason Raid couldn't have been done this way too.
Living with reality
But, unless we want to rewrite it, we live with what other folks write for us. RedHat has at least made part of the process a little easier by allowing you to easily clone a disk that has been prepared with software raid partitions. I found the following procedure the easiest for me:
First, let the installer automatically partition, but use only one drive. Check the box that lets you review and modify what it does. What it probably will give you is something similar to what it did with my hardware:
- A 102 MB /boot partition
- 256 MB or more of swap
- The rest of the disk for /
You may want to change this layout to make separate filesystems, but I didn't bother for this test box. See Filesystems and Switching to Linux for general ideas about file system sizing. Normally, /dev/hda1 ( or sda1) would be /boot, a2 is swap, and a3 is root.
Next, click Edit, and change each partition type to Software Raid. Your mount points will disappear, but what was more surprising to me when I did this was that the device names were changed - my /boot partition, which was /dev/hda1, became /dev/hda3. This confused me, but it got worse later. I continued with the other two partitions and made them Software Raid also. So now I had 3 Software Raid partitions, and you will have those or perhaps more.
Now click the Raid button. It offers you three choices, and the unchecked one at the bottom (Clone) is what you want. This just lets you quickly duplicate your partition setup onto your other drive. After doing this, your other drive has the same Software Raid partitions as your first drive has. That's a welcome time saver, of course, but I still see no reason why the whole process couldn't have been automated from the existing file system layout.
However, it is not, so you have still more work to do. Choose the RAID button again, and this time take the selected choice, which is to create a raid volume. This will be /dev/md0 by default, and I can't think of any reason why you'd want to change that. You have to do three things in this section: pick the Software Raid partitions that this device will use, set the mount point, and set the type of raid you want. For mirroring, you want RAID 1, and you'll probably pick your original /boot partition for this first raid device. Remember that the mount points disappeared when we changed these to software raid, so you pick it out by size. Do you recall that I said that the /boot partition had changed to /dev/hda3? Well, in here, it's changed back and is still hda1! That was a surprise.
You will now pick the partitions that /dev/md0 will use. It only makes sense that you will pick one partition from each drive, and you will of course pick equally sized partitions. By default, all software raid partitions are selected; you need to uncheck the ones you will later assign to other logical devices and other filesystems.
So, pick /dev/hda1 and /dev/hdb1 to make your mirror. You can also now change the filesystem type (it defaults to ext3) if you like. Repeat this for /dev/md1 (swap) and md2 (/ on my system).
In this simple setup, I didn't make room for any spare partitions. You could do that on another drive, and if one of these failed, that spare would automatically take over.
The installation now proceeds normally. To me, this seemed like much more effort than it needed to be. First, it would be far more logical to treat this as a hardware raid would: select the disks, choose the type of raid, and proceed from there. You'd divide the logical device into your desired file systems, and whatever was necessary underneath would be done for you. The present method does offer the flexibility of NOT mirroring some partitions but the cost of that is a much more difficult installation. Of course, there's no reason you couldn't have both: a simple, "just do it" install wizard, or a more gritty method for special needs. The automatic raid would have to make its own decisions about underlying fdisk partitions, but so what? Most of us don't care about such details anyway.
After the install, you can examine /etc/raidtab to see the details of what was done. The man page for that describes it fairly well. Here's what it looks like for the system described in this article:
raiddev /dev/md2 raid-level 1 nr-raid-disks 2 chunk-size 64k persistent-superblock 1 nr-spare-disks 0 device /dev/hda2 raid-disk 0 device /dev/hdb2 raid-disk 1 raiddev /dev/md0 raid-level 1 nr-raid-disks 2 chunk-size 64k persistent-superblock 1 nr-spare-disks 0 device /dev/hda1 raid-disk 0 device /dev/hdb1 raid-disk 1 raiddev /dev/md1 raid-level 1 nr-raid-disks 2 chunk-size 64k persistent-superblock 1 nr-spare-disks 0 device /dev/hda3 raid-disk 0 device /dev/hdb3 raid-disk 1
(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version