How to check if server is BIOS/UEFI Booted in CentOS/RHEL

If you are planning to use a hard disk of size more than 2TB UEFI comes into the picture. Today, I came across a situation where I had to turn off transparent huge pages on one of the RHEL 7 servers. To make change, I had to modify default grub file i.e /etc/default/grub and reconfigure grub configuration file. Now the based-on boot option the grub configuration file changes as below.

BIOS-based Machines: /boot/grub2/grub.cfg UEFI-based Machines: /boot/efi/EFI/redhat/grub.cfg

Now, I was not sure if the server is BIOS booted or UEFI. Below are the ways to check if server is booted with BIOS/UEFI

1. Check if directory “/sys/firmware/efi” exist on the server. If not means, server is BIOS booted.

$ sudo ls -l /sys/firmware/efi
ls: cannot access /sys/firmware/efi: No such file or directory

2. Check executing below command. If command is not working, make sure package “efibootmgr” is installed on the server.

$ sudo efibootmgr
EFI variables are not supported on this system.

As the command is not showing any EFI variables, the server is BIOS booted.