I just do this " clearpart --all part /boot --fstype ext3 --size=100 part pv.01 --size=10 --grow volgroup SystemVG00 pv.01 logvol swap --fstype swap --name=SwapVol01 --vgname=SystemVG00 --size=12288 logvol / --fstype ext4 --name=RootVol --vgname=SystemVG00 --size=5120 logvol /usr --fstype ext4 --name=UsrVol --vgname=SystemVG00 --size=5120 logvol /home --fstype ext4 --name=HomeVol --vgname=SystemVG00 --size=5120 logvol /var --fstype ext4 --name=VarVol --vgname=SystemVG00 --size=10240 logvol /log --fstype ext4 --name=VarLogVol00 --vgname=SystemVG00 --size=20480 " Then I deal with any additional physical disks using whatever the automation dejour for the environment happens to be after the kickstart. I find it a lot less aggravating than any other solution mostly because it reliable, simple and doesn't care what your RAID controller calls the drives.
On Fri, Feb 22, 2013 at 1:06 PM, Graham Allan <[email protected]> wrote: > On Wed, Feb 20, 2013 at 07:57:22AM -0600, Pat Riehecky wrote: >> On 02/19/2013 10:14 AM, Graham Allan wrote: >> >On Mon, Feb 18, 2013 at 07:33:37PM -0700, Orion Poplawski wrote: >> >>On 02/18/2013 02:01 PM, Ken Teh wrote: >> >>>During a kickstart install, how are drives mapped? I notice that sata0 >> >>>is not always sda. This is especially true when there are very large >> >>>drives in the mix. >> >>The sd* letters are simply handed out in order of enumeration and, >> >>as you noted, is not deterministic. If you need that, use the >> >>/dev/disk/by-{id,label,path,uuid} labels. >> >For this reason we use a script during the kickstart %pre section which >> >attempts to examine the available drives and determine which is the >> >appropriate one to install on (also waits for confirmation if an >> >unexpected partition table is found). >> > >> >G. >> >> Any chance you can share that script? It sounds interesting! > > Well I hope I haven't oversold this - it's not a miracle cure but it > works for our environment. > > Back in the SL3/4/5 days we made some basic assumptions in kickstart > %pre that if there was an hda device, that would be the OS drive, > otherwise use sda. If a workstation didn't match that model, we'd > generally beat on it until it did :-) IIRC SL6 changed so that ATA drives, > and any connected usb drives, appeared as sd* devices, and you couldn't be > certain about the ordering. > > There will be lots of deeply unfashionable things in this script such as > using regular drive partitions instead of LVM, using separate /var, > etc... Also please remember it's been hacked together as edge cases were > discovered so it's not pretty, or commented as well as it might be. > > It tries to examine all candidate drives (after eliminating USB devices) > and will select a drive for installation if it either contains no > partition table, or finds a /boot directory (actually that hardly seems > foolproof, there might be better choices). Otherwise if it finds an > unfamiliar partition table, it prints it and asks for confirmation. > > The rest of the script is concerned with stashing away ssh keys and > suchlike, for restoration after a reinstall. > > Here goes, hope vim didn't mangle it overmuch during pasting, and don't > judge it too harshly! > > %pre > > ################## > # Figure out where to install to > > #Make sure USB storage devices are GONE > modprobe -r usb_storage > > mkdir /mnt/tmp > > for i in `ls /dev/sd?`; do > CANDIDATE_DISK="$i" > > echo "UMPHYS: Checking $CANDIDATE_DISK for partition table" | tee -a > /tmp/ks.log >> /dev/tty3 > > if parted -s "$CANDIDATE_DISK" print >/dev/null; then > echo "parted found a partition table" | tee -a /tmp/ks.log >> > /dev/tty3 > if mount "${CANDIDATE_DISK}1" /mnt/tmp; then > if [ -d /mnt/tmp/boot ]; then > INSTALL_DISK=$CANDIDATE_DISK > echo "Found /boot on ${CANDIDATE_DISK}1, using > $CANDIDATE_DISK as system disk" | tee -a /tmp/ks.log >> /dev/tty3 > umount /mnt/tmp > break > else > echo "Couldn't find /boot on ${CANDIDATE_DISK}1, moving on to > next disk..." | tee -a /tmp/ks.log >> /dev/tty3 > umount /mnt/tmp > fi > umount /mnt/tmp > fi > else > echo "Failed to mount ${CANDIDATE_DISK}1, moving on to next > disk..." | tee -a /tmp/ks.log >> /dev/tty3 > fi > else > echo "parted found no partition table, using $CANDIDATE_DISK as > system disk" | tee -a /tmp/ks.log >> /dev/tty3 > INSTALL_DISK="$CANDIDATE_DISK" > break > fi > done > > if [ "${INSTALL_DISK}x" = "x" ]; then > echo "****************************************************" >> /dev/tty1 > echo "Initial check failed to find a suitable system disk!" >> /dev/tty1 > echo "****************************************************" >> /dev/tty1 > for i in `ls /dev/sd?`; do > CANDIDATE_DISK="$i" > if mount "${CANDIDATE_DISK}1" /mnt/tmp; then > if ! [ -d /mnt/tmp/boot ]; then > echo -e "\n\nCouldn't find /boot on ${CANDIDATE_DISK}1" >> > /dev/tty1 > echo -n "Partition table for ${CANDIDATE_DISK}:" >> /dev/tty1 > fdisk -l ${CANDIDATE_DISK} >> /dev/tty1 > doit="default" > while ! echo "$doit" | grep -P "([Y|y]es|[N|n]o)" > /dev/null > 2>&1; do > echo -n "Install linux on ${CANDIDATE_DISK}? [Yes/No] " > >> /dev/tty1 > read doit > done > if echo "$doit" | grep -P "[Y|y]es" > /dev/null 2>&1; then > INSTALL_DISK="$CANDIDATE_DISK" > umount /mnt/tmp > break > else > echo "moving on to next disk..." >> /dev/tty1 > fi > umount /mnt/tmp > fi > else > echo -ne "\n\nPartition table for ${CANDIDATE_DISK}:" >> /dev/tty1 > fdisk -l ${CANDIDATE_DISK} >> /dev/tty1 > doit="default" > while ! echo "$doit" | grep -P "([Y|y]es|[N|n]o)" > /dev/null > 2>&1; do > echo -n "Install linux on ${CANDIDATE_DISK}? [Yes/No] " >> > /dev/tty1 > read doit > done > if echo "$doit" | grep -P "[Y|y]es" > /dev/null 2>&1; then > INSTALL_DISK="$CANDIDATE_DISK" > break > else > echo "moving on to next disk..." >> /dev/tty1 > fi > fi > done > > if [ "${INSTALL_DISK}x" = "x" ]; then > echo -e "\n****************************************************" >> > /dev/tty1 > echo "Failed to find a suitable system disk" >> /dev/tty1 > echo "The system will be rebooted when you press Ctrl-C or > Ctrl-Alt-Delete." >> /dev/tty1 > echo "****************************************************" >> > /dev/tty1 > while true; do > sleep 1 > done > fi > fi > > echo "Installing linux to $INSTALL_DISK" | tee -a /tmp/ks.log >> /dev/tty3 > echo "Installing linux to $INSTALL_DISK" >> /dev/tty1 > echo "****************************************************" >> /dev/tty1 > # Done figuring out where to install > ################### > > > #Write a file out to be included below for disk config > cat << EOF > /tmp/partitions > clearpart --drives=$INSTALL_DISK --initlabel --all > zerombr yes > part swap --recommended --ondisk=$INSTALL_DISK > part / --size=25600 --ondisk=$INSTALL_DISK > part /var --size=4096 --ondisk=$INSTALL_DISK > part /export/scratch --size=128 --grow --ondisk=$INSTALL_DISK > EOF > > # Salvage files from an old installation if possible > mkdir /tmp/physkeys > echo "Attempting to salvage files..." | tee -a /tmp/ks.log >> /dev/tty3 > for i in `fdisk -l $INSTALL_DISK | grep ^/dev | grep -v > '\(swap\|lvm\|extended\)' | cut -b 1-9`; do > echo "Mounting $i (label '`e2label $i`') to /mnt/tmp" | tee -a > /tmp/ks.log >> /dev/tty3 > mount $i /mnt/tmp > # SSH keys > if [ -d /mnt/tmp/etc/ssh ]; then > echo "Found ssh keys. Stashing"| tee -a /tmp/ks.log >> /dev/tty3 > mkdir /tmp/physkeys/ssh > cp -p /mnt/tmp/etc/ssh/ssh_host_* /tmp/physkeys/ssh > fi > # X config > if [ -f /mnt/tmp/etc/X11/xorg.conf ]; then > echo "Found xorg.conf. Stashing"| tee -a /tmp/ks.log >> /dev/tty3 > mkdir /tmp/physkeys/X11 > cp -p /mnt/tmp/etc/X11/xorg.conf /tmp/physkeys/X11 > fi > # Cfengine keys (sep /var partition) > if [ -d /mnt/tmp/cfengine/ppkeys ]; then > echo "Found cfengine ppkeys. Stashing"| tee -a /tmp/ks.log >> > /dev/tty3 > mkdir /tmp/physkeys/cfengine > cp -p /mnt/tmp/cfengine/ppkeys/* /tmp/physkeys/cfengine #*/ > fi > # Cfengine keys (integrated /var) > if [ -d /mnt/tmp/var/cfengine/ppkeys ]; then > echo "Found cfengine ppkeys. Stashing"| tee -a /tmp/ks.log >> > /dev/tty3 > mkdir /tmp/physkeys/cfengine > cp -p /mnt/tmp/var/cfengine/ppkeys/* /tmp/physkeys/cfengine #*/ > fi > # Crontabs > if [ -d /mnt/tmp/spool/cron ]; then > echo "Found cron. Stashing"| tee -a /tmp/ks.log >> /dev/tty3 > mkdir /tmp/physkeys/cron > cp -p /mnt/tmp/spool/cron/* /tmp/physkeys/cron #*/ > fi > umount /mnt/tmp > done > %end > > -- > ------------------------------------------------------------------------- > Graham Allan > School of Physics and Astronomy - University of Minnesota > -------------------------------------------------------------------------
