Quote:
Originally Posted by wdk23411
I had installed the slackware12 on the raid0 driven by the dmraid. But how could I boot from it use the grub instead of the Lilo.
|
In order to boot from a RAID 0 array, it has to be created and used on a hardwre RAID controller (or fake hardware RAID controller). Those have a BIOS ROM that loads during the computer BIOS startup. The BIOS ROM allows booting from a RAID array. GRUB uses the BIOS to read the Linux kernel into memory.
Download
Grub Legacy
Extract the files from the tarball to a directory under /usr/src and then follow the instructions to make grub.
Copy the required boot files to /boot/grub and then create a "menu.lst" file.
Code:
default 0
timeout 5
title Linux
root (hd0,2)
kernel /boot/vmlinuz vga=773 root=/dev/sdr1 load_ramdisk=1 ramdisk_size=4096
initrd /boot/initrd.gz
title Windows XP
rootnoverify (hd0,0)
chainloader +1
NOTE: Change "/dev/sdr1" to the correct root device.
Use the command "info grub" to find out how to make a GRUB boot floppy, or a GRUB boot CD. Boot grub from floppy or CD and press C to enter the command mode of GRUB.
Use these commands to install GRUB to your master boot record or partition boot sector.
To install to MBR:
root (hd0,0)
setup (hd0)
To install to partition boot sector:
root (hd0,0)
setup (hd0,0)
If your Linux partition containing GRUB is in some other location then change "(hd0,0)".
First Hard Disk, First Primary partition - (hd0,0)
First Hard Disk, Second Primary partition - (hd0,1)
First Hard Disk, Third Primary partition - (hd0,2)
First Hard Disk, Fourth Primary partition - (hd0,3)
First Hard Disk, First Logical partition - (hd0,4)
First Hard Disk, Second Logical partition - (hd0,5)
I repeated some of the information that I already posted with a bit more detailed instructions below.
In order for Linux to boot from a "dmraid" device, it is necessary to use an "initrd" RAM disk to run "dmraid". First, use "mkinitrd" to create "/boot/initrd.gz". Next, edit the file "/boot/initrd-tree/init" and add the line to run "dmraid" as shown below in
bold. After editing the file, use "mkinitrd" again with no options or parameters to create "initrd.gz" again using the modified "init".
Code:
INITRD=`cat /initrd-name`
ROOTDEV=`cat /rootdev`
ROOTFS=`cat /rootfs`
LUKSDEV=`cat /luksdev`
# Mount /proc and /sys:
mount -n proc /proc -t proc
mount -n sysfs /sys -t sysfs
# Load kernel modules:
if [ ! -d /lib/modules/`uname -r` ]; then
echo "No kernel modules found for Linux `uname -r`."
elif [ -x ./load_kernel_modules ]; then # use load_kernel_modules script:
echo "${INITRD}: Loading kernel modules from initrd image:"
. ./load_kernel_modules
else # load modules (if any) in order:
if ls /lib/modules/`uname -r`/*.*o 1> /dev/null 2> /dev/null ; then
echo "${INITRD}: Loading kernel modules from initrd image:"
for module in /lib/modules/`uname -r`/*.*o ; do
insmod $module
done
unset module
fi
fi
# Initialize LVM:
if [ -x /sbin/vgscan ]; then
/sbin/vgscan --mknodes --ignorelockingfailure
sleep 10
/sbin/vgchange -ay --ignorelockingfailure
fi
# Make encrypted partitions available:
# The useable device will be under /dev/mapper/
if [ -x /sbin/cryptsetup ]; then
if /sbin/cryptsetup isLuks ${LUKSDEV} ; then
/sbin/cryptsetup luksOpen ${LUKSDEV} $ROOTDEV </dev/systty >/dev/systty 2>&1
ROOTDEV="/dev/mapper/${ROOTDEV}"
fi
fi
# Find any dmraid detectable partitions
dmraid -ay
# Switch to real root partition:
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -o ro -t $ROOTFS $ROOTDEV /mnt
if [ ! -r /mnt/sbin/init ]; then
echo "ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahead."
exit 1
fi
unset ERR
umount /proc
umount /sys
echo "${INITRD}: exiting"
exec switch_root /mnt /sbin/init $@
The "dmraid" program creates very long device names under "/dev/mapper". Also, those devices don't exist in "/dev" of the Linux root partition. I found that it was easier to create some fake device names such as "/dev/sdr1" using the correct major and minor unit numbers corresponding to the names under "/dev/mapper". Only two permanent names are required, one for the root partition and one for the swap partition. Those have to be created when UDEV isn't running because they are used before UDEV starts.
Once UDEV starts you also need to have names for your disks. I created a file called "/etc/udev/rules.d/10-local.rules" to create some fake device names.
Code:
KERNEL=="dm-2", NAME="sdr"
KERNEL=="dm-3", NAME="sdr1"
KERNEL=="dm-4", NAME="sdr3"
KERNEL=="dm-5", NAME="sdr5"
KERNEL=="dm-6", NAME="sdr6"
Your file will probably be slightly different.
By using the fake device names, the "/etc/fstab" file can refer to the partitions. It's very important that the permanent names created for the root and swap partitions are the same as the names created later by UDEV. The "/etc/fstab" file is used before UDEV starts and also after UDEV starts.