Define sda as the smallest disk

Rémy Dernat remy.d1 at gmail.com
Wed Jan 31 13:44:17 CET 2024


I know I could change directly the subroutine code from the
"set_disk_info" function, but if I can avoid doing this and doing
something better / cleaner...

Le mer. 31 janv. 2024 à 12:48, Rémy Dernat <remy.d1 at gmail.com> a écrit :
>
> Ok, Thanks Thomas.
>
> So, let's say I want to get a `$disklist` as an environment variable
> for the setup-storage step (or '-D'), and this disklist is :
> `$(newdisk_list=$(all_disks_by_size |sort -r | tr "\n" " ")`
>
> How could I change my disk_config file to use this new list ? By
> modifying `class/20-hw-detect.sh` (?); in the beginning of the
> scripts, it says that the outputs of `*.sh` scripts are ignored ...
>
> Thanks,
> Rémy
>
> Le mer. 31 janv. 2024 à 12:42, Thomas Lange <lange at cs.uni-koeln.de> a écrit :
> >
> > >>>>> On Wed, 31 Jan 2024 11:15:46 +0100, Rémy Dernat <remy.d1 at gmail.com> said:
> >
> >     > Hi Thomas,
> >     > That looks fantastic. Is there any examples to use these functions ?
> > No, the documentation is really bad. In FAI the disk list is created
> > by these two steps:
> >
> > set_bootstick
> > all_disks_and_size | checkdisk $FAI_BOOTSTICK | once_only
> >
> >
> >
> > From the sources (lib/subroutines)
> >
> > matchdisks() {
> >     # matchdisks PATTERN PATTERN ....
> >
> > checkdisk() {
> >     # read lines with device name and size and check if device is a disk
> >     # $1 can be a device name that will be ignored. Used for the device
> >     # name of the USB stick if we boot from it
> >
> > disks_by_id() {
> >     # list all disks by ID and their link to the device name
> >
> > all_disks_and_size() {
> >     # print a list of devices and their block size
> >
> >
> > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > all_disks_by_size() {
> >     all_disks_and_size | sort -nr -k2 | checkdisk $FAI_BOOTSTICK
> > }
> > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > largestdisk()  {
> >     all_disks_and_size | sort -nr -k2 | checkdisk $FAI_BOOTSTICK | head -1
> > }
> > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > smallestdisk() {
> >     all_disks_and_size | sort -n  -k2 | checkdisk $FAI_BOOTSTICK | head -1
> > }
> >
> > set_bootstick() {
> >     # determine the device of the USB stick we boot from
> >     # sets the variable FAI_BOOTSTICK
> >
> >
> >
> > --
> > regards Thomas


More information about the linux-fai mailing list