I have a server with this hardware
- two Intel Xeon E5620 CPUs
- Areca 1880i 8-port SAS RAID PCIe 512MB cache
- Areca Battery Backup Module
- 5 pcs Hitachi Deskstar 7K3000 HDS723030ALA640 64MB 3TB
and have created one RAID 6 volume that makes use of all the 5 hard drives.
Unfortunately there is no support for the Areca 1880i RAID card in the Linux kernel on the CentOS 6.0 installation image. There is though an updated kernel module available on the Areca web site (both as a precompiled binary for RHEL 6.0 and as source code).
How do I write a kickstart script to automate the installation of CentOS 6.0 on the server?
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
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/shcd /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
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.logcp -r /tmp /mnt/sysimage/root/tmp mkdir /mnt/sysimage/tmp/arcmsr cp -r /arcmsr/* /mnt/sysimage/tmp/arcmsr%end %post --log=/root/ks-post2.logcd /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
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
- CentOS 5.5 remote kickstart installation stalls at “Starting install process.” How to debug?
- Logging all the commands executed during a kickstart installation to file and screen
- RHEL kickstart adding RAID driver question
- RHEL/CentOS kickstart partition offset
- Creating a custom kickstart file for cobbler and fedora installation