I'm having a little trouble with kickstart when the target box has more
than one disk. In the %pre section of the kickstart file, I create a
temporary file based on the number of disks present, then %include that
file in the normal part of the kickstart file. The logic is this.
d=
declare -i i=0
while read maj min blk nam; do
if [[ $nam =~ ^sd.$ ]]; then
d="$d,$nam"
i+=1
fi
done </proc/partitions
if [[ $i -eq 0 ]]; then
shutdown -H now
fi
d=${d#,}
(
echo bootloader --driveorder=$d --location=mbr --boot-drive=${d%%,*}
echo clearpart --all --initlabel --drives=$d
echo part /boot --fstype=ext4 --size=500 --ondisk=${d%%,*}
echo part pv.01 --grow --size=500 --ondisk=${d%%,*}
if [[ $i -eq 1 ]]; then
echo volgroup vg_me pv.01 --pesize=32768
else
echo part pv.02 --grow --size=500 --ondisk=${d##*,}
echo volgroup vg_me pv.01 pv.02 --pesize=32768
fi
echo -n logvol /home --fstype=ext4 --name=lv_home --vgname=vg_me
echo \ --grow --size=100
echo -n logvol / --fstype=ext4 --name=lv_root --vgname=vg_me
echo \ --grow --size=1024 --maxsize=51200
echo -n logvol swap --name=lv_swap --vgname=vg_me --grow --size=1008
echo \ --maxsize=2016
) >/tmp/diskpart
When I have two disks (I've haven't had more thus far), the logic works
perfectly. Except... When the machine reboots, it tries to boot from the
second disk, sdb, not from sda where the boot loader is. Of course, that
doesn't work and the machine hangs.
My cure for this at this time is manual. I use the BIOS to disable the
second disk, boot (which starts but fails), then use the BIOS to
re-enable the second disk and everything works as it should. But why
does the box think it should boot from the second disk?
The box is a Dell R510 server. I understand this might be peculiar to
the R510. But if there is anything I can do in the kickstart file to
avoid the problem, I'd sure like to do it.
--
Dave Close