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
Select rescue a Centos system
when boot ask you how to mount a system select continue and it gives you access to a shell.
grub2-install –root-directory=/mnt/sysimage/ /dev/sda
a then reboot
Enjoy
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.
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).
try
grub2-install –root-directory=/mnt/sysimage/ /dev/sda
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?
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