In a %pre section of the kickstart script we need to run the pre-install.sh script that loads the updated binary kernel module (arcmsr) with /sbin/insmod. After that the kickstart installation has access to the hard drive that the Areca 1880i raid card presents to the computer and can thus partition and create file systems on it. In a %post section of the kickstart script we need
to run the post-install.sh script that installs the updated binary kernel module into /mnt/sysimage/lib/modules/ and then runs /sbin/mkinitrd so that the server will be able to boot after the installation.
The precompiled kernel module found at the Areca web page is packaged as a ZIP archive
http://www.areca.us/support/s_linux/driver/rhel/6_0.zip
but the unzip command is not available during the %pre section of a Centos 6.0 kickstart installation. Therefore we unzip the archive in advance.
$ mkdir /tmp/a
$ cd /tmp/a
$ wget --quiet http://www.areca.us/support/s_linux/driver/rhel/6_0.zip
$ unzip 6_0.zip
Archive: 6_0.zip
creating: 6_0/
inflating: 6_0/install.zip
inflating: 6_0/README.txt
$ mkdir /tmp/b
$ cd /tmp/b
$ unzip /tmp/a/6_0/install.zip
Archive: /tmp/a/6_0/install.zip
inflating: driver.img
$ ls -l driver.img
-rw-r--r-- 1 erik users 1474560 2011-05-09 10:48 driver.img
Now put the file driver.img on some internal web server. In this example the file will be available as http://www.example.com/driver.img but you need to adjust this URL in your own kickstart script. Here is what you write in the %pre section
%pre --log=/tmp/kspre.log
#!/bin/sh
cd /tmp
wget http://example.com/driver.img
mkdir /arcmsr
mount -o loop driver.img /arcmsr
cd /arcmsr
sh ./pre-install.sh
sleep 5
dd if=/dev/zero of=/dev/sda bs=512 count=64
parted -s /dev/sda mklabel gpt
%end
The sleep 5
was necessary as otherwise the parted -s /dev/sda mklabel gpt
would fail like this
# parted -s /dev/sda mklabel gpt
Error: Can't have the end before the start! (start sector=34 length=-3)
Error: Can't have overlapping partitions.
Error: Can't have overlapping partitions.
We need to create a GUID Partition Table (GPT) because the raid card presents the RAID 6 volume as a 9 Tb hard drive to the computer. 9 Tb is bigger than the maximum 2 Tb that can be handled by a normal partition table.
The idea to use GPT came from a mailing list post by Joshua Daniel Franklin.
In a %post section of the kickstart script we first copy some of the installation files into /mnt/sysimage as they need to be available when we later run commands after a chroot into /mnt/sysimage
%post --nochroot --log=/mnt/sysimage/root/ks-post1.log
cp -r /tmp /mnt/sysimage/root/tmp
mkdir /mnt/sysimage/tmp/arcmsr
cp -r /arcmsr/* /mnt/sysimage/tmp/arcmsr
%end
%post --log=/root/ks-post2.log
cd /tmp/arcmsr
sh ./post-install.sh
%end
Note, that we need to have two %post sections, the first one without chroot and the second one with chroot into /mnt/sysimage.
First I tried to /usr/sbin/chroot /mnt/sysimage
inside a non-chroot %post section but that didn't work.
The partitioning scheme for the server could look like this
bootloader --location=mbr
clearpart --linux --drives=sda
part /boot --fstype=ext4 --size=8192
part pv.01 --grow --size=1
volgroup vg0 --pesize=4096 pv.01
logvol swap --name=lv_swap --vgname=vg0 --size=65536
logvol / --fstype=ext4 --name=lv0 --vgname=vg0 --grow --size=1024
The mailing list post by Joshua Daniel Franklin says one should avoid having zerombr
or clearpart --all
in the kickstart file as otherwise the GPT we created in the %pre section would be overwritten.
After installation the server looks like this
[user@server ~]$ cat /proc/meminfo |grep SwapTotal
SwapTotal: 67108856 kB
[user@server ~]$ df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/vg0-lv0 8256978 828 7836720 1% /
tmpfs 12012 0 12012 0% /dev/shm
/dev/sda1 8064 194 7460 3% /boot
Best Answer
No.
kexec will allow you to skip the firmware (BIOS/EFI) and bootloader steps of a standard restart, but this is not the same thing (though useful if you have a slow loading RAID card).
The closest you can get is loading and unloading kernel modules.