Scripted RAID config
Peter Eisch
peter at boku.net
Thu Oct 7 21:19:14 UTC 2004
In the Customization Guide there's an example for how to sniff out drives on
a system, but that's really only pertinent to IDE-interface devices. Is
there a similarly clever way to scan scsi controllers?
I'd like to do the same as this:
for file in /proc/ide/h*
do
mymedia=`cat $file/media`
if [ $mymedia == "disk" ] ; then
hds="$hds `basename $file`"
fi
done
...
I suppose that I could just change the $numhd test to be -lt 2. Here is
what I've found to be quite handy:
#!/bin/sh
hds=""
mymedia=""
for file in /proc/ide/h*
do
mymedia=`cat $file/media`
if [ $mymedia == "disk" ] ; then
hds="$hds `basename $file`"
fi
done
set $hds
numhd=`echo $#`
if [ $numhd == "1" ] ; then
#1 drive
echo "#partitioning scheme generated in %pre for 1 drive" > \
/tmp/part-include
echo "zerombr yes" >> /tmp/part-include
echo "clearpart --all --initlabel" >> /tmp/part-include
echo "part /boot --fstype ext3 --size 50" >> /tmp/part-include
echo "part swap --recommended" >> /tmp/part-include
echo "part / --fstype ext3 --size 1 --grow" >> /tmp/part-include
else
#2 drives
echo "#partitioning scheme generated in %pre for 2 drives" > \
/tmp/part-include
echo "zerombr yes" >> /tmp/part-include
echo "clearpart --all --initlabel" >> /tmp/part-include
drive=0
bootdevs=''
rootdevs=''
for pdev in $hds
do
bootp=raid."$drive"1
rootp=raid."$drive"2
bootdevs="$bootdevs $bootp"
rootdevs="$rootdevs $rootp"
echo "part $bootp --size 50 --ondisk $pdev" >> /tmp/part-include
echo "part $rootp --size 1 --grow --ondisk $pdev" >> /tmp/part-include
echo "part swap --recommended --ondisk $pdev" >> /tmp/part-include
let drive=$drive+1
done
echo "raid /boot --level=1 --device=md0 --fstype ext3 $bootdevs" >> \
/tmp/part-include
echo "raid / --level=1 --device=md1 --fstype ext3 $rootdevs" >> \
/tmp/part-include
fi
More information about the Kickstart-list
mailing list