RE: some help needed with python script to detect number of drives in kickstart file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Your problem is probably in your partitioning schemes.  Try building
with each scheme via kickstart.  If they work then the problem is
probably in your logic, where I already see one issue.  set two drives
to -eq, not -ge as 3 is always greater than 2.

-----Original Message-----
From: kickstart-list-bounces@xxxxxxxxxx
[mailto:kickstart-list-bounces@xxxxxxxxxx] On Behalf Of Rudi Ahlers
Sent: Friday, March 28, 2008 2:16 PM
To: Discussion list about Kickstart
Subject: Re: some help needed with python script to detect number of
drives in kickstart file

Michael DeHaan wrote:
> Rudi Ahlers wrote:
>> Hi all
>>
>> I would like to put together a kickstart script which will allow me 
>> to install CentOS on many different platforms, regardless of the 
>> number & types of drive installed. If the system has 3 drives, I'd 
>> like to setup RAID 1 + 1 hot spare, for example. If it has 4 HDD's, 
>> then I'd like to setup RAID10, and for 10 HDD's, RAID 50.
>>
>> So, after trying many different options, I still can't get it to 
>> work, but recently found the following website, 
>> http://evuraan.blogspot.com/2005/02/auto-finding-your-hard-drives-for
>> .html which basically outlines a way to determine how many drives are

>> in the machine, but it's very basic.
>>
> This script is a bit overkill.   From cobbler's snippets directory, I 
> have this for default drive selection code.  You will have do a bit 
> more get RAID auto-configured, but that is left as an exercise for the

> reader.
>
> %include /tmp/partinfo
>
> %pre
> # Determine how many drives we have
> set \$(list-harddrives)
> let numd=\$#/2
> d1=\$1
> d2=\$3
>
> cat << EOF > /tmp/partinfo
> part / --fstype ext3 --size=1024 --grow --ondisk=\$d1 --asprimary part

> swap --size=1024 --ondisk=\$d1 --asprimary EOF
>
>
I've tried that example already, as well, but the partitions never get
created, with the more advanced code below:

set $(list-harddrives)
let numd=$#/2 # This will provide the total # of drives
d1=$1 # This is the device of disk 1
d2=$3 # This is the device of disk 2, etc.
d3=$5
d4=$7
d5=$9
S1=$2 # This is the size of disk 1
S2=$4 # This is the size of disk 2, etc.
S3=$6
S4=$8
S5=$10


# This would be a partition scheme for three or more drives if [ $numd
-ge 3 ] ; then cat << EOF >> /tmp/partinfo
part raid.11    --size 200      --asprimary     --ondrive=$d1
part raid.12    --size 2048     --asprimary     --ondrive=$d1
part raid.13    --size 1 --grow                 --ondrive=$d1

part raid.21    --size 200      --asprimary     --ondrive=$d2
part raid.22    --size 2048     --asprimary     --ondrive=$d2
part raid.23    --size 1 --grow                 --ondrive=$d2

part raid.31    --size 200      --asprimary     --ondrive=$d3
part raid.32    --size 2048     --asprimary     --ondrive=$d3
part raid.33    --size 1 --grow                 --ondrive=$d3

raid /boot      --fstype ext3 --device md0 --level=RAID1 raid.11 raid.21

raid.31 --spare=1
raid swap       --fstype swap --device md1 --level=RAID1 raid.12 raid.22

raid.32 --spare=1
raid pv.01      --fstype ext3 --device md2 --level=RAID1 raid.13 raid.23

raid.33 --spare=1

logvol /                --vgname=sysvg  --size=3072     --name=root
logvol /usr             --vgname=sysvg  --size=8192     --name=usr
logvol /tmp             --vgname=sysvg  --size=1024     --name=tmp
logvol /var             --vgname=sysvg  --size=8192     --name=var
logvol /home            --vgname=sysvg  --size=20480    --name=home
logvol /bck             --vgname=pv.02  --size=1 --grow --name=bck

EOF
elif [ $numd - ge 2 ]; then
cat << EOF >> /tmp/partinfo
part /boot     --fstype ext3 --size=150  --ondisk=$d1
part swap                    --size=4092 --ondisk=$d1,$d2
part pv.01     --fstype ext3 --size=100  --grow --ondisk=$d1
part pv.02     --fstype ext3 --size=100  --grow --ondisk=$d2


logvol /                --vgname=sysvg  --size=3072     --name=root
logvol /usr             --vgname=sysvg  --size=8192     --name=usr
logvol /tmp             --vgname=sysvg  --size=1024     --name=tmp
logvol /var             --vgname=sysvg  --size=8192     --name=var
logvol /home            --vgname=sysvg  --size=20480    --name=home

EOF
else
cat << EOF >> /tmp/partinfo
part /boot     --fstype ext3 --size=150  --ondisk=$d1
part swap                    --size=4092 --ondisk=$d1
part pv.01     --fstype ext3 --size=100  --grow --ondisk=$d1

logvol /                --vgname=sysvg  --size=3072     --name=root
logvol /usr             --vgname=sysvg  --size=8192     --name=usr
logvol /tmp             --vgname=sysvg  --size=1024     --name=tmp
logvol /var             --vgname=sysvg  --size=8192     --name=var
logvol /home            --vgname=sysvg  --size=20480    --name=home

EOF
fi


-- 

Kind Regards
Rudi Ahlers
CEO, SoftDux

Web:   http://www.SoftDux.com
Check out my technical blog, http://blog.softdux.com for Linux or other
technical stuff, or visit http://www.WebHostingTalk.co.za for Web
Hosting stuff

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux