Dell RAID for PowerEdge Servers during CentOS 7.2 kickstart

Here's a guide outlining how to perform hardware RAID actions (e.g. wipe the RAID configuration, create a new RAID-1 virtual disk etc) on a Dell PowerEdge server (Perc i810) during a CentOS kickstart installation.

For this example we are building this for CentOS 7.2, however the same workflow should get you most of the way on other releases of Linux.

High Level workflow

There are four basic steps involved in getting this running

  1. Build a vanilla CentOS environment at the same release as what you're targetting the anaconda/kickstart install to use (in this case CentOS 7.2)
  2. Create a custom squashed rootfs on here (modify the squashed rootfs from the CentOS 7.2 Minimal DVD/iso)
  3. Promote this new version of the squashed rootfs to the install path (e.g. YUM Repo for network install, or encode back onto the DVD etc).
  4. Update the kickstart file with the RAID logic

Step 1 is very straight forward, but important as the build environment must match your target installer versions otherwise it won't work properly.

Step 2 - Modify the squashed rootfs

On the vanilla CentOS environment,

Install tools for working with squashed rootfs filesystems
centos72# yum install kernel-devel
centos72# yum install squashfs-tools
modifying a squashed rootfs environment

Extracting the root filesystem which is used during a Linux install is kind of like working with Russian Nesting Dolls. At a high level we need to

  • Mount the standard Minimal CentOS 7.2 DVD ISO as read-only
  • (optionally) extract/copy the squashed rootfs file
  • mount the squashed rootfs file as read-only
  • extract/copy the rootfs.img filesystem file
  • mount the rootfs.img file as read/write
  • modify the contents of this file
  • unmount the rootfs.img file
  • rebuild a new squashed rootfs file
  • transfer this new file to the desired location

So, some workflow for doing this:

Create the working/temporary directories

centos72# mkdir /mnt/centos7iso
centos72# mkdir /mnt/squashfs
centos72# mkdir /mnt/rootfs
centos72# mkdir -p /tmp/rootfsworking/squashfs-root/LiveOS

Mount the DVD image and one of the image files on the DVD

centos72# mount -o ro -t iso9660 ~/CentOS-7-x86_64-Minimal-1503-01.iso /mnt/centos7iso
centos72# mount -o ro,loop /mnt/centos7iso/LiveOS/squashfs.img /mnt/squashfs

Extract the rootfs.img file

centos72# cp -p /mnt/squashfs/LiveOS/rootfs.img /tmp/rootfsworking/squashfs-root/LiveOS

Unmount the DVD image and original squashed rootfs volume

centos72# umount /mnt/squashfs
centos72# umount /mnt/centos7iso

Mount the rootfs.img file as read-write

centos72# mount -o rw,loop /tmp/rootfsworking/squashfs-root/LiveOS/rootfs.img /mnt/rootfs

This next section deals with modifying the contents of the root filesystem for the installer environment.

Modify ld.so.conf - shared module config

For some reason one of the Dell RPMs requires this file to exist AND to have these contents before it will install. This is a workaround/hack to make it work.

centos72# echo "include ld.so.conf.d/*.conf" > /mnt/rootfs/etc/ld.so.conf

Install RPMs

Be very careful to only install the desired RPMs. The installer root filesystem doesn't have an RPM or yum DB (detailing which packages are already installed), therefore if you try to perform an ordinary yum install foo it will prompt you for a heap of dependencies, which are actually present, but not listed in any accessible database.

The sequence below also seemed somewhat important. I tried some other sequences (e.g. alphabetical order) and this didn't work so well.

centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/libsmbios-2.2.27-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/smbios-utils-bin-2.2.27-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-omilcore-8.2.0-1739.8348.el7.x86_64.rpm 
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-hapi-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-omacs-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-xmlsup-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-smcommon-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-storelib-sysfs-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-deng-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-deng-snmp-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-nvme-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-rac-components-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-realssd-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-idrac-snmp-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-omcommon-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-isvc-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-isvc-snmp-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-sysfsutils-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-ominst-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-omacore-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-storelib-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-storage-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-storage-cli-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-storageservices-cli-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-storage-snmp-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-storageservices-snmp-8.2.0-1739.8348.el7.x86_64.rpm
centos72# rpm -i --root=/mnt/rootfs/ --nodeps http://repo-server/path/oem/dell/RHEL/7/srvadmin-storageservices-8.2.0-1739.8348.el7.x86_64.rpm

Unmount rootfs

centos72# umount /mnt/rootfs

Build new squashfs

If you're iterating through multiple attempts at building the new squashfs, be sure to remove any previous builds first

centos72# cd /tmp/rootfsworking
centos72# rm newsquashfs.img
centos72# mksquashfs rootfs newsquashfs.img

Step 3 - move the modified squashfs to the RPM repo

Distribute your new squashfs to the desired location (e.g. pulp repo)

