Define sda as the smallest disk
Diego Zuccato
diego.zuccato at unibo.it
Thu Feb 22 09:02:21 CET 2024
I think there's a bug (well, a missing piece) in 99-disklist.sh: egrep
ignores SCSI disk, considering just ATA and NVME.
If it can be useful, I also modified the script to look into
99-disklist.d for hostname-specific configs (I prefer having separate
files instead of embedding in a bigger one):
-8<-- 99-disklist -8<--
#! /bin/bash
mydisks() {
find $* -type l -printf "%f %l\n" | grep -Pv
'^md|-part\d|^wwn-|^nvme-eui|^nvme-nvme' | egrep '^scsi|^ata|^nvme' |
sed -e 's#.*/##g'| tr '\n' ' '
}
# This is really important, because we use shell globbing for creating
the list of disks
cd /dev/disk/by-id || echo Cannot get disk information
filter='nvme*'
if [ -f $0.d/$HOSTNAME ] ; then
# Source host-specific list.
# Can define a new list or just override filter
. $0.d/$HOSTNAME
fi
if [ -z $newlist ]; then
newlist=$(mydisks $filter* )
fi
if [ -n "$newlist" ]; then
echo New disklist: $newlist
echo disklist=\"$newlist\" >> $LOGDIR/additional.var
fi
-8<--
Note the missing .sh extension.
The 99-disklist.d/$HOSTNAME file is just:
-8<--
#!/bin/bash
filter='scsi-*'
# or
#newlist='sda'
-8<--
HiH.
Diego
Il 31/01/2024 13:49, Thomas Lange ha scritto:
> Hi all,
>
> that is the example how to change the shell variable $disklist:
> https://fai-project.org/download/misc/99-disklist.sh
>
> Create the script class/99-disklist.sh in your config space (/s/rv/fai/config)
>
> These are the imprtant lines:
>
> if [ -n "$newlist" ]; then
> echo New disklist: $newlist
> echo disklist=\"$newlist\" >> $LOGDIR/additional.var
> fi
>
>
> This script writes the new valuespf disklist to
> $LOGDIR/additional.var. Then FAI will parse it and sets the new value
> for disklist before calling setup-storage.
>
> regards Thomas
--
Diego Zuccato
DIFA - Dip. di Fisica e Astronomia
Servizi Informatici
Alma Mater Studiorum - Università di Bologna
V.le Berti-Pichat 6/2 - 40127 Bologna - Italy
tel.: +39 051 20 95786
More information about the linux-fai
mailing list