GRUB 2 uses the package sys-boot/os-prober to find out which other OSs are installed. In my case it generates automatically the following section within the /boot/grub/grub.cfg file when I run the
grub-mkconfig -o /boot/grub/grub.cfg command:
- Code: Select all
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set a6863e9f863e7043
chainloader +1
}
menuentry "Windows 7 (loader) (on /dev/sda2)" {
insmod ntfs
set root='(hd0,2)'
search --no-floppy --fs-uuid --set a2243da8243d7ff9
chainloader +1
}
### END /etc/grub.d/30_os-prober ###
So it detects automatically my two Windows partitions. If you run the aforementioned grub-mkconfig command it should automatically detect your Windows partition on /dev/sdb1 if you have sys-boot/os-prober installed (if you don't have it installed, it does nothing).
You can also disable automatic probing by adding the line GRUB_DISABLE_OS_PROBER=true to the file /etc/default/grub before running the aforementioned grub-mkconfig command.
You can override the automatic os-prober by instead editing the /etc/grub.d/40_custom file before running the aforementioned grub-mkconfig command. See the example for a Windows partition on the second drive, given in Section 3.2.1 of the
Gentoo Wiki article on GRUB 2.
Look in /boot/grub/grub.cfg after running the aforementioned grub-mkconfig command to check if everything worked. If not edit the input files mentioned above and re-run the command.
(Strictly speaking, you are not supposed to edit the /boot/grub/grub.cfg file. However, in practice many people do. Your choice, but be aware that whatever edits you do to that file directly could be overwritten if either you or something else -- such as an Entropy kernel upgrade -- runs the grub-mkconfig command.)