simple question
Diego Zuccato
diego.zuccato at unibo.it
Wed Jul 3 06:46:51 CEST 2024
I'm using this /srv/fai/config/class/99-disklist.sh based on the one
linked by Thomas:
-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*'
# can not use $0: script is sourced, not run explicitly !
datadir=$FAI/class/99-disklist.d
echo "**** Testing $datadir/$HOSTNAME"
if [ -f $datadir/$HOSTNAME ] ; then
# Source host-specific list. Can define a new list or override filter
. $datadir/$HOSTNAME
fi
if [ -z $newlist ]; then
echo "newlist is empty, filter=$filter"
newlist=$(mydisks $filter )
fi
if [ -n "$newlist" ]; then
echo New disklist in 99-disklist.sh: $newlist
echo "disklist=\"$newlist\" # $0" >> $LOGDIR/additional.var
fi
-8<--
Then I can place a per-host script under
/srv/fai/config/class/99-disklist.d/hostname to modify the list for
'hostname':
-8<--
#!/bin/bash
. /usr/lib/fai/subroutines
newlist=$(smallestdisk)
-8<--
I'll probably extend it a bit to also look for classes.
HIH
Diego
Il 02/07/2024 15:11, Harald Baumgartner ha scritto:
> Hello,
>
> hope it's the correct list.
>
> OS ubuntu 22.04 LTS or higher
>
> is it possible to choose automatically the smaller disk?
>
> In my case there is a Dell Server with RAID-Controller, configured:
>
> sda = ca. 5 TB SSD for data - during install shall be not
> touched/formatted...
>
> sdb = ca. 900 GB SAS = shall be root and OS installed
>
> In other cases, sda = ca. 300 TB (data) and sdb ca. 500 GB => for OS.
>
> Thanks,
>
> Harald
>
--
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