centos72# scp newsquashfs.img rpm-repo-server:/var/lib/pulp/content/distribution/ks-CentOS--7-x86_64/LiveOS/squashfs.img

on the pulp server I then did the following to manually install the squashed rootfs

centos72# mv /home/robcan/squashfs.img /var/lib/pulp/content/distribution/ks-CentOS--7-x86_64/LiveOS/squashfs.img
mv: overwrite ‘/var/lib/pulp/content/distribution/ks-CentOS--7-x86_64/LiveOS/squashfs.img’? y
centos72# chown apache:apache /var/lib/pulp/content/distribution/ks-CentOS--7-x86_64/LiveOS/squashfs.img
centos72# chmod 644 /var/lib/pulp/content/distribution/ks-CentOS--7-x86_64/LiveOS/squashfs.img

Step 4 - Modify the kickstart

The following is an example of what you could do. This assumes 2 x SSDs for RAID-1 and 5 x rotating disks for RAID-5

%pre
# 
# Other pre-installation content lives here too
# 
# Start Dell services
echo "start Dell services"
date
 
/opt/dell/srvadmin/sbin/dsm_sa_datamgrd
/opt/dell/srvadmin/sbin/dsm_sa_eventmgrd
/opt/dell/srvadmin/sbin/dsm_om_shrsvcd
 
sleep 5
 
# Clear dm devices (to avoid conflicts after creating new RAID LUNs - especially since VG name etc will already be in use if reinstalling an existing system)
 
for dmdevicen in `dmsetup info | grep "^Name" | grep -v "live-" | awk '{print $2}'`
    do
    dmsetup remove ${dmdevicen}
done
 
# Define Dell Controller
echo "Listing vdisks"
/opt/dell/srvadmin/bin/omreport storage vdisk controller=0
date
echo "Defining RAID Controller:"
raidcontroller=`/opt/dell/srvadmin/bin/omreport storage controller | grep -B5 '^State\s\{1,50\}: Ready' | grep ^ID | awk '{print $3}'`
echo "RAID controller is ${raidcontroller}"
echo ""
# Wipe existing RAID configuration
echo "Wiping existing RAID config"
/opt/dell/srvadmin/bin/omconfig storage controller controller=${raidcontroller} action=resetconfig
echo ""
# Generate a list of SSD drives
echo "Defining RAID Controller:"
ssddisklist=`/opt/dell/srvadmin/bin/omreport storage pdisk controller=${raidcontroller} | egrep "^ID|^Media" | awk '{print $3}' | grep -B1 SSD | grep -v SSD | tr '\n' ,|sed 's/\,$//'`
echo "SSD Drive list is ${ssddisklist}"
echo ""
# Create a RAID1 array on the SSD drives
echo "Defining RAID Controller:"
/opt/dell/srvadmin/bin/omconfig storage controller controller=${raidcontroller} action=createvdisk raid=r1 size=max pdisk=${ssddisklist} name=ssdvdisk0
echo ""
date
 
# Create a RAID5 array on the rotating disk drives
hdddisklist=`/opt/dell/srvadmin/bin/omreport storage pdisk controller=${raidcontroller} | egrep "^ID|^Media" | awk '{print $3}' | grep -B1 HDD | grep -v HDD | tr '\n' ,|sed 's/\,$//'`
/opt/dell/srvadmin/bin/omconfig storage controller controller=${raidcontroller} action=createvdisk raid=r5 size=max pdisk=${hdddisklist} name=hddvdisk1
 
# Fast initialise the RAID vdisks
vdisklist=`/opt/dell/srvadmin/bin/omreport storage vdisk controller=${raidcontroller} | grep "^ID " | awk '{print $3}'`
for diskn in ${vdisklist}
    do
    /opt/dell/srvadmin/bin/omconfig storage vdisk controller=${raidcontroller} vdisk=${diskn} force=yes action=fastinit
done
 
sleep 3
/sbin/blkid
 
#
# Partitioning logic
# PDISK=`cat /proc/partitions | awk '{print $NF}' | grep sd | sort | head -n1`
PDISK=`/opt/dell/srvadmin/bin/omreport storage vdisk controller=${raidcontroller} | egrep "^Name|^Device Name" |grep -A1 ssdvdisk0 | grep -v ssdvdisk0| awk -F\/ '{print $3}'`
 
cat << EOF > /tmp/part-include
part /boot --fstype=xfs --size=1000 --asprimary --ondisk=${PDISK}
part pv.00 --size=8192 --asprimary --ondisk=${PDISK}
part pv.01 --size=1 --grow --asprimary --ondisk=${PDISK}
 
# Swap
volgroup vgswap pv.00
logvol swap --name=swap.fs --vgname=vgswap --size=1 --grow
 
# OS
volgroup vgos --pesize=4096 pv.01
logvol / --name=root.fs --vgname=vgos --size=16480 --fstype=xfs --grow
EOF
# 
# (other pre content can go here too)
# 	
%end