I recently hit the same issues described in this thread: I installed Centos 7 after Windows 7. The grub installer did not automatically detect Windows. When I later ran grub2-mkconfig, the os-prober did not detect Windows.
I manually edited /etc/grub.d/40_custom trying a few different sets of contents that I found with google searches, several of which might have worked if I hadn't been confused and trying to boot Windows from sda3 (which is my Windows C partition). This copy of Windows had been booting sda3 through the recovery partition sda2. sda3 by itself was not bootable. Once I realized that, I used the following /etc/grub.d/40_custom, which (when I next used grub2-mkconfig) inserted itself into /boot/grub2/grub.cfg
and worked (which directory, file and command names have the "2" after "grub" and which don't seems to be a strange mix that I have not seen in other distributions using grub2. Be careful to get each of those right when working with grub2 in Centos 7).
Code:
### BEGIN /etc/grub.d/40_custom ###
# 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" {
insmod part_msdos
set root='hd0,msdos2'
chainloader +1
}
Note the above probably depends on having an old style partition table (on my 1TB disk). I haven't tried any of this on a bigger disk with a new style partition.
After verifying that worked, I enabled the EPEL repository and installed ntfs-3g (which is something I expect anyone dual booting Windows 7 and Centos 7 should do). Then I reran grub2-mkconfig and now os-prober detects the bootable Windows on sda2 and sets up a slightly more complicated menuentry for it. I haven't tested it yet, but it looks like it ought to work.
I'm not certain, but I think installing ntfs-3g was the reason os-prober now works. That is strange because sda2 (where the Windows 7 boot code is) is not ntfs. sda3 (the C partition) is ntfs but os-prober found the Windows boot on sda2. Maybe it needed to read sda3 in order to act on what it saw in sda2.
So, probably there was never any need to search grub2 info online and manually edit /etc/grub.d/40_custom. I just needed to install ntfs-3g and then rerun
Code:
grub2-mkconfig -o /boot/grub2/grub.cfg
I think that is the correct answer for Hopsahejs. In the following command there is a 2 after "grub" in only two of the three places "grub" occurs:
Code:
grub2-mkconfig -o /boot/grub2/grub.cfg