Using Label Search With Grub2 And Fstab
to simplify your life
You will probably come across situations where you are unsure of the physical address of a partition. In the past, grub required the root partition to be specified as a physical address such as /dev/sda2
This works fairly well when you have a limited number of partitions and your disk drives are not frequently moved. As the number of partitions increases or you move to a virtual environment like Oracle’s VirtualBox, it becomes less likely you can be sure of the physical address. Hot swapping disks may also cause the physical address to change.
Another way to specify a partition for grub is via UUID in the format:
UUID=75e8b058-dba5-4081-96aa-fc6fd814d1a9
UUID’s work reliably, but they're not very friendly. When you run a partition tool like gparted, it is not obvious, from the UUID's, which partition is which.
Grub2 has the ability to search and boot using a partition label like ubuntu-24.04
This is easy to remember and grub2 will reliably find that label even if it is on partition 17 of a GPT drive that has been moved from controller to controller several times. When you look at your partitions using gparted, you can tell from the label exactly what a partition contains.
Once you have your partitions labeled, you no longer have to worry about partition layouts or disk controller order. You can move drives and partitions around freely and, as long as the labels are correct, grub will boot your systems properly. This is particularly important in a virtual environment, where drives and partitions can be quite dynamic.
I've included instructions on:
Created with the Personal Edition of HelpNDoc: Write EPub books for the iPad