help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Read the UUID of a partition into a variable


From: Adam Purkrt
Subject: Read the UUID of a partition into a variable
Date: Mon, 6 Jul 2015 20:24:20 +0200

Is it possible to read the UUID of a partition into a variable in grub?

More specifically, I'm looking for the uuid of $root.

I have grub and couple of iso files on a flash on one partition, among
them arch linux. Grub loads fine. The relevant part of grub.cfg is

imgdevpath="/dev/disk/by-uuid/CF3D-EC7C"

menuentry '[loopback]archlinux-2015.07.01-dual.iso i686' {
    set isofile='/boot/iso/archlinux-2015.07.01-dual.iso'
    loopback loop $isofile
    linux (loop)/arch/boot/i686/vmlinuz archisolabel=ARCH_201507
img_dev=$imgdevpath img_loop=$isofile earlymodules=loop
    initrd (loop)/arch/boot/i686/archiso.img
}

This all works as intended - but it was necessary to set up the UUID
in imgdevpath by hand, which feels inconvenient and not really
necessary. I am able to read the UUID [among other things] with "ls
($root)" in grub interactively. Is there a way to read it to a
variable, at a boot time?

I.e. I'd like to have something like the following in grub.cfg:

readuuid ($root) --set=rootuuid
imgdevpath="/dev/disk/by-uuid/$rootuuid"
...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]