Oracle Linux has issues with LVM in anaconda

We've been having a variety of problems with our LVM system partitioning and anaconda. Mind you, once it is configured and installed, the system runs fine. But during rollout, LVM has been a head breaker...
Main issue is: dirty disks. Since we are booting from SAN, we have no control over the LUNs we get. Although we specify zerombr and clearpart --all in anaconda, LVM complains if there is anything on the disk. Especially if there are non-Linux partitions left on the disks. Altiris does it's boot "magic" using a DOS partition to create a known environment from which it launches stuff. This gave the anaconda installer headaches.
Our work-around: don't do partitioning from anaconda, but use the pre-install phase (%pre). We force a clear of the local disk (sda) and our boot LUN (sdb) and clear partitions explicitly as well as remove any traces of LVM signatures. We remove all Logical Volumes (LV), Volume Groups (VG) and Physical Volumes (PV). While this is a lot of work, it's the only way we'll get the guarantee our kickstart script will work.

In case you also have a Linux system, use LVM and perhaps even boot off of the SAN, here is our kickstart script:

# Kickstart file
# Bare metal Linux
# install using http installation source
#
install
text
url --url http://server/oel
lang en_US
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard us
# config NIC and use DHCP for easy roll out
network --device eth0 --bootproto dhcp
network --device=eth1 --onboot no --bootproto dhcp
network --device=eth2 --onboot no --bootproto dhcp
network --device=eth3 --onboot no --bootproto dhcp
network --device=eth4 --onboot no --bootproto dhcp
network --device=eth5 --onboot no --bootproto dhcp
# auto reboot after installation
reboot
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone --utc Europe/Amsterdam
# install OS on SAN LUN, nousbstorage to ignore Dell virtual media
bootloader --driveorder=sdb,sda --location=mbr --append="nousbstorage"
# clear MBR to force empty disks (WARNING: ERASES ALL CONTENT)
zerombr yes
# init local disk and LUN, noformat because that's done in %pre
part /boot --onpart=sdb1 --noformat
part pv.49 --grow --onpart=sdb2
volgroup vgsystem --pesize=4096 pv.49
logvol / --fstype ext3 --name=lvroot --vgname=vgsystem --size=4096
logvol /tmp --fstype ext3 --name=lvtmp --vgname=vgsystem --size=2048
logvol /var --fstype ext3 --name=lvvar --vgname=vgsystem --size=2048
logvol /u01 --fstype ext3 --name=lvoracle --vgname=vgsystem --size=100 --grow

%packages
@ admin-tools
@ editors
@ emacs
@ system-tools
@ text-internet
@ legacy-network-server
@ gnome-desktop
@ dialup
@ network-server
@ base-x
@ server-cfg
@ development-tools
@ ruby
@ graphical-internet
gcc4
lslk
kernel-smp
-linuxwacom
oracleasm-2.6.9-55.0.0.0.2.ELsmp
-bluez-pin
-kernel-devel
-kernel-largesmp-devel
lvm2
memtest86+
-zsh
-desktop-backgrounds-extra
-gnome-mag
wireshark-gnome
-synaptics
-gok
vnc-server
system-config-boot
-openoffice.org
system-switch-mail
-openoffice.org-i18n
-evolution-webcal
-fetchmail
-cadaver
sysstat
gftp
-switchdesk
gnome-nettool
-kernel-smp-devel
-planner
-system-config-soundcard
net-snmp-utils
rdesktop
-gaim
system-switch-mail-gnome
-gnome-audio
subversion
mrtg
mc
-xchat
-gcc-g77
-gnome-pilot
-at-spi
-gnomemeeting
device-mapper-multipath
tsclient
system-config-kickstart
nmap-frontend
e2fsprogs
-evolution

%pre
# Do entire formatting and partitioning of boot devices here
# Clear any LVM traces
for sLv in `lvm lvdisplay|grep "LV Name"|awk '{print $3}'`
do
lvm lvremove -f $sLv
done
for sVg in `lvm vgdisplay|grep "VG Name"|awk '{print $3}'`
do
lvm vgremove $sVg
done
for sPv in `lvm pvdisplay|grep "PV Name"|awk '{print $3}'`
do
lvm pvremove -ff -y $sPv
done
# Clear partitions on /dev/sda and /dev/sdb
for sPa in `parted /dev/sda print|grep ^[0-9]|awk '{print $1}'`
do
parted /dev/sda rm $sPa
done
for sPb in `parted /dev/sdb print|grep ^[0-9]|awk '{print $1}'`
do
parted /dev/sdb rm $sPb
done
# force detection of new partition table
partprobe

# Create Swap partition (type 82) on /dev/sda
# parted not used, because of possible bug with multipathing
fdisk /dev/sda <<EOF
n
p
1

+2000M
t
82
p
w
EOF

# Create boot and LVM partitions on /dev/sdb (type 83 and 8e)
fdisk /dev/sdb <<EOF
n
p
1

+100M
t
83
n
p
2


t
2
8e
p
w
EOF
partprobe

# Format partitions and anaconda won't have to (see above)
mkswap -L swap /dev/sda1
mke2fs -jv /dev/sdb1

%post
# mark sda as a non-boot device (or it will try)
parted /dev/sda set 1 boot off
rpm -e kernel-devel
rpm -e kernel-smp-devel
rpm -e kernel-largesmp-devel
rpm -e kernel-largesmp
rpm -e rhgb

# After reboot, automatically do post installation steps...
echo /tmp/postinst.sh >> /etc/rc.local


PS: the package list will be changed soon. During development, we were using runlevel 5 as a default. Now we're at runlevel 3, the way a server should be! Using xming over ssh and tunnel (if needed) for remote admin using X11 when necessary. Thanks Koen!

No comments: