repair grub2

Grub2 files are missing from /boot. How to recover ?

Repair Grub2

Grub2 or Boot Repair  

Due to some file corruption or mishandling we lost grub. This can cause the system to hang in the boot.

When you reboot the system it will not boot, So before rebooting the system check this file is in place or not. If you accidentally rebooted and the system is unable to boot then boot the server in rescue mode and follow the below steps.

Environment

  • Red Hat Enterprise Linux 7 
  • CentOS 7
  • RHEL 8

Issue

  • Missing the ‘/boot’, grub folder, and grub.conf file which are essential to boot the system.
  • How to recover missing boot files ?

Resolution

  • Verify Boot directory contents are really missing or the /boot is not mounted properly :
#ls /boot/grub2/
  • Install grub2:
#grub2-install /dev/<disk name>
  • Create grub.cfg file:
#grub2-mkconfig -o /boot/grub2/grub.cfg
  • Create device.map file if missing:
#vi /boot/grub2/device.map

(hd0) /dev/<disk name>
  • Reboot
Now the server or PC  will boot properly. In this article, we have learned the way to recover grub and save it from reinstallation.

Leave a Comment

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