port a system to SATA RAID controlled by SIL3114

发表于:2007-06-08来源:作者:点击数: 标签:
this message discribe how to port an existing Linux system to a SATA RAID hard disk two import ant key steps: manually install grub to RAID. patch mkinitrd [for distribution of Redhat]. Steps to port an existed system to SATA RAID: Prepare
this message discribe how to port an existing Linux system to a SATA RAID hard disk

two important key steps:

manually install grub to RAID.
patch mkinitrd [for distribution of Redhat].




Steps to port an existed system to SATA RAID:

 

  1. Prepare an auxiliary hard disk with a system installed, for example, EL4.
  2. Make Stripe (RAID 0) with the help of utility of Silicon Image at the stage right after Power on self test and before the start of grub.
  3. Boot up the EL4 host on the auxiliary hard disk.
  4. Active the RAID with the help of dmraid, and the new device called /dev/dm-0 can be seen.
  5. Use fdisk or parted to slice hard disk partitions on device of /dev/dm-0. Typically one for /boot, the other on for swap, and the last one for /, don’t forget to active boot flag of the partition for /boot. After doing that, device called /dev/dm-1, /dev/dm-2 and /dev/dm-3 can be seen, also device mapper under /dev/mapper appears. For controller of SIL 3114 CTU, there are sil_afageidcdibjb and sil_afageidcdibjb1 etc.
  6. Make file system on /dev/dm-1 and /dev/dm-3 with the utility of mkfs.
  7. Mount /dev/dm-1 foo and mount /dev/dm-3 bar.
  8. Copy all files under /boot to foo and files under / to bar, with cp –au, like cp -au /boot foo. For the copying of /, the top level directories need to be copied separately to exclude the mount point of /dev/dm-1 and mount point of /dev/dm-3.
  9. manually install GRUB to the device of dm-0, like:

9.1      Call grub --device=/dev/null to enter grub shell.

9.2      Grub>device /dev/mapper/sil_afageidcdibjb (hd0) [Caution: can’t use /dev/dm-0 here]

9.3      Grub>geometry (hd0) [check if the right device is mapped to (hd0), if it is right, you can see that there are three partitions]

9.4      Grub>root (hd0,0) [suclearcase/" target="_blank" >ccessfully execution, grub can recognize the file system on /dev/dm-1]

9.5      Grub>setup (hd0) [install the grub to /dev/dm-0, ie. /dev/mapper/sil_afageidcdibjb , every stage should be successful]

9.6      Grub>quit

 

Note: before install the grub, the grub.conf may be kept as simple as possible. It is better to comment some options like splashimage and hiddenmenu to ensure the successfully display of the grub menu after reboot.

 

  1. Copy the dmraid.static to /sbin. This utility is the static link version of dmraid and is needed at intird stage. It is not included in the distribution of EL4, but it can be found at the distribution of Fedora4, just copy it.
  2. Path the mkinird, see the attachment.
  3. make initrd with mkinitrd, like mkinitrd initrd.new `uname –r`
  4. copy the initrd.new to foo.
  5. edit the foo/grub/grub.conf to provide entry of current kernel and the new initrd.img. Like:

 

title SATA RAID

root (hd0,0)

kernel /vmlinuz-2.6.9-5……     root=/dev/dm-3  ….

initrd  /initrd.new

 

  1. Edit the bar/ect/fstab to change the device of root file system, like:

 

            /dev/dm-3          /           ext3      defaults 1  1

            /dev/dm-1          /boot     ext2      defaults  1  2

            /dev/dm-2          swap     swap     defaults  0  0

………………………………

 

  1. halt –p to stop the current system.
  2. Detach the auxiliary hard disk. And re-power on the machine. Enjoy it!
patch for /sbin/mkinitrd

--- mkinitrd    2004-10-25 06:01:52.000000000 +0800
+++ mkinitrd.new    2005-07-01 07:12:33.000000000 +0800
@@ -733,6 +733,18 @@ elif [ -n "$root_lvm" ]; then
   fi
 fi
 
+#add to active dmraid
+if [ -x /sbin/dmraid.static -a -x /sbin/dmsetup -a -e /dev/mapper/control ]; then
+ dmout=$(/sbin/dmsetup ls  2>/dev/null)
+ if [ "$dmout" != "No devices found" -a "$dmout" != "" ]; then
+    inst /sbin/dmraid.static $MNTIMAGE/sbin/dmraid
+          echo "echo Making device-mapper control node" >> $RCFILE
+    echo "mkdmnod" >>$RCFILE
+    echo "echo Running dmraid to active reid" >>$RCFILE
+    echo "/sbin/dmraid -ay" >>$RCFILE
+ fi
+fi
+
 echo "echo Creating root device" >> $RCFILE
 echo "mkrootdev /dev/root" >> $RCFILE
 rootdev=/dev/root

原文转自:http://www.ltesting.net