The objective of this procedure is to produce an installation of Linux that is fully mirrored for redundancy. This procedure was performed using RHEL 5.1, but is applicable to any Red Hat based version of Linux, and probably most others as well.
This document describes the procedure for creating RAID 1 arrays under Linux with two hard drives. The hard drives should be equal in size. This procedure must be performed during installation of Linux. It is possible to create software RAID arrays with drives or partitions added after the initial installation, but the OS itself will not then be mirrored.
This procedure results in two software RAID 1 arrays. One array is 256MB for /boot and is an ext3 partition. The second array uses the rest of the space on the drives as a single Volume Group which is subdivided into Logical Volumes for the rest of the Linux File System Hierarchy structure.
Modifying the Disk Layout During Installation
During the installation procedure the disk partitioning layout screen is displayed with several options. Be sure to choose Create custom layout in the selection bar near the top of the screen.
Creating the software RAID partitions
The first step to perform during Red Hat installation is to delete any existing partitions. Then create the software RAID partitions using the following steps.
- Create 1 software RAID partition of 256MB on each drive.
- Create a RAID 1 partition with mount point of /boot and /dev/md0 from the two 256MB partitions.
- Create 1 software RAID partition of all remaining space on each drive.
- Create RAID 1 device with filetype LVM PV (Physical Volume) from larger two software RAID devices as /dev/md1.
Creating the Logical Volumes
Use Logical Volume Manager to create the rest of the filesystems as Logical Volumes.
Create a Volume Group (VG) of the entire /dev/md1 device. The default name is VolumeGroup00 which is fine.
Now edit this VG and create Logical Volumes (LV) for the file systems you want to make. I usually create the following file systems and name the after the format Vol, for example homeVol.
|Mount Point||Volume Name|
Naming the LVs likes this makes recovery much easier if it becomes necessary. Starting with about Fedora 17, the Fedora distribution does create usable volume names that are combined with the Volume Group name so that the device name becomes human understandable, such as vg_enterprise-lv_var.
If your Volume Group is sufficiently large, you can leave extra space free so that existing Logical Volumes can be expanded should they become full.