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
  • 235
  • 2
  • 10
  • The docs have an [ancient example script](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html#sect-kickstart-preinstall) which you could modify to deal with the hard drives. And the [`partition` docs](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html#idp21892584) state that you can reference disks by ID or path. – Michael Hampton Jan 18 '16 at 03:57

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 '^[^ ]+'`
Hai Nguyen
  • 63
  • 6