Monday, November 23, 2009

Dual Boot Windows and Linux

I have a Gateway Pentium 4 based PC with 2 80 GB IDE Disk Drives:

  • In the First Drive I have Microsoft Windows XP installed.
  • In the Second Drive I have installed Red Hat Enterprise Linux 5.4.

Instead of going all the time to update the BIOS when I want to boot a different OS than the one I am currently using, I decided to set my Second Drive as the Master IDE Disk Drive and I use Grub to choose the OS I want to work with when I power on my PC.

This is the entry I needed to add to /boot/grub/grub.conf:


title Microsoft Windows XP
map (hd0) (hd1)
map (hd1) (hd0)
root (hd1,0)
chainloader +1


I had to do this because Windows XP does not boot from the Second IDE Disk Drive.

Grub sees hd0 as the First Disk Drive connected to the system.

With the map option the order is changed in order to boot Windows XP from Grub.

This is how the complete file looks like:


[root@cotopaxi grub]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[root@cotopaxi grub]# cat /proc/version
Linux version 2.6.18-164.2.1.el5 (mockbuild@x86-004.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Mon Sep 21 04:37:51 EDT 2009
[root@cotopaxi grub]# pwd
/boot/grub
[root@cotopaxi grub]# ls
device.map ffs_stage1_5 iso9660_stage1_5 minix_stage1_5 stage1 vstafs_stage1_5
e2fs_stage1_5 grub.conf jfs_stage1_5 reiserfs_stage1_5 stage2 xfs_stage1_5
fat_stage1_5 grub.conf.original menu.lst splash.xpm.gz ufs2_stage1_5
[root@cotopaxi grub]# cat grub.conf
# 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/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/hdb
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-164.2.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.2.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-164.2.1.el5.img
title Red Hat Enterprise Linux Server (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-164.el5.img
title Red Hat Enterprise Linux Server (2.6.18-128.7.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.7.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-128.7.1.el5.img
title Other
rootnoverify (hd1,0)
chainloader +1
title Microsoft Windows XP
map (hd0) (hd1)
map (hd1) (hd0)
root (hd1,0)
chainloader +1
[root@cotopaxi grub]#

No comments: