CentOS / RHEL 7 now includes GRUB2 which uses a new way of installing to the MBR of your boot device. You may have to reinstall the GRUB2 bootloader if your system is not bootable after a failure. In order to reinstall GRUB2 you have to boot into rescue mode. Follow the steps below to boot into rescue mode and reinstall GRUB2 bootloader.
Booting into rescue mode and reinstalling GRUB2
1. Boot from the RHEL7 installation DVD by altering the boot order in Bios and selecting DVD media as the first booting preference.
Its is always an issue when you install Windows over Linux or after a Linux installation. The boot-loader record is altered and Windows boots without giving option for Linux. The default boot-loader for Fedora and most Linux OS is Grub. This is how to fix such problems. Lets guide you on step-step procedures to fix. If the two disks are /dev/sda and /dev/sdb, run both grub-install /dev/sda and grub-install /dev/sdb. Then both drives will be able to boot alone. Make sure that your Grub configuration doesn't hard-code disks like (hd0), but instead searches for the boot and root filesystems' UUIDs. When you’ve done this, you type the command /sbin/grub-install followed by the location in which you want to install the GRUB stage 1 boot loader. For example, to install GRUB in the MBR of the master IDE drive, you type this command. root@gurkulindia1 /# /sbin/grub-install/dev/hda. The next time you boot the system, the GRUB boot loader.
2. At the boot screen, Select the Troubleshooting option at the end of the screen.
3. At the next screen, select the option Rescue a CentOS Linux system.
4. On the next screen, press enter to continue. When asked if you would like Rescue to find your installation, choose Continue.
If you run into trouble detecting your install, retry using the Skip option and manually detect and mount your storage. You would get a message shown in the picture below if the rescue mode has detected the correct installation.
5. Next step is to change your root directory to /mnt/sysimage using the chroot command. This makes your system the root environment.
Install Grub Bootloader On Usb
6. Use the grub2-install command to re-write the MBR to your boot device. The boot device is usually /dev/sda.
You should get a successful installation message as shown below.
To reboot the system first exit from the chroot environment and the run reboot command.
Reinstalling grub2 on UEFI-based machines
Install Grub Bootloader On Windows
If you are on an UEFI-based machine, make sure you add the below 2 steps as well before you re-install GRUB2 using “grub2-install” command.
How To Install Grub Loader
1. If the EFI System Partition has been recreated or damaged, these files can be recovered by reinstalling the grub2-efi, grub2-efi-modules and shim packages.
2. If /boot/efi/EFI/redhat/grub.cfg has been removed or damaged, it can be restored with the following command: