Sunday, September 30, 2018

How to display your Windows installation on GRUB during boot after Centos 7 installation




Sometimes when you install Centos 7, your Windlows installation may fil to siaplay in GRUB. To resolve this, you need to run a script to detect operating systems installed then generate the grub configuartion file a new.

1. Check if Windows is detected. This is done by running grub2-mkconfig but discard it’s output

$  sudo grub2-mkconfig > /dev/null 
[sudo] password for wm: 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-ae7675c335964b24b4eef02de916ece2
Found initrd image: /boot/initramfs-0-rescue-ae7675c335964b24b4eef02de916ece2.img
Found Windows 7 (loader) on /dev/sda1
done

2. If Windows is listed as above, now run the command again and save the configuration file. It’s good to first make a backup of current configuration file.

$ sudo cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

3. Now if all went well, you should boot into Windows.

Extra
If you would like to edit the names of operating systems displayed by grub, simply access the grub config file and make the edits.

$ sudo vim /boot/grub2/grub.cfg

No comments:

Post a Comment