grub: add a note about filesystem UUID and partition UUID usage

Text only change.
This commit is contained in:
Xi Ruoyao 2022-08-26 20:11:57 +08:00
parent d84087141c
commit 5353a1948f
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3

View File

@ -155,6 +155,38 @@ EOF</userinput></screen>
<emphasis>set root</emphasis> line to point to the boot partition.
</para></note>
<note>
<para>The GRUB designator for a partition may change if you added or
removed some disks (including removable disks like USB thumb devices).
The change may cause boot failure because
<filename>grub.cfg</filename> refers to some <quote>old</quote>
designators. If you wish to avoid such a problem, you may use
the UUID of partition and filesystem instead of GRUB designator to
specify a partition.
Run <command>lsblk -o UUID,PARTUUID,PATH,MOUNTPOINT</command> to show
the UUID of your filesystems (in <literal>UUID</literal> column) and
partitions (in <literal>PARTUUID</literal> column). Then replace
<literal>set root=(hdx,y)</literal> with
<literal>search --set=root --fs-uuid <replaceable>&lt;UUID of the filesystem where the kernel is installed&gt;</replaceable></literal>, and replace
<literal>root=/dev/sda2</literal> with
<literal>root=PARTUUID=<replaceable>&lt;UUID of the partition where LFS is built&gt;</replaceable></literal>.</para>
<para>Note that the UUID of a partition and the UUID of the filesystem
in this partition is completely different. Some online resources may
instruct you to use
<literal>root=UUID=<replaceable>&lt;filesystem UUID&gt;</replaceable></literal>
instead of
<literal>root=PARTUUID=<replaceable>&lt;partition UUID&gt;</replaceable></literal>,
but doing so will require an initramfs which is beyond the scope of
LFS.</para>
<para>The name of the device node for a partition in
<filename class='directory'>/dev</filename> may also change (more
unlikely than GRUB designator change though). You can also replace
paths to device nodes like <literal>/dev/sda1</literal> with
<literal>PARTUUID=<replaceable>&lt;partition UUID&gt;</replaceable></literal>,
in <filename>/etc/fstab</filename>, to avoid a potential boot failure
in case the device node name has changed.</para>
</note>
<para>GRUB is an extremely powerful program and it provides a tremendous
number of options for booting from a wide variety of devices, operating
systems, and partition types. There are also many options for customization