Search This Blog

2015-02-17

Kickstart Drive Mapping

Ordering of Storage Devices Messing up install

A problem that occurs commonly in kickstart is that kickstart will detect storage devices in a different order that which you intend the OS to install in.

This most commonly happens with Dell devices and virtual disks.

The Dell device will name its first virtual device /dev/sda which will cause installation problems when you try to specify that you want your kickstart installation to install on /dev/sda which is likely going to be one of Dell's virtual media devices.

A way to get around this is to create a kickstart script that looks at some criteria of physical devices first and then determines which drive to install to.

Finding Drive Mapping

http://www.redhat.com/archives/kickstart-list/2012-October/msg00014.html
https://access.redhat.com/solutions/273843
https://access.redhat.com/solutions/188463
https://access.redhat.com/solutions/58467
https://access.redhat.com/solutions/58561

Interactive Pre-Install to Test

https://stuffivelearned.org/doku.php?id=os:linux:centos:kspostscript
http://hintshop.ludvig.co.nz/show/interactive-pre-post-install-scripts-redhat-kickstart/

Example of My Partitioning Script


# Couldnt figure out how to make piping with while loop output work properly
# So I wrote to a temp file which seems to be the most compatible method of
# Performing while loop redirection in multiple shells
list-harddrives > /tmp/list-harddrives

# Loop to filter through attached HDDs and their sizes in MiB
# Will find the smallest disk larger than 15GB and set it as /
while read DISK DSIZE
do
DSIZE=$(echo "$DSIZE" | awk -F '.' '{print$1}')
if [ -z $rootDisk ]; then
rootDisk=$DISK
rootSize=$DSIZE
echo "Root Disk was unset and is now: $rootDisk"
fi

if [ $DSIZE -gt 143305 ]; then
if [ $DSIZE -lt $rootSize ]; then
rootDisk=$DISK
rootSize=$DSIZE
echo "Root Disk overriden due to smaller disk that meets requirements: $rootDisk"
fi
fi
done < /tmp/list-harddrives # Echo result out to console for debug echo "Root Disk: $rootDisk" # Create another temp file to feed into the kickstart later # It will choose the root disk that was previously figured out as the primary disk cat << EOF >> /tmp/partitioning
# Specify the bootloader as required for RedHat automated installation (--location=mbr is default)
bootloader --driveorder=${rootDisk}
# Without the 'zerombr' option specified, uninitiated disks will require manual intervention
zerombr
# To clear the existing partitions, use the clearpart option and include the --all parameter
clearpart --all --initlabel

# Create /boot partition (100MB is not large enough anymore so 500MB is used)
part /boot --size=500 --ondisk=${rootDisk}
# Create a pv to be used with LVM, start with 100MB partition and grow to the remaining size that is left on disk
# This will also ensure that we use the root disk we determined earlier specifically
part pv.01 --size=100 --grow --ondisk=${rootDisk}

# Add the previous pv to the volume group
volgroup VolGrp pv.01

# Carve out space in the volume group for /, swap, and /d2 (data)

# Root partition will always be 10GB
logvol / --vgname=VolGrp --size=10000 --name=Vol1
# Swap will be what is recommended by RedHat for each Distro (no guarantees on which disk)
logvol swap --vgname=VolGrp --recommended --name=Vol2 --fstype=swap
# d2 is the a data partition which will use any remaining space (no guarantees on which disk)
logvol /d2 --vgname=VolGrp --size=100 --name=Vol3 --grow
EOF


Reference for include scripts and multi-drive kickstart partitioning:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-preinstallconfig.html

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.