[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Retrieve UUID of the partition containing prefix
From: |
Andrei Borzenkov |
Subject: |
Re: Retrieve UUID of the partition containing prefix |
Date: |
Tue, 16 Jun 2015 22:14:39 +0300 |
В Tue, 16 Jun 2015 09:23:05 -0700
"A. Wan" <address@hidden> пишет:
> When I boot a PC with GRUB2 installed I can hit 'c' to get the command
> prompt. Then I enter 'set' and I can see the value for prefix, for
> example:
>
> prefix=(hd0,msdos1)/boot/grub
>
> Then I type 'set root=(hd0,' and hit TAB. GRUB2 shows the list of
> partitions, complete with detected filesystem types and uuid, for example:
>
> Possible partitions are:
> Partition hd0,msdos1: Filesystem type ext* ... UUID abcd...
> Partition hd0,msdos2: Filesystem type ext* ... UUID 1234...
>
> Presumably GRUB2 can tell the UUID and filesystem type of the partition
> containing the prefix (In the above example (hd0,msdos1)/boot/grub). But
> I am unable to find a way to share such information with the Linux kernel
> I want to boot.
>
> This is the use case: My boot disk wants to mount a big filesystem image
> that is always stored in the same partition as the one containing the
> --boot-directory parameter when GRUB2 was installed to the boot media, but
> I do not want to hard-code the UUID of the partition in the grub
> configuration file every time I make another copy of the boot disk.
>
> You may say why not search.fs_label? But why search when GRUB2 already
> know where itself is?
>
> I appreciate any responses. Thank you very much.
>
GRUB currently does not provide means to fetch partition UUID and in
your case I do not quite understand why it is needed. To automatically
boot anything your GRUB must have some configuration file that
initiates loading and booting of Linux kernel. So your boot disk
created using --boot-directory must know filesystem and its UUID and it
is trivial to add a couple of lines to also generate proper grub.cfg
using known UUID.