Re: Some troubles with grub with buster point release 10.8

Carsten Aulbert <[email protected]>
Newsgroups gmane.linux.debian.fai
Message-ID <[email protected]>
Hi

On 10.02.21 19:59, Thomas Lange wrote:
> I think we want to match all real disks which can be identified by a
> name, model, serial number. Maybe also virtualized disks which have
> such an entry at by-id.

given that the `ata` bits came from my initial script and the fact that 
we mostly have SATA drives in our machines, I feel a bit of guilty ;-)

Would something like a "choice-priority" function fly instead?

I assume udevadm would return any of the valid device links and by-path 
is always set, thus:

get_stable_devname() {
     _DEV="$1"

     # prefer SCSI over ATA over WWN over path 

     RET=""
     for i in $(udevadm info -r --query=symlink "$_DEV")
     do
         if [[ "$i" =~ /by-id/scsi && -z "$RET" ]]
         then
             RET="$i"
         elif [[ "$i" =~ /by-id/ata && -z "$RET" ]]
         then
             RET="$i"
         elif [[ "$i" =~ /by-id/wwn && -z "$RET" ]]
         then
             RET="$i"
         elif [[ "$i" =~ /by-path/ && -z "$RET" ]]
         then
             RET="$i"
         fi
     done

     echo "$RET"
}

get_stable_devname /dev/sda

(or am I missing the point)?

Cheers

Carsten
-- 
Dr. Carsten Aulbert, Max Planck Institute for Gravitational Physics,
Callinstraße 38, 30167 Hannover, Germany, Phone +49 511 762 17185
smime.p7s (application/pkcs7-signature, 5.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.