RHEL5u5 Software Mirroring /boot post install

Discussion in 'Technical' started by DantePasquale, Aug 25, 2010.

  1. DantePasquale

    DantePasquale HowtoForge Supporter

    If you have a moment can you look over this procedure and let me know if
    it will work OK. The problem I'm trying to solve is that during the RH5
    install, it let's you build software mirrors, but let's you only have
    one /boot ! We didn't leave an empty partition on the 2nd disk for /boot so the partition tables are out of sync.
    Danté

    ----------------------------

    I think the best way to do this is to destroy the mirror, repartition,
    add to the array and install grub onto the 2nd disk. The reason for this
    is that /boot has to be the first partition on a disk and we don't have
    a partition already reserved.

    Fail the mirror disk:

    Code:
    mdadm --manage /dev/md0 --fail /dev/sdb1
    mdadm --manage /dev/md1 --fail /dev/sdb2
    (continue for all raid devices)
    Remove the mirror disk:

    Code:
    mdadm --manage /dev/md0 --remove /dev/sdb1
    mdadm --manage /dev/md1 --remove /dev/sdb2
    (Continue for all raid devices)
    Verify that /dev/sdb is removed:

    cat /proc/mdstat

    Now we need to destroy the information mdadm puts in each device that it
    uses:

    Code:
    mdadm --zero-superblock /dev/sdb1
    mdadm --zero-superblock /dev/sdb2
    (Continue for all raid devices)
    
    Now, let's repartion /dev/sdb so that it looks like /dev/sda at least
    for the partitions we are interested in mirroring. NOTE: /boot has to be
    the first partition!

    Copy the partition table from sda to sdb

    Code:
    sfdisk -d /dev/sda | sfdisk /dev/sdb
    Verify that it has the correct partition table

    fdisk -l /dev/sdb

    Use fdisk interactively to set partition types to 0xfd Linux Raid Autodetect

    cat /proc/mdstat to verify that /dev/sda is still there.

    Check that /etc/mdadm.conf is accurate and shows that /dev/sdb has been
    removed:

    Code:
    cat /etc/mdadm.conf
    
    if /etc/mdadm.conf is not accurate:
    
    mdadm --examine --scan > /etc/mdadm.con
    Prepare Grub on the 2nd drive /dev/sdb; NOTE: grub calls the drives
    hd0,hd1,hd2 etc.

    Code:
    enter grub interactive:
    
    grub > root (hd1,0)
    grub > setup (hd1)
    grub > quit
    Now add /dev/sdb back into the raid devices using the new partitions:

    Code:
    /boot
      mdadm --add /dev/md0 /dev/sda1
    /
      mdadm --add /dev/md1 /dev/sdb2
    swap
      mdadm --add /dev/md2 /dev/sdb2
    Verify Mirroring is in Process:

    cat /proc/mdstat

    Then update /etc/mdadm.conf to reflect the newly partitioned /dev/sdb

    Code:
    mdadm --examine --scan  > /etc/mdadm.conf
    Update /boot/grub/menu.lst or /etc/grub.conf in order to have an entry
    to boot from the 2nd drive:

    add a stanza for /dev/sdb1 booting:

    copy current stanza and change hd0 to hd1. keep both so that you can
    boot off either if a drive fails.

    Then update the ramdisk:

    Code:
    mv /boot/initrd-`uname -r`.img /boot/initrd-`uname -r`.img_orig2
    mkinitrd /boot/initrd-`uname -r`.img `uname -r
    Reboot and test each stanza. Remove a drive and reboot off the remaining
    drive,
    Add that drive back and check mirroring to finish via: cat /proc/mdstat
     
: mdadm, raid, redhat 5

Share This Page