I have researched for this question, but have not been able to find a clear answer... or even a clear question. So I will use a simple example.

My computer have **two hard disks: **

  • Hard Disk 1: Ubuntu Linux with GRUB2 on MBR.
  • Hard Disk 2: Any other operating system (does it bother which one?) with some other MBR loader.

GRUB2 only boots to Ubuntu (on 1st hard disk, in my example).
Issuing update-grub does not detect the operating system on the 2nd hard disk, but I know there is one.
If I enter the BIOS on boot time and change boot order to Hard Disk 2, the second operating system boots OK.

How can I add an entry to GRUB2 that boots to the second hard disk?

(The fact is: I think this question can be asked without specifying which one is the operating system in the 2nd hard disk. Or not?)

Adding upon request output of os-prober for a sample machine with this configuration:

luis@threepwood:~$ sudo os-prober
/dev/sdb1:Windows 7 (loader):Windows:chain
/dev/sdb7:Ubuntu 14.04.3 LTS (14.04):Ubuntu:linux

In this particular example (I changed boot order at BIOS) case:

  • sdb is HDD-1.
  • sda is HDD-2.
  • Ubuntu has been known to have issues detecting RedHat-based installations/bootloader entries unless the latter are mounted at the time when update-grub is run. See the answer below from "Radek Radek" (phk) for more details. Though, it should be detected without the additional steps listed there after it's mounted.
    – ILMostro_7
    Commented Mar 17, 2017 at 22:20

7 Answers 7


I normally write grub.cfg manually and never use update-grub and have a so called master Grub2 bootloader where i choose from where to boot from, then i let each linux distro to install its own bootloader on its own root partition, so linux can edit its own bootloader without touching my master grub2 bootloader.

And for jumping to other disk MBR i have this kind of entries on grub.cfg for normal OS that do not need to see the disk as if it where the first disk:

