Centos 7 recover grub

I use an old computer for testing purposes at home, one problem of grub is when you install a windows system it removes grub and you can’t access to your Centos 7 system.

reinstall grub is really easy.

step 1.

Boot your computer from a dvd o flash memory with centos 7 install disk

step 2.

select troubleshooting menu

Centos 7 boot troubleshootingstep 3

Select rescue a Centos system

centos 7 rescue a centos systemStep 4

when boot ask you how to mount a system select continue and it gives you access to a shell.

Centos 7 grub recoverwrite

grub2-install –root-directory=/mnt/sysimage/ /dev/sda

a then reboot

Enjoy

 

5 Replies to “Centos 7 recover grub”

  1. Hi,
    i have given the same command for (grub2-install –root-directory=/mnt/sysimage/ /dev/sda1). But is showing error. For your reference given below the screenshot.

    1. grub2-install: error: hostdisk//dev/sda1 appears to contain a xfs filesystem which isn’t known to reserve space for DOS-style boot. Installing GRUB there could result in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup (–skip-fs-probe disables this check, use at your own risk).

  2. make a fdisk /dev/sda and print table partitions to see how is configured?
    ¿Are you using a hard disk bigger that 3tb?
    ¿UEFI BOOT?

  3. I make this:

    Boot the system from an installation boot medium.

    Type linux rescue at the installation boot prompt to enter the rescue environment.

    Type chroot /mnt/sysimage to mount the root partition.

    Type /sbin/grub-install /dev/hda to reinstall the GRUB boot loader, where /dev/hda is the boot partition.

    Review the /boot/grub/grub.conf file, as additional entries may be needed for GRUB to control additional operating systems.

    Reboot the system.

    Via: https://www.centos.org/docs/5/html/5.1/Installation_Guide/s2-rescuemode-boot-reinstall-bootloader.html

Leave a Reply

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