Moving from UEFI to BIOS

Issues related to applications and software problems and general support
Post Reply
Posts: 12
Joined: 2015/10/05 15:12:40

Moving from UEFI to BIOS

Post by jbailey » 2023/05/10 00:51:34

Hi all,

I have a bunch of x86_64 CentOS 9 Stream VMs that are all set up to use UEFI. That's great, except that my backup appliance, it turns out, won't take UEFI + GPT. I can do BIOS + GPT, however, so that is what I'm trying to do. The problem is that I am no GRUB expert.

Currently these VMs use two virtual disks -- sda is a boot drive (MBR/ext4), and sdb is for OS + data (GPT/LVM/XFS). sda1 is /boot/efi and sda2 is /boot.

My theory was the following but the VM doesn't boot after the change (and yes, I'm changing the VM's properties to use BIOS firmware and not UEFI firmware).

Code: Select all

dnf install grub2-pc
parted /dev/sda1 set partition-number bios_grub on
grub2-install --target=i386-pc /dev/sda
grub2-mkconfig |awk '{gsub("linuxefi /", "linux /");gsub("initrdefi /", "initrd /");print $0}' > /boot/grub2/grub.cfg
Comment out /boot/efi in /etc/fstab

Power down the VM and change the boot firmware to BIOS. Power back up.

Any suggestions for a GRUB newbie? Thanks!

User avatar
Site Admin
Posts: 32774
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Moving from UEFI to BIOS

Post by TrevorH » 2023/05/10 09:21:00

RHEL 9 doesn't use grub.cfg in the same way as older versions. It's now switched over to using individual files like /boot/loader/entries/$(machineid)-$(uname -r).conf so your awk is not doing anything.
CentOS 8 died a premature death at the end of 2021 - migrate to Rocky/Alma/OEL/Springdale ASAP.
Info for USB installs on
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke

Post Reply