[CentOS] centos4.2 -raid 1 and grub
Jerry Geis
geisj at pagestation.com
Sun Nov 27 22:46:05 UTC 2005
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
More information about the CentOS
mailing list