Configuring Grub 2 on CentOS 7 to Dual Boot with Windows 7:
- Once you install CentOS 7 alongside your Windows OS, you may find that you cannot boot into Windows. The Grub bootloader may only show your Linux OS as your only options to boot from.
- To fix this and have the Grub bootloader list your Windows OS, you need to edit the Grub bootloader files.
- If you have used CentOS is the past (with 6 or earlier), you may find that editing Grub is different. Previously, you would edit /boot/grub/grub.conf.
- This is no longer the case, as the grub2.cfg file is generated dynamically, based on dependency files. Here’s what you need to edit to configure your bootloader.
- Boot into CentOS 7.
- Determine what partition your Windows OS resides on by running sudo fdisk -l in Terminal.
In this example, /dev/sda1 is the recovery partition, and /dev/sda2 is the Windows OS partition. Since partition indexes start at zero, the Windows OS partition will be `hd0,1` (a = 0, 2 = 1; or first disk, second partition) when we edit the Grub file. Make note of this.
- Open a terminal and navigate to /etc/grub.d/:
- Edit the 40_custom file. You may not see the file if you ls in /grub.d/.
- You should see the following in the nano text editor:
- Below the last #, type on a new line:
- Finally, run the following to apply the changes to the grub.cfg file:
- Once you reboot, you should see the option of booting into Windows 7.
- If a default boot entry into Windows (or something else) is requested, then you need to edit the GRUB_DEFAULT in /etc/default/grub: