How to change grub2 in CentOS/RHEL7 from UUID to old style device?

6,914

This is possible by adding the parameter as follows to /etc/default/grub.

$ echo "GRUB_DISABLE_LINUX_UUID=true" >> /etc/default/grub
$ grub2-mkconfig -o /boot/grub2/grub.cfg

If you want to double check the result before.

$ grub2-mkconfig | less

Update

To completely disable the UUID in GRUB, you need to add the line as follows to /etc/sysconfig/grub

$ echo "GRUB_DISABLE_UUID=true" >> /etc/default/grub
$ grub2-mkconfig -o /boot/grub2/grub.cfg
Share:
6,914

Related videos on Youtube

Nils
Author by

Nils

I studied information science and did computers from the old Commodore VC-20 onwards. I started during study as pc-admin for DOS, Windows, WfW and all related software and hardware stuff. Later I switched over to servers, starting with linux-samba and NT 3.5/4.0. My first job made me a Solaris admin in a huge company with over 500 solaris servers. There I got every day a new interesting problem that I have never encountered before. My next job brought me into project management and later back to system administration - mainly Linux. It was frustrating to manage a project when you knew that doing the admin`s job yourselv would have the current step finished in less than 30 minutes...

Updated on September 18, 2022

Comments

  • Nils
    Nils over 1 year

    With CentOS/RHEL 7 there are a couple of changes (compared to CO/RHEL 6). One of it is the use of grub2 instead of grub.

    Per default the OS seems to use a UUID to "find" the boot-device.

    Is there an easy to use receipe to get back to device-names (like /dev/sda1) instead?

    Background of the question: I am intending to clone additional VMs from a template. Base is a new (virtual) disk device with a different UUID.

    If I can not revert to sda1 I will need to change the UUID of the clone in the grub.cfg to the new UUID - which is plan "B".

    Update 2017-10-26

    The kernel-parameter for root= will be changed to the disk - see the answer from Thomas below.

    There remains a problem with this section, generated by grub2-mkconfig:

        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  716433ab-9e30-42a7-a272-6c66243499d2
        else
          search --no-floppy --fs-uuid --set=root 716433ab-9e30-42a7-a272-6c66243499d2
        fi
    

    This still contains the search for the UUID. If it can't be found, the boot-process will go to error "not found" or something like that. After pressing ENTER the system will boot up ok.

    The remaining Q is how to inactivate that section (I did not find the place to disable the feature_platform_search_hint)?

  • Nils
    Nils over 6 years
    Looks good. I will give it a try. Can you Link your answer to a source for that Info?
  • Nils
    Nils over 6 years
    I tried, but the config still searches for UUIDs, but it also appended other search options. I need to clone the VM to test it...
  • Thomas
    Thomas over 6 years
    Could you precise a bit what you have done and which config...double check that GRUB_DISABLE_LINUX_UUID=true is in the /etc/default/grub and check what grub2-mkconfig | grep root= returns.
  • Nils
    Nils over 6 years
    I updated my Q with further details - if you can solve this too, I will accept your answer.
  • Nils
    Nils over 6 years
    Yep - the GRUB_DISABLE_UUID did the job.