Define sda as the smallest disk

Thomas Lange lange at cs.uni-koeln.de
Wed Jan 31 12:41:45 CET 2024


>>>>> 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