0

I've built an unattended USB installer which installs Centos and our Application binaries. However, anaconda (?) puts the USB device after the hard drives - so servers with two drives, the USB is sdc; three HDDs, sdd etc.

Our servers come in a variety of configurations, with anywhere between 1 and 20 HDDs (or RAID partitions which show up as devices).

Is there any way to avoid having N syslinux menu entries (specifying ks=sdb, ks=sdc, ks=sdd etc) and having N ks.cfg files (specifying "harddrive --partition=sdc1", "harddrive --partition=sdd1", "harddrive --partition=sde1" etc) ??

Modifying the initrd as suggested here is inflexible.

Is there any way to solve this with labels and/or UUIDs?

Danny
  • 255

1 Answers1

1

I use the code to detect HDD or USB. Hope this solution will helpfull.

hard_disks=`lsblk --nodeps -no name,type,tran | grep "disk" | grep -v "usb" | grep -Eo '^[^ ]+'`
count_disk=`echo $hard_disks |grep -o ' ' | wc -l`
if [ $count_disk -ne 0 ]; then
    hard_disks=`lsblk --nodeps -no name,type,tran | grep "disk" | grep -v "usb" | grep -Eo '^[^ ]+' | sed ':a;N;$!ba;s/\n/,/g'`
fi

usb=`lsblk --nodeps -no name,type,tran | grep "usb" | grep -Eo '^[^ ]+'`