Setup Root on Softraid
Knowledgebase
Request
You would like to setup your system so you have your root filesytem on Raid1 and you would like to be able to boot from both harddrives in case there is any drive failure.
Your system is an Power5 machine and you would like to implement this on a Linux LPAR with Virtual SCSI clients from a VIO Server.
In this we assume that you have 2 Harddrives and you need only the root partition to be on Raid1. If you need to setup /usr et al separat on Raid1 on a different partition you just add these to another md device.
You can only use Raid1 for the root partition, not Raid5 as the kernel can only boot from Raid0 or Raid1.
Procedure
Setup the LPAR via HMC so it gets two virtual SCSI Clients from your VIO Server.
Start the Installation with Service Pack 2 for SLES9 PowerPC.
Setup the Harddrive in custom partitioning to the following
sda1 24MB Prep Boot Partition sda2 512MB FD Linux Raid Autodetect sda3 15GB FD Linux Raid Autodetect sdb1 24MB FAT16 Partition sdb2 512MB FD Linux Raid Autodetect sdb3 15GB FD Linux Raid Autodetect
Following this you add the Raid Devices in the same yast menu.
Create md0 and add sda2 and sdb2, setup md0 for swap. The reason for this is easily missed. If your harddrive fails and you have swap NOT on Raid1 then all information stored by the systm in swap will be lost and in 99% of all cases this will send your system screaming to hell.
Create md1 and add sda3 and sdb3, setup md1 for the Root filesystem, use reiserfs or ext3 as filesystem.
Continue with installation normally.
After the initial reboot of the installation the system might not boot, it hangs forever in the scan for bootable devices in the SMS Menu of your LPAR.
You fix this by restarting the LPAR from the HMC, entering the SMS Menu and select:
5. Select Boot Options 1. Select Install/Boot Device 5. Hard Drive 1. SCSI
and now your first harddrive.
The System will boot now, you can run Yast Online update if you want.
Once in the installed system you edit /etc/init.d/boot.local and add:
echo "10000" > /proc/sys/dev/raid/speed_limit_min
issue then:
echo "10000" > /proc/sys/dev/raid/speed_limit_min
on the command line. The reason for this is that you would like your md sync to be faster than the default and your Power5 machine has no troubles with this value. It will be applied at boottime from now on.
Wait for the end of the sync by issuing:
watch cat /proc/mdstat
After the sync is done you execute this script or issue the commands on the command line:
#!/bin/bash mkinitrd lilo echo " *** " echo "Copying contents of sda1 to sdb1" echo " *** " dd if=/dev/sda1 of=/dev/sdb1 echo " *** " echo "Setting sdb1 to FAT16" echo " *** " parted /dev/sdb set 1 type 6 echo " *** " echo "Making sdb1 bootable" echo " *** " parted /dev/sdb set 1 boot on primary=$(show_of_path.sh /dev/sda) echo $primary secondary=$(show_of_path.sh /dev/sdb) echo $secondary echo " *** " echo "Setting new bootlist" echo " *** " bootlist -m normal $primary:1,yaboot $secondary:1,yaboot
This script assumes that you are working only with sdb and sda, if you have a different setting, then you have to change it accordingly.
The reason to write a script for this is that the Kernel is written into the FAT Partition by lilo, together with yaboot and yaboot.cnf. So you have to run this script every time you do a kernel update, as otherwise you will have a different Kernel and initrd on sda1 and sdb1.
After this you will see both partitions in the SMS menu and will be able to boot from both partitions into the system
If you have any troubles applying this information or any recommendation please feel free to contact me.
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.