Use anaconda procedure for partiton and format a new HD

Shabazian, Chip Chip.Shabazian at bankofamerica.com
Tue Sep 27 18:13:05 UTC 2005


Yes, we only have two definitions in our environment depending on
whether you have one or two+ disks (or in our case, hardware RAID
volumes).

There are MANY different things you can do, from defining a 3, 4, 5,
.... drive environment to dynamically generating the partition
information based on the number of drives you have.

The keys here are to use the %include for your partinfo, and to figure
out some way to determine the number of drives you have and what devices
they are.  The nice thing (for us) about list-harddrives is that it
works with all of the drives in our environment (cciss, sda, had)

The key to list-harddrives is that the ODD numbers are the devices, and
the EVEN numbers are the sizes of the devices (in case you want to
figure out if you have enough space for what you want to do, or
partition based on the size of the drive)

Chip

-----Original Message-----
From: kickstart-list-bounces at redhat.com
[mailto:kickstart-list-bounces at redhat.com] On Behalf Of Peter Eisch
Sent: Tuesday, September 27, 2005 11:03 AM
To: Discussion list about Kickstart
Subject: Re: Use anaconda procedure for partiton and format a new HD

On 9/27/05 12:36 PM, "Shabazian, Chip"
<Chip.Shabazian at bankofamerica.com>
wrote:

...
> # Determine how many drives we have
> set $(list-harddrives)
> let numd=$#/2
> d1=$1
> d2=$3
> 
> # This is the scheme for two or more drives
> 
> if [ $numd -ge 2 ] ; then
> cat << EOF >> /tmp/partinfo
> part pv.01 --size=1 --grow --fstype=ext3 --ondisk=$d1
> volgroup volgrp01 pv.01
> part pv.02 --size=1 --grow --fstype=ext3 --ondisk=$d2
> volgroup volgrp02 pv.02

That would only use the first two drives.  If I detect multiple disks, I
loop over them.  This was on a 7.3 (pre list-harddrives and logical
volume
manager vintage) installer.  Updating it with logval should be somewhat
trivial.  (Of course, $hds contains a list of the available drives, but
determining that seems to be outside the scope of this thread.)

  echo "zerombr yes" >> /tmp/partinfo
  echo "clearpart --all --initlabel" >> /tmp/partinfo
  drive=0
  bootdevs=''
  rootdevs=''
  for pdev in $hds
  do
    bootp=raid."$drive"1
    rootp=raid."$drive"2
    bootdevs="$bootdevs $bootp"
    rootdevs="$rootdevs $rootp"
    cat << EOF >> /tmp/partinfo
    part $bootp --size 50 --ondisk $pdev"
    part $rootp --size 1 --grow --ondisk $pdev"
    part swap --recommended --ondisk $pdev"
    EOF
    let drive=$drive+1
  done
  echo "raid /boot --level=1 --device=md0 --fstype ext3 $bootdevs" >>
/tmp/partinfo
  if [ $numhd -gt 2 ]; then
    echo "raid / --level=5 --device=md1 --fstype ext3 $rootdevs" >>
/tmp/partinfo
  else
    echo "raid / --level=1 --device=md1 --fstype ext3 $rootdevs" >>
/tmp/partinfo
  fi

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




More information about the Kickstart-list mailing list