Questo contenuto non è disponibile nella lingua selezionata.
27.4. Sample Kickstart Configurations
27.4.1. Advanced Partitioning Example
The following is an integrated example showing the
clearpart
, zerombr
, part
, raid
, volgroup
, and logvol
Kickstart options in action:
Example 27.10. Advanced Partitioning Example
clearpart --drives=hda,hdc
zerombr
# Raid 1 IDE configpart raid.11 --size 1000 --asprimary --ondrive=hda
part raid.12 --size 1000 --asprimary --ondrive=hda
part raid.13 --size 2000 --asprimary --ondrive=hda
part raid.14 --size 8000 --ondrive=hda
part raid.15 --size 16384 --grow --ondrive=hda
part raid.21 --size 1000 --asprimary --ondrive=hdc
part raid.22 --size 1000 --asprimary --ondrive=hdc
part raid.23 --size 2000 --asprimary --ondrive=hdc
part raid.24 --size 8000 --ondrive=hdc
part raid.25 --size 16384 --grow --ondrive=hdc
# You can add --spares=xraid / --fstype xfs --device root --level=RAID1 raid.11 raid.21
raid /safe --fstype xfs --device safe --level=RAID1 raid.12 raid.22
raid swap --fstype swap --device swap --level=RAID1 raid.13 raid.23
raid /usr --fstype xfs --device usr --level=RAID1 raid.14 raid.24
raid pv.01 --fstype xfs --device pv.01 --level=RAID1 raid.15 raid.25
# LVM configuration so that we can resize /var and /usr/local latervolgroup sysvg pv.01
logvol /var --vgname=sysvg --size=8000 --name=var
logvol /var/freespace --vgname=sysvg --size=8000 --name=freespacetouse
logvol /usr/local --vgname=sysvg --size=1 --grow --name=usrlocal
This advanced example implements LVM over RAID, as well as the ability to resize various directories for future growth.
First, the
clearpart
command is used on drives hda
and hdc
to wipe them. The zerombr
command initializes unused partition tables.
Then, the two drives are partitioned to prepare them for RAID configuration. Each drive is divided into five partitions, and each drive is partitioned into an identical layout.
The next part uses these pairs of physical partitions to create a software RAID device with RAID1 level (mirroring). The first four RAID devices are used for
/
(root), /safe
, swap
and /usr
. The fifth, largest pair of partitions is named pv.01
and will be used in the following part as a physical volume for LVM.
Finally, the last set of commands first creates a volume group named
sysvg
on the pv.01
physical volume. Then, three logical volumes (/var
, /var/freespace
and /usr/local
) are created and added to the sysvg
volume group. The /var
and /var/freespace
volumes have a set size of 8 GB, and the /usr/local
volume uses the --grow
option to fill all remaining available space.
27.4.2. User Input Example
The following is an example showing how to prompt the user for input, and then read that input and save it as a variable, using bash:
Example 27.11. User Input Example
%pre
exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
chvt 6
IFS=$'\n'
echo -n "Enter input: "
read USERINPUT
echo
echo -n "You entered:" "$USERINPUT"
echo
chvt 1
exec < /dev/tty1 > /dev/tty1 2> /dev/tty1
%end
Due to the way Kickstart operates, the script must switch to a new virtual terminal before reading input from the user. This is accomplished by the
exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
and chvt 6
commands. The read USERINPUT
reads input from the user until enter is pressed, and stores it in the variable USERINPUT
. The echo -n "You entered:" "$USERINPUT"
command displays the text You entered:
followed by the user's input. Finally, the chvt 1
and exec < /dev/tty1 > /dev/tty1 2> /dev/tty1
commands switch back to the original terminal and allow Kickstart to continue installation.
27.4.3. Example Kickstart file for installing and starting the RNG daemon
The following is an example Kickstart file which demonstrates how to install and enable a service, in this case the Random Number Generator (RNG) daemon, which supplies entropy to the system kernel:
Example 27.12. Example Kickstart file for installing and starting the RNG daemon
services --enabled=rngd
%packages
rng-tools
%end
The
services --enabled=rngd
command instructs the installed system to start the RNG daemon each time the system starts. The rng-tools package, which contains the RNG daemon, is then designated for installation.