Windows boot option is missing after installing CentOS 7, how can I get it back?
This is usually fixed by running the scripts detect the installed operating systems and generate the boot loader's (grub2
in this case) configuration file. On CentOS 7, that should be grub2-mkconfig
.
Check that windows is detected. Run
grub2-mkconfig
but discard its output:$ sudo grub2-mkconfig > /dev/null Generating grub configuration file ... Found background image: /usr/share/images/desktop-base/desktop-grub.png Found linux image: /boot/vmlinuz-3.16.0-4-amd64 Found initrd image: /boot/initrd.img-3.16.0-4-amd64 Found memtest86+ image: /boot/memtest86+.bin Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin Found Windows 7 (loader) on /dev/sda2
The output will look similar (but not identical) to what is shown above. Make sure that Windows is listed.
If Windows was listed in the previous step, go ahead and save the new configuration file. Make a backup first, just in case.
sudo cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.old sudo grub2-mkconfig -o /boot/grub2/grub.cfg
If all went well, you should now be able to reboot into Windows.
Following up on the answer by @terdon - when you do the test-step, and grub2-mkconfig does not find the Windows partition. Next, make sure you have the "ntfs-3g" package installed, so that your Linux system can read the Windows partition(s).
sudo yum install ntfs-3g
After installing that, when you run
sudo grub2-mkconfig > /dev/null
... you should see the windows boot listed. If the other entry / entries are OK, go ahead and write it.
I came across this issue when installing CentOS 7.0. Windows was not initially listed in the output of grub2-mkconfig.
In order to install ntfs-3g as suggested in another answer, I had to first install epel-release:
sudo yum install epel-release
Simply trying sudo yum --enablerepo epel install ntfs-3g
resulted in a repository not found message.
Installing epel-release enabled the installation of ntfs-3g. From there, the Windows partition was listed in grub2-mkconfig. The steps in the previous answers then gave the option to select windows at boot.