In Fibre channel cluster environment, it is important to be very careful when kickstarting a storage node attached via fibre channel.  You never want to accidentally install OS on a SAN disk.

How to prevent this hapening ? One way is to have a script check if the disk is a FC disk before preceding partition and installation.It will work.


Here is another way to remove the FC driver out of kernel and the anaconda kernel can't see any FC disk.

Here is the example using SL7.2, will be same for RHEL7/CentOS7.

Removing FC module from anaconda kernel.

There are two places where the modules need to be removed - the initrd image and the LiveOS image.  This is distinctly different from previous RHEL versions.

In the example below, Qlogic HBA card is used.

Modifying initrd image

create a working directory and unpack the initrd image into it:

# mkdir /var/tmp/work ; cd /var/tmp/work
# cp -p /ks/mirror/7.2/x86_64/images/pxeboot/initrd.img .
# file initrd.img
initrd.img: xz compressed data
# xz -S .img initrd.img --decompress
# ls
# file initrd
initrd: ASCII cpio archive (SVR4 with no CRC)
# cat initrd | cpio -dimvu
# rm initrd

Find the kernel driver modules and remove the qla2* and lpfc drivers:

# $ find . -name qla2xxx
# rm -rf usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/scsi/qla2xxx

# find . -name lpfc
# rm -rf ./usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/scsi/lpfc

repack the initrd image:

# find . | cpio -o -H newc | xz --format=xz > ../initrd.img

make a special directory in the PXE-boot area and copy the kernel and the modified initrd image into it:

# cd /osinstall/nbp
# mkdir x86_64_hsm_sl7.2
# cd x86_64_hsm_sl7.2
# cp -p /ks/mirror/7.2/x86_64/images/pxeboot/vmlinuz .
# cp -p /var/tmp/work/initrd.img .

Modifying LiveOS image

I have not succeeded yet in using inst.stage2 as an anaconda kernel argument (more research needed); but instead I overwrote the distribution LiveOS image after removing the fibre channel drivers from it - this works too, if you do not need those drivers anywhere in other installations.  You must do the prep work on an SL7 node, since SL 6 barfs on the squashfs image. The squashfs-tools RPM must be installed on the working node.

copy LiveOS/squashfs.img from the SL 7 tree to an SL 7 node:

# scp -p /path/to/7.2/x86_64/LiveOS/squashfs.img somenode:/some/path/

See what is in the image on you working SL 7 node:

# unsquashfs -l squashfs.img

mount the image to pull out the rootfs.img file:

# mkdir -p /mnt/tmp
# mount squashfs.img /mnt/tmp -o loop
# cp -a /mnt/tmp/LiveOS .
# mkdir sqashfs-root
# mv LiveOS sqashfs-root/
# cd sqashfs-root/LiveOS

unmount the image, and mount instead the rootfs image:

# umount /mnt/tmp
# mount rootfs.img /mnt/tmp -o loop

Now find and remove the fibre channel drivers

# cd /mnt/tmp/
# find . -name 'qla2xxx*'
# rm -rf ./usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/scsi/qla2xxx

# find . -iname 'lpfc*'
# rm -rf ./usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/scsi/lpfc

### 'cd' out of the image, unmount it and repack (squash) it
# cd -
# umount /mnt/tmp
# cd ../../   ## you want to be above sqashfs-root/
# mksquashfs sqashfs-root ./ -comp xz -Xbcj x86

### overwrite the remote LiveOS image with it on your local mirror
# cd /path/to/7.2/x86_64/LiveOS/
# mv squashfs.img squashfs.img.orig
# scp somenode:/path/to/ sqashfs.img

Comments powered by CComment