Title: Re: generic ks.cfg to auto-partition raid0 on X number of disks.
On 1/13/05 10:55 PM, "Rishi" <usergroups@xxxxxxxxxxxxxxxxxxx> wrote:
...
>
> The above works fine with one or two disks... But when I add a 3rd disk, it
> does not auto-magically use that space to include in the /backup partition...
>
You may find what I do useful. Getting it to what you want for the /backups could be a simple exercise for you from here.
%pre
#!/bin/sh
hds=`awk '{print $4}' < /proc/partitions |grep sd[a-z]$`
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 -le "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
# cannot RAID5 /boot, altogether now, "awwwww"
echo "raid /boot --level=1 --device=md0 --fstype ext3 $bootdevs" >> /tmp/part-include
if [ $numhd -gt 2 ]; then
echo "raid / --level=5 --device=md1 --fstype ext3 $rootdevs" >> /tmp/part-include
else
echo "raid / --level=1 --device=md1 --fstype ext3 $rootdevs" >> /tmp/part-include
fi
fi