Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Site Navigation
Linux Forums
Linux Articles
Product Showcase
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Free Publications

How to have both boot disks bootable after setting up / installing a (software) mirrored boot disk.

AS5 Boot Disk Software Mirror

** NOTE:  Not all drives are made BOOTABLE automatically. (Only the 1stdrive.)  Mirrored (second) drives and replacement drives must be madebootable MANUALLY. See below.

Some of the high performance blade servers do not allow for the hardware raid controller to be used.

In order to provide some redundancy, the software raid abilities ofRedhat Linux AS5 has been explored with the following results.

Setup the OS

If you run kickstart in GRAPHICAL mode, there are RAID optionsavailable.  For our purposes, we elected to create three mirror volumes(/swap, /boot, and /).
Adding the following to a kickstart file will achieve this.  (Assumption:  2 disk are available)

clearpart --all --initlabel --drives=sda,sdb
part raid.9 --size=100 --ondisk=sda
part raid.15 --size=100 --ondisk=sdb
part raid.13 --size=32768 --ondisk=sdb
part raid.11 --size=32768 --ondisk=sda
part raid.14 --size=100 --grow --ondisk=sdb
part raid.12 --size=100 --grow --ondisk=sda
raid /boot --fstype ext3 --level=RAID1 --device=md0 raid.9 raid.15
raid swap --fstype swap --level=RAID1 --device=md1 raid.11 raid.13
raid / --fstype ext3 --level=RAID1 --device=md2 raid.12 raid.14

/boot is set to a size of 100  (md0)
swap is set to a size of 32768 (md1)
/ is set to the remaining disk space (md2)

Mote: The swap size above is unusually large due to some site specific requirements.

Raid Disk Status & Recovery

Once the system is up and running, the status of the mirror devices may be seen via the command,

# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
      104320 blocks [2/2] [UU]
md1 : active raid1 sdb2[1] sda2[0]
      33551680 blocks [2/2] [UU]
md2 : active raid1 sdb3[1] sda3[0]
      28860672 blocks [2/2] [UU]
unused devices: <none>

In this example, one of the drives has failed...,

# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[1]
      104320 blocks [2/1] [_U]
md1 : active raid1 sda2[1]
      33551680 blocks [2/1] [_U]
md2 : active raid1 sda3[1]
      28860672 blocks [2/1] [_U]
unused devices: <none>

Note:  after a reboot, the surviving drive will always be 'a',regardless of whether it was drive 'a' or 'b' in the healthy system.

In this example, only one partition is unmirrored..

# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
      104320 blocks [2/2] [UU]
md1 : active raid1 sdb2[1] sda2[0]
      33551680 blocks [2/2] [UU]
md2 : active raid1 sdb3[1]
      28860672 blocks [2/1] [_U]
unused devices: <none>

In the event that a partition needs to be (re)added to a mirrored device (drive replacement), the following command may be used,

# mdadm -a /dev/md2 /dev/sda3

Making the 2nd Drive Bootable (and ANY Replacement drives!)

For whatever reason, the 2nd drive does not have a (useful) master bootblock in place after the OS is installed.  You may verify this bydisconnecting the 1st drive and attempting to boot.  The console willdisplay the following error,

Attempting Boot From Hard Drive (C:)
GRUB Hard Disk Error

After many experiments, the following sequence appears to correct theproblem, and results in the system being bootable from either(surviving) hard drive.
(If replacing the 1st drive, replace all "hd1" values below with "hd0" (zero).)

 # grub --batch --device-map=/boot/grub/device.map --config-file=/boot/grub/grub.conf --no-floppy

    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]
grub> root (hd1,0)
root (hd1,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd1)
setup (hd1)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd1)"...  15 sectors are embedded.
 Running "install /grub/stage1 (hd1) (hd1)1+15 p (hd1,0)/grub/stage2 /grub/grub.conf"... succeeded
grub> quit

Monitoring Software

The mdadm process automatically runs and monitors array status.

By  default, any problems will be reported via email to root.  Tochange this, edit the /etc/mdadm.conf file and update the line,


to reflect the destination email address you desire.

Rate This Article: poor excellent
Comments about this article

Comment title: * please do not put your response text here