How do I modify GRUB to recognize my Windows installation which is on another disk in a dual boot system?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (all versions)
  • Microsoft Windows (all versions)
  • The Red Hat Enterprise Linux installation is on /dev/hda drive or primary master device
  • The Windows installation is on the /dev/hdb drive or primary slave device

Issue

  • Not able to install Red Hat Enterprise Linux  and Microsoft Windows on two hard drives for dual booting.

Resolution

The following information has been provided by Red Hat, but is outside the scope of the posted This content is not included.Service Level Agreements and support procedures. The information is provided as-is and any configuration settings or installed applications made from the information in this article could make the Operating System unsupported by Red Hat Global Support Services. The intent of this article is to provide information to accomplish the system's needs. Use of the information in this article at the user's own risk.

Once you have successfully installed both operating systems (O/S) you need to modify the GRUB boot loader so you can boot into your Windows installation which is on the primary slave device. Ensure that when you boot the machine with both drives installed, only Red Hat is configured to boot. This means your BIOS is configured to boot from the primary master drive.

Boot into your Red Hat installation and login. As the root user, open a text editor of choice and modify the /etc/grub.conf file. You should see something similar to the following:

    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE:  You have a /boot partition.  This means that
    #          all kernel and initrd paths are relative to /boot/, eg.
    #          root (hd0,0)
    #          kernel /vmlinuz-version ro root=/dev/hda7
    #          initrd /initrd-version.img
    #boot=/dev/hda
    default=1
    timeout=7
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title Red Hat Enterprise Linux AS (2.4.21-20.EL)
            root (hd0,0)
            kernel /vmlinuz-2.4.21-20.EL ro root=LABEL=/
            initrd /initrd-2.4.21-20.EL.img

Modify this file to contain the following additions:

     # grub.conf generated by anaconda
     #
     # Note that you do not have to rerun grub after making changes to this file
     # NOTICE:  You have a /boot partition.  This means that
     #          all kernel and initrd paths are relative to /boot/, eg.
     #          root (hd0,0)
     #          kernel /vmlinuz-version ro root=/dev/hda7
     #          initrd /initrd-version.img
     #boot=/dev/hda
     default=1
     timeout=7
     splashimage=(hd0,0)/grub/splash.xpm.gz
     hiddenmenu
     title Red Hat Enterprise Linux AS (2.4.21-20.EL)
             root (hd0,0)
             kernel /vmlinuz-2.4.21-20.EL ro root=LABEL=/
             initrd /initrd-2.4.21-20.EL.img
     title Windows XP
             root (hd1,0)
             map (hd1) (hd0)
             map (hd0) (hd1)
             makeactive
             chainloader +1

The first line title Windows XP is the title that will appear in GRUB when you boot your system. Next time you reboot you will have two options to choose from, Red Hat Enterprise Linux AS (2.4.21-20.EL) and Windows XP.

The line root (hd1,0) tells GRUB where the root filesystem for that particular operating system is. In this case Windows is on drive /dev/hdb which is the second hard drive.

SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.