When setting up a dual-boot system with Windows 10 and CentOS 7, it's a common scenario for the GRUB2 bootloader installed by CentOS 7 not to automatically detect and list the Windows 10 operating system. This often occurs because GRUB2, by default in CentOS 7, may lack the necessary support to recognize and interact with the NTFS filesystem used by Windows installations during its initial configuration phase. To resolve this, NTFS filesystem capabilities need to be added to the CentOS environment, followed by regenerating the GRUB2 configuration.
Step 1: Install NTFS Support for CentOS
To enable GRUB2 to properly identify and boot Windows 10, the CentOS environment requires support for the NTFS filesystem. This is achieved by installing the ntfs-3g package.
Add EPEL Repository
The ntfs-3g package is typically available in the Extra Packages for Enterprise Linux (EPEL) repository. If you don't have it enabled, you can add it using the following command. For optimal download speed, an Alibaba Cloud mirror is used in this example:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
Update System Packages
It's good practice to update your package index and existing packages after adding a new repository:
yum update
Install ntfs-3g
Proceed with the installation of the ntfs-3g package:
yum install -y ntfs-3g
Step 2: Regenerate GRUB2 Configuration
After installing ntfs-3g, the GRUB2 bootloader needs to be updated to recognize the newly available NTFS filesystem support and scan for Windows installations. This is done by regenerating the GRUB configuration file. GRUB2 is designed to automatically generate its configuration, which is a significant change from manually editing menu.lst in older GRUB versions.
grub2-mkconfig -o /boot/grub2/grub.cfg
This command will scan all detected operating systems, including your Windows 10 installation, and create a new grub.cfg file.
Step 3: (Optional) Set Windows 10 as Default Boot Entry
If you prefer Windows 10 to be the default operating system that boots when your machine starts, you can configure GRUB2 to select it automatically.
Identify Windows 10 Boot Entry
First, inspect the generated GRUB2 configuration file to find the exact name of the Windows 10 boot entry. You can do this by filtering for menu entries:
grep menuentry /boot/grub2/grub.cfg
You will see output similar to this, with various boot options. Look for an entry corresponding to Windows:
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-b07b-c1bf19e72d97' {
menuentry 'CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core) (recovery mode)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-recovery-b07b-c1bf19e72d97' {
menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-B4A4-12F2' {
From the example above, the Windows 10 entry is typically named 'Windows Boot Manager (on /dev/sda1)'. Note the exact string within the single quotes.
Set Default Boot Entry
Use the grub2-set-default command with the exact name of the Windows 10 boot entry to set it as the default. Replace the example string with the one you found:
grub2-set-default "Windows Boot Manager (on /dev/sda1)"
Verify Default Setting
To confirm that your default boot entry has been successfully updated, run:
grub2-editenv list
The output should show your saved entry, for example:
saved_entry=Windows Boot Manager (on /dev/sda1)
After completing these steps, reboot your system to observe the updated GRUB2 boot menu and verify that both CentOS and Windows 10 are now correctly listed and can be booted.