Kickstart %pre Vda/sda Troubles

Home » CentOS » Kickstart %pre Vda/sda Troubles
CentOS 4 Comments

hi,

The problem: for kvm/qemu disks are /dev/vdx devices when using the virtio driver. For vmware, drives are /dev/sdx devices. For hp servers, /dev/ccisss/whatever (sorry, no proliant with an array controller handy to check it).

in order to just have one kickstart script to maintain I am trying to use the %pre section but getting a bit stuck. This is what I have:

%pre if [ -b /dev/sda ]
then
zerombr
clearpart –all
bootloader –location=mbr –timeout=0 –driveorder=sda
–append=”crashkernel=auto rhgb quiet”
part /boot –fstype=ext4 –sizeP0
part pv.008002 –grow –size=1
volgroup vg_host –pesize@96 pv.008002
logvol / –fstype=ext4 –name=lv_root –vgname=vg_host –grow
–size24 –maxsizeQ200
logvol swap –name=lv_swap –vgname=vg_host –grow –sizeQ2 –maxsize24
fi elif [ -b /dev/vda ]
then
zerombr
clearpart –all
bootloader –location=mbr –timeout=0 –driveorder=vda
–append=”crashkernel=auto rhgb quiet”
clearpart –linux –drives=vda
part /boot –fstype=ext4 –sizeP0 –ondisk=vda
part pv.008002 –grow –size=1 –ondisk=vda
volgroup vg_host –pesize@96 pv.008002
logvol / –fstype=ext4 –name=lv_root –vgname=vg_host –grow
–size24 –recommended
logvol swap –name=lv_swap –vgname=vg_host –grow –sizeQ2 –maxsize24
fi else
echo unknown disk fi

But when kickstarting a guest on a kvm host, I get this error:

the kickstart configuration file is missing required information that anaconda cannot promtp for. Please add the following sections and try again: Bootloader configuration.

If I swith to another virtual terminal, I see this: Device vda not found. But it’s there, I can see it with ls -l, it is a block device

Has anybody implemented something like this and is willing to share it?

TIA,

4 thoughts on - Kickstart %pre Vda/sda Troubles

  • lets reply to myself then ;-)

    %pre
    #!/bin/bash

    if [ -b /dev/vda ] ; then
    echo “bootloader –location=mbr –timeout=0 –driveorder=vda
    –append=”crashkernel=auto rhgb quiet”” > /tmp/diskinfo
    echo “clearpart –linux –drives=vda” >> /tmp/diskinfo
    echo “part /boot –fstype=ext4 –sizeP0” >> /tmp/diskinfo
    echo “part pv.008002 –grow –size=1” >> /tmp/diskinfo
    echo “volgroup vg_host –pesize@96 pv.008002” >> /tmp/diskinfo
    echo “logvol / –fstype=ext4 –name=lv_root –vgname=vg_host
    –grow –size24” –recommended >> /tmp/diskinfo
    echo “logvol swap –name=lv_swap –vgname=vg_host –grow
    –sizeQ2 –maxsize24” >> /tmp/diskinfo

    elif [ -b /dev/sda ] ; then
    echo “bootloader –location=mbr –timeout=0 –driveorder=sda
    –append=”crashkernel=auto rhgb quiet”” > /tmp/diskinfo
    echo “clearpart –linux –drives=sda” >> /tmp/diskinfo
    echo “part /boot –fstype=ext4 –sizeP0” >> /tmp/diskinfo
    echo “part pv.008002 –grow –size=1” >> /tmp/diskinfo
    echo “volgroup vg_host –pesize@96 pv.008002” >> /tmp/diskinfo
    echo “logvol / –fstype=ext4 –name=lv_root –vgname=vg_host
    –grow –size24” –recommended >> /tmp/diskinfo
    echo “logvol swap –name=lv_swap –vgname=vg_host –grow
    –sizeQ2 –maxsize24” >> /tmp/diskinfo fi

    %end

    as seen in http://fedoraproject.org/wiki/Anaconda/Kickstart#Chapter_4._Pre-installation_Script

  • Thanks. I PXE boot the installer and give options about how I want to set up the guest as extra command line arguments. Typically, that means for a KVM server I’d type:
    CentOS6 softraid kvm

    For a KVM guest, I’d use no extra options.

LEAVE A COMMENT