This article addresses an approach for setting up of software (mdraid) RAID1 at install time on systems without a true hardware RAID* controller. It is NOT supported by the CentOS project; it is NOT a recommended approach for non-hobby users. Rather this article is written to document an approach involving much local
experimentation, to end up with a fragile result that is not updated when a software update installs a new kernel. We do NOT recommend it. Years of experience demonstrate that is is highly likely that you WILL forget to do a bootloader refresh, and run a greater risk of losing data, than the theoretical risk of a hard drive failure. .
Section One
- Disable any fake RAID in the motherboard or RAID controller BIOS so that it acts as a normal controller – usually either ATA or SATA, possibly SCSI. It may be necessary to overwrite the partition tables if fake raid has previously been used on the disks. Do not load a RAID driver. The following commands may be performed on the 2nd virtual console (Ctrl-Alt-F2) during a graphical install before partitioning, or booted in rescue mode from installation media, or from a LiveCD. The partition tables of the devices will be zeroed out and all contents of the drives lost!
- dd if=/dev/zero of=/dev/sda bs=512 count=64
- dd if=/dev/zero of=/dev/sdb bs=512 count=64
- Begin graphical installation of CentOS. May need to use “boot: linux nodmraid” or Press [Tab] at the initial installation selection menu and add nodmraid to the boot commands.
- Customize partitions and remove all partitions, including LVMs, for a fresh start
- Create an ~100MB software RAID partition on sda and sdb for /boot
- Create a software RAID partition on sda and sdb for swap. This partition size is based on the amount of RAM and personal preferences. The example uses 1GB. This is going to be RAIDed swap.***
- Create a software RAID partition on sda and sdb for / and fill to maximum allowable size
- Click the RAID button, create a RAID device
- Pick the two 100MB partitions, mount point /boot, filesystem type ext3, RAID1 (default RAID device should be md0), click OK
- Click the RAID button, create a RAID device
- Pick the two 1GB partitions, filesystem type swap, RAID1 (default RAID device should be md1), click OK
- Click the RAID button, create a RAID device
- Pick the two large partitions, mount point /, filesystem type ext3, RAID1 (default RAID device should be md2), click OK
- Your partitions are complete. Your screen should look similar to this:
- RAID Devices
- /dev/md0 ext3 [check mark] 100
- /dev/md1 swap [check mark] 1024
/dev/md2 ext3 [check mark] [lots of GBs]
Hard Drives
/dev/sda
/dev/sda1 /dev/md0 software RAID [no check mark] 100
/dev/sda2 /dev/md1 software RAID [no check mark] 1024
/dev/sda3 /dev/md2 software RAID [no check mark] [lots of GBs]
/dev/sdb
/dev/sdb1 /dev/md0 software RAID [no check mark] 100
/dev/sdb2 /dev/md1 software RAID [no check mark] 1024
/dev/sdb3 /dev/md2 software RAID [no check mark] [lots of GBs]
- Click next to go to the GRUB bootloader screen.
- It should default to installing GRUB to /dev/sda, click Next
- Continue installing CentOS, selecting desired packages
- Proceed to Section Two after CentOS is installed and the system has been rebooted. Do not update CentOS, do not do anything else!
Section Two
This will assure that both members of the RAID1 /boot are bootable. Repeat after a disk failure/replacement.
Method 1 – in GRUB at boot
Stop at the GRUB menu and enter the “c” option, which gives you the GRUB prompt. Then:
- grub> root (hd1,0)
- grub> setup (hd1)
- grub> root (hd0,0)
- grub> setup (hd0)
Hit the ESC key to get back to the GRUB menu, and boot normally. Perform steps 1 and 5-8 in Method 2.
Method 2 – in GRUB on the running system
- Make sure you’re root.
- Input the command “/sbin/grub”, hit Enter
- Enter the following commands in the GRUB shell:
- grub> device (hd0) /dev/sda
- grub> device (hd1) /dev/sdb
- grub> root (hd0,0)
- grub> setup (hd0)
- grub> root (hd1,0)
- grub> setup (hd1)
- grub> quit
- Cross your fingers. Type in “reboot”, hit Enter.
- Once you’re booted up, do a system update.
- Reboot if the kernel or glibc was updated.
- Check that you’re actually running the updated kernel, if any, by typing “uname -a”, hit Enter
- Done!