LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   using labels in grub2. How? (https://www.linuxquestions.org/questions/linux-software-2/using-labels-in-grub2-how-819474/)

Mountain 07-12-2010 05:39 PM

using labels in grub2. How?
 
I want to generate a grub.conf that will search for my /dev/sda1 based on the filesystem label, not the UUID.

I did change /etc/default/grub to so that GRUB_DISABLE_LINUX_UUID="true" and I regenerated grub.cfg.

But I want to go one step further and change the search statements. I notice they still reference the old UUID. I also know grub2 can search by label. Can anyone tell me how to do this? Thanks.

EDIT:

I could use some help understanding this page:
http://www.gnu.org/software/grub/man...ub.html#search

Quote:

12.3.28 search

— Command: search [--file|--label|--fs-uuid] [--set var] [--no-floppy] name
Search devices by file (-f, --file), filesystem label (-l, --label), or filesystem UUID (-u, --fs-uuid).

If the --set option is used, the first device found is set as the value of environment variable var. The default variable is ‘root’.

The --no-floppy option prevents searching floppy devices, which can be slow.

The ‘search.file’, ‘search.fs_label’, and ‘search.fs_uuid’ commands are aliases for ‘search --file’, ‘search --label’, and ‘search --fs-uuid’ respectively.
I'd like my grub.cfg to contain statements similar to this:

Code:

search --no-floppy --label MyLabel --set root
linux /boot/vmlinuz-2.6.3x-xx-generic root=LABEL=MyLabel ro quiet splash
initrd /boot/initrd.img-2.6.3x-xx-generic

Assuming that's the right syntax, how do I make grub2 generate label-based menu entries like that?

Mountain 07-12-2010 06:25 PM

See answer here:
http://forums.linuxmint.com/viewtopic.php?f=46&t=38599

and support here:
http://wiki.archlinux.org/index.php/GRUB2

But I still need to figure out how to do this via the intended grub.d files rather than manually editing grub.cfg. Any help?

Mountain 07-13-2010 06:00 PM

Quote:

Originally Posted by Mountain (Post 4031309)
But I still need to figure out how to do this via the intended grub.d files rather than manually editing grub.cfg. Any help?

Solved here:
http://ubuntuforums.org/showpost.php...1&postcount=19
Updated URL:
http://ubuntuforums.org/showthread.p...64#post9585964


All times are GMT -5. The time now is 09:07 PM.