Thursday 19 January 2017

Add entry for Windows 7 in Grub2 in CentOS7



1)  Create the following file.
[root@block1 ~]# vi /etc/grub.d/40_custom


menuentry "Microsoft Windows 7"{
set root='(hd0,msdos1)'
chainloader +1
}




2) Run the following command.
[root@block1 ~]# cd /boot/grub2
[root@block1 grub2]# grub2-mkconfig -o grub.cfg



3) Reboot the machine. You will now see entry for Windows 7 in grub menu.



Install grub 2 bootloader using CentOS7 Installation DVD




1) Boot the machine using CentOS installation DVD

2) On the first screen, Select the option Troubleshooting.

3) On the next screen, select the option Rescue a CentOS system.

4) On the next screen, The rescue environment will now attempt to find your linux installation and mount it under the dir /mnt/sysimage. Select the option Continue.

5) You will now get a shell prompt.

6) Type the following commands
 
chroot /mnt/sysimage

grub2-install /dev/sda

exit

exit


7) Remove the dvd and boot from the harddisk.