Configure Dual Boot RHEL 7 and Windows 10 On Two Hard Drives

I have a Dell Optiplex 790 which had been running Windows 10 on a 2.5″ hard drive. In a hurry to set up my “Linux Lab” I purchases a second hard drive  (Western Digital Black-500GB), and installed it and loaded up RHEL as the OS.

Well, I couldn’t resist the urge to tinker a bit and wanted to see if I could run both hard drives under a “Dual Boot” situation.  I have done this before with one hard drive and creating partitions but never with two hard drives. The set up I had, made for the perfect opportunity.  As a new RHCSA student I had to go to the web to see how this could be done and I did find one post that was the most helpful with just a few things missing (for lack of my understanding).

Step 1 – Boot into the OS you have (CentOS, RHEL) – Remember my lack of understanding with other Distros means I don’t know what differs with them.

Step 2 – Run fdisk -l. This will show you what OS’s are where.  For mine, it was sda for the Linux and sdb for the Windows

Step 3 – Open a terminal window and navigate to the following /etc/grub.d/40_custom

Run the following command: vi /etc/grub.d/40_custom

You should see the following:

exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the ‘exec tail’ line above.

Below the last # enter the following by using “Insert”

menuentry “Windows 10” {
set root=(hd1,1)
chainloader +1

Save the changes (:wq!  will save your changes).

Step 4 – Run the following command: grub2-mkconfig –output=/boot/grub2/grub.cfg

Step 5 –  Reboot.  You should now see that the Windows 10 is included in the available boot entries.

A couple of notes:

I was a little confused as to how I should make the entry “set root”.  Should I use hd0, 1 or something else. I tried this first and it failed.

So some more digging to understand GRUB I found the following helpful:

GRUB device naming convention.

(hd0) First hard disk or in my case /dev/sda
(hd1) Second hard disk or in my case /dev/sdb
(hd0,1) First partition of first hard disk in GRUB2
(hd1,1) First partition of the second hard disk in GRUB2
(hd1,2) third partition of the second hard disk in grub-legacy