How to add Windows 7 Boot Entry to GRUB2 on CentOS 7

How to Add Windows 7 Boot Entry to GRUB2 Bootloader of CentOS 7 / RHEL 7 / Scientific Linux 7 / Oracle Linux 7. GRUB 2 (GRand Unified Bootloader) that is the default bootloader for RHEL based EL distro. All system when installed with the RHEL based EL distros to respective dual boot with Microsoft windows 7. The add Windows 7 Boot menu to respective GRUB 2 based bootloader on RHEL 7 based  EL distro. You need to follow every steps of given tutorial below.

How to Add Windows 7 Boot Entry to GRUB2 bootloader of RHEL based EL?

Step-1 (Check the Windows 7 Bootable NTFS partitions)
[root@techbrown ~]# fdisk -l
Sample Output
Disk /dev/sda: 250.1 GB, 250059350016 bytes, 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x6b07969f

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
/dev/sda2 206848 143566847 71680000 7 HPFS/NTFS/exFAT
/dev/sda3 426172416 488393119 31110352 7 HPFS/NTFS/exFAT
/dev/sda4 143566910 426172319 141302705 f W95 Ext'd (LBA)
/dev/sda5 143566912 365514751 110973920 7 HPFS/NTFS/exFAT
/dev/sda6 365527008 426172319 30322656 7 HPFS/NTFS/exFAT

Partition table entries are not in disk order

Here you see that * in the front of /dev/sda1 bootable drive

Note : Here you need to note the bootable drive for Windows 7. In this tutorial bootable drive of windows 7 is /dev/sda1 .

Step-2 (Add a Windows 7 boot entry to RHEL based EL)
[root@techbrown ~]# vim /etc/grub.d/40_custom

Add a following lines to the files and replace the /dev/sda1 with your mount point.

#!/bin/sh
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.

menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
chainloader +1
}

menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-8EC01928C0191853' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 8EC01928C0191853
else
search --no-floppy --fs-uuid --set=root 8EC01928C0191853
fi
parttool ${root} hidden-
chainloader +1
}

to save and exit :wq!

Step-3 (Update the GRUB2 boot loader)
[root@techbrown ~]# grub2-mkconfig --output=/boot/grub2/grub.cfg
Sample Output
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-b292a5b69a2343149ed86f7e6fe782c8
Found initrd image: /boot/initramfs-0-rescue-b292a5b69a2343149ed86f7e6fe782c8.img
Found Windows 7 (loader) on /dev/sda1
done
Step-4 (Restart the system to check status)
[root@techbrown ~]# init 6

Final Words

That’s all now your system is all set to the dual booting with windows 7 and RHEL 7 based EL with all the system with using dual operating system with ease. If you find any issues with installations screen you need to add a comment below.

Hot Right Now

Related Post

COMMENTS