I would like to have a grub config that will work even if the disk is re-plugged into a different SATA port and independent of whether other disks are plugged in.
Lets say i today have this config: set root='hd5,gpt2' search --no-floppy --fs-uuid --set=root 4bdb3675-62ff-499f-9fc4-e5fd8c7ba777 linux /vmlinuz root=/dev/sdf5 ro The problem really is the "root=/dev/sdf5" when starting linux. When the disk is plugged into a different slot, or if one of the prior disks is removed, then /dev/sdf5 will be wrong. I know, ideally inux should be able to solve the problem itself, but it seemingly can't: LABEL=<label> or similar are not available when choosing the root partition. Is there a way to evaluate grub2 variables being passed to a command like the linux command ? E.g.: something like: set root='hd5,gpt2' search --no-floppy --fs-uuid --set=root 4bdb3675-62ff-499f-9fc4-e5fd8c7ba777 set linuxroot="/dev/sdf2" if [ "x$root" = "hd4,gpt2" ]; then set linuxroot="/dev/sde5" fi ... if [ "x$root" = "hd0,gpt2" ]; then set linuxroot="/dev/sda5" fi linux /vmlinuz root="$linuxroot" ro Of course, if grub supports shell style 'case' statement, the string mapping would be easier, but the main question is really if there is a way to pass the value of $linuxroot to the linux command somehow. Alas, couldn't figure out the ansewer to this question from the grub2 manual ;-( Thank you so much Toerless