centos4.2 -raid 1 and grub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I had this little shell script.

Use at your own risk...

Jerry
---------

# To load a blank drive with the old partition information use the command:
# sfdisk /dev/hda < /etc/silentm/raidinfo.partitions.hda

# The following command will setup the passed argument to boot in case 
the main disk is faulty
# $1 is either /dev/hdb or /dev/sdb
grub_setup_scsi()
{
grub << EOF
find /boot/grub/stage1
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)
EOF
}

grub_setup_ide()
{
grub << EOF
find /boot/grub/stage1
device (hd0) /dev/hdb
root (hd0,0)
setup (hd0)
EOF
}

DISK_TYPE=`fdisk -l /dev/hda | grep "/dev/hda"`

if [ "$DISK_TYPE" = "" ]
then
        echo "Assuming SCSI drives"

        sfdisk -d /dev/sda > /etc/silentm/raidinfo.partitions.sda
        sfdisk -d /dev/sdb > /etc/silentm/raidinfo.partitions.sdb

        grub_setup_scsi

else
        echo "Assuming IDE drives"

        sfdisk -d /dev/hda > /etc/silentm/raidinfo.partitions.hda
        sfdisk -d /dev/hdb > /etc/silentm/raidinfo.partitions.hdb

        grub_setup_ide
fi

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux