The PV's are divided up into 4MB chunks (PE): sda1 (200PE) / sdb1 (100PE)
Create a VG using sda1 and sda2
Create an LV of size 1GB (uses linear mapping by default)
Total of 250 LE's are required
200PE's are used in sda1, 50PE's are used in sdb1, 50PE are free
Create a filesystem from the LV and mount it
PROFIT!
LVM Visualized
LVM commands
$ yum install lvm2
# Note: I created loop1/2 using dd and losetup
$ pvcreate /dev/loop0 /dev/loop1
Physical volume "/dev/loop0" successfully created
Physical volume "/dev/loop1" successfully created
$ vgcreate lvm /dev/loop0 /dev/loop1
Volume group "lvm" successfully created
$ lvcreate -n home -L 1G lvm
Logical volume "home" created
$ mkfs.ext4 /dev/lvm/home
$ mount /dev/lvm/home /mnt
PXELINUX downloads Linux kernel/initrd image and sends any kernel arguments
Anaconda / Kickstart
Anaconda is the installation program used by Redhat derivatives
Provides a text or GUI frontend for users to interact with
Sets up initial storage, installs base system, sets up initial users
Kickstart is the automation method to install Redhat machines
Simple and easy to use configuration file format
Can be served using a variety of methods (i.e. http)
Extremely configurable and useful for most environment needs
Kickstart Config File
Comprised of three sections
Command configuration
Package installation/removal
Arbitrary shell commands
ks.cfg: Command configuration
install
cdrom
lang en_US.UTF-8
keyboard us
network --bootproto=dhcp
rootpw cs312
firewall --disabled
selinux --permissive
timezone UTC
unsupported_hardware
bootloader --location=mbr
text
skipx
zerombr
clearpart --all --initlabel
autopart
auth --enableshadow --passalgo=sha512 --kickstart
firstboot --disabled
poweroff
user --name=cs312 --plaintext --password cs312
ks.cfg: Package to installation/removal
Package names must exist in configured repositories
Prepending a dash (-) to a package name means to remove the package
%packages
sudo
-vim
%end
ks.cfg: Arbitrary Shell Commands
Be careful about how complicated the scripts are
Default interpreter is sh
Post scripts run inside a chroot environment
Pre scripts are run on the install environment
%pre --interpreter /bin/bash
echo "This is run before the install phase begins"
%end
%post --interpreter /bin/bash
echo "This is run in a chroot of the installed system"
%end
Kickstart install steps
System boots from PXELINUX with ks=<URL> set as a kernel argument.
System boots up, tries to get an IP address and attempts to download the ks
file using the URL above.
Using the ks file, installs the systems. If the ks file doesn't answer all
needed questions, installation will stop for user interaction.
Install with finish and may reboot or shutdown depending on the ks file
# Create /boot on sda1 with a 512MB size formatted as ext4
part /boot --fstype="ext4" --size=512
# Create a PV partition using the rest of the disk# 100 implies 100% in this case instead of size in MB because --grow is# specified
part pv.01 --grow --size=100
# Create a VG named lvm
volgroup lvm pv.01
# Create an LV named swap using the recommended size and format it# as swap
logvol swap --vgname=lvm --name=swap --fstype="swap" --recommended
# Create a rootfs named root 20GB in size and format it as ext4
logvol / --vgname=lvm --name=root --fstype="ext4" --size=20480
Other useful ks features
# Set mirror for installation
url --url=http://centos.osuosl.org/6/os/x86_64/
# Add updates repo too
repo --name=updates --baseurl=http://centos.osuosl.org/6/updates/x86_64/
# Setup the installer in a VNC session using a password
vnc --password=cs312
# Run misc commands after the OS install
%post --interpreter /bin/bash --log=/root/post-install.log
echo"%cs312 ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
%end
Exercise #1
Use the ks configuration ks.cfg from the previous slide and install the
system on VirtualBox (or other VM software)