Skip to content

September 26, 2019 · Steven A

Check if system (RHEL/CENTOS )is UEFI or BIOS

Please run the following script to find out if your system is UEFI or BIOS

 

#!/bin/bash
[ -d /sys/firmware/efi ] && fw=”UEFI” || fw=”BIOS”
echo -e “$fw”
if [ “$fw” == “UEFI” ] ; then
mygrub=’/boot/efi/EFI/redhat/grub.cfg’
echo -e “\n\tUEFI detected, this is a ($fw) system., and the boot config is located at ($mygrub)”
else
mygrub=’/boot/grub2/grub.cfg’
echo -e “\n\t($fw) system detected your boot config is located at ($mygrub)\n”
fi

One thought on “Check if system (RHEL/CENTOS )is UEFI or BIOS”

  1. The script’s check on /sys/firmware/efi is the quickest way to tell, but hardcoding the EFI grub path to redhat/grub.cfg can mislead on CentOS or RHEL derivatives where the vendor directory differs. Before trusting that path, run ls /boot/efi/EFI to see the actual directory name, then adjust the variable. Also note that efibootmgr -v shows the real boot entries the firmware uses, which is worth checking alongside the filesystem test.

Leave a Reply

Your email address will not be published. Required fields are marked *