menuentry "Boot from second disk" {
   chainloader (hd1)+1
menuentry "Boot from third disk" {
   chainloader (hd2)+1
menuentry "Boot from fourth disk" {
   chainloader (hd3)+1

So it just load the MBR on the other disk i want.

But for some tricky Linux (and also some Windows) that want to see the other disk as if it where the first one i also add some orders to grub menu entries, so it looks like this:

menuentry "Boot from second disk and see it as first disk" {
   set root=(hd1)
   drivemap -s hd0 hd1
   chainloader +1
menuentry "Boot from third disk and see it as first disk" {
   set root=(hd2)
   drivemap -s hd0 hd2
   chainloader +1
menuentry "Boot from fourth disk and see it as first disk" {
   set root=(hd3)
   drivemap -s hd0 hd3
   chainloader +1

All explained in detail:

  • (hd#) represents the disk, where # starts from zero

  • drivemap do the swap of drives, so any disk can be seen as first disk, or whatever number you want (it swaps the order on what are seen two disks)

  • chainloader (hd#)+1 jumps to MBR of the disk

  • chainloader +1 jumps to first sector of what is stored on (root)

  • set root=... sets what (root) have.

  • (root) is like a variable, can be used to type less

For full documentation on grub.cfg file you can see official web page:


  • The menuentrys above can be added (appended) to /etc/grub.d/40_custom and then update-grub will put them into /boot/grub/grub.cfg
    – MERM
    Commented Dec 2, 2023 at 22:54

That is quite easy. Just follow the steps.

Example scenario:

  • /dev/sda1 – CentOS

  • /dev/sdb1 – Debian

Let's say that on CentOS drive has active MBR. So, we have access to CentOS system after booting; Debian has to be added.

Tasks under active OS (CentOS in our scenario):

  1. mount /dev/sdb1 /mnt/debian

  2. Cut the whole menuentry section of Debian from /mnt/debian/boot/grub{2}/grub.cfg, as below:

    menuentry 'Debian GNU/Linux' --class debian --class gnu-linux ... { ... }

  3. Now, create the file: touch /etc/grub.d/11_linux

  4. As this is script, remember to do: chmod +x /etc/grub.d/11_linux

  5. Add:

    echo "

    on the beginning of 11_linux and paste that section into it. Finished with " on the end. So, we should have:

    centos #~> cat /etc/grub.d/11_linux
    echo "menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-78026456-ebcc-4eed-b59d-a3f0bdff7353' {
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_msdos
        insmod ext2
        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  f2de4123-5a98-4568-99dd-e61940b99ab2
          search --no-floppy --fs-uuid --set=root f2de4123-5a98-4568-99dd-e61940b99ab2
        echo    'Loading Linux 3.16.0-4-amd64 ...'
        linux   /vmlinuz-3.16.0-4-amd64 root=/dev/mapper/Thinkpad--vg-root ro  quiet
        echo    'Loading initial ramdisk ...'
        initrd  /initrd.img-3.16.0-4-amd64
  6. grub2-mkconfig -o /boot/grub{2}/grub.cfg

  7. Reboot.


  • Seems actually just doing your step 6 seemed to solve the problem...os-prober finds the install and adds it to the list during the process, so doing all the steps will actually create duplicates. Although, that could be a difference between grub-mkconfig and grub2-mkconfig
    – redbmk
    Commented May 31, 2017 at 3:46

Hi I just had the same problem. I found that after I installed os-prober, grub-customizer was able to use os-prober to find the OS on the second HDD and add it to my boot menu. You might find this easier than editing the config files :)


While I booted into GRUB from USB-Stick, I pressed c key for command-line mode, entered

rootnoverify (hd0)
chainloader +1

et voilà, I got me GRUB too, but GRUB 2, trying again

set root=(hd0)
chainloader +1

I get the same problem again, solved ;)

  • 6
    This answer is not very easy to understand. Could you edit it to clarify, please? Commented Nov 1, 2018 at 12:55
  • Thanks for this, worked like a charm, though I had to fiddle around with it because I wasn't getting a good response from chainloader +1 - I had to use ls to see the partition contents first, namely ls (hd4,gpt3)/, then ls (hd4,gpt3)/efi/ and after I found it in (hd4,gpt3)/efi/boot/bootx64.efi I could do chainloader /efi/boot/bootx64.efi followed by boot.
    – Don Joe
    Commented Mar 13, 2023 at 0:50

I think you should add an entry for the second hdd , in grub configuration.

It doesn’t matter which OS that is.

I am using dual book with grub2 on windows HDD. It detects both windows and linux and offers me a menu to select an os to boot into.

For advance configuration , chainloading , and adding maunal entries to grub , follow this link:


  • I assume you are proposing something like # grub-install /dev/sdb. But that would replicate the same GRUB menu on HDD-2. Not a problem but... wouldn't that disable the already existing MBR on HDD-2 (lets suppose FreeBSD installed there: it records its own data on MBR)? Commented Jan 3, 2016 at 4:18
  • 1
    what is the output of os-prober command?
    – Ijaz Ahmad
    Commented Jan 3, 2016 at 4:39
  • The question is an hipothetycal case, but I have a machine with similar configuration, so I have edited the original question with that info. Commented Jan 3, 2016 at 4:56
  • for adding the entry , read the syntax in the link provied
    – Ijaz Ahmad
    Commented Jan 3, 2016 at 6:07

In some cases, the drivemap command will not work as expected. For example, in my case I have Windows 7 and a couple Linuxes on sda, and another Windows on sdb. No matter how I tried setting things up with Grub, one of the Windows options would always boot the wrong Windows, or fail to to boot entirely.

What worked for me in the end was to let Windows boot the other Windows. I used EasyBCD in the sda Windows to set up dual-boot between the two Windowses. Then I set Grub as my main bootloader, and had it either boot one of the Linuxes, or chainload to the sda Windows (the Grub is on the same disk).

Now, when I select "Windows" in the grub menu, the Windows bootloader takes over, and gives me a 2nd menu, where I can select which Windows to load. Works flawlessly.


When using ubuntu 20.04 TLS:

  1. Go to the directory /boot/grub

     $> cd /boot/grub
  2. Make a safety copy of the grub configuration file (as root)

     $> sudo cp grub.cfg grub.cfg.bak
  3. Run the grub-makeconfig program (as root), that will search for other operating systems and generate a new configuration file for grub:

     $> sudo grub-makeconfig -o grub.cfg
  4. Now you can reboot the computer and the new operating system will be shown in the boot menu.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .