LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Dual booting with grub (https://www.linuxquestions.org/questions/linux-software-2/dual-booting-with-grub-748279/)

siawash 08-17-2009 07:18 PM

Dual booting with grub
 
Hello, I recently had to replace my hard drive controller and reinstalled Centos on one hard drive with windows 2000 on a separate drive. All drives are of type IDE. Windows is on the slave and Centos on master drive.

here is what fdisk -l shows;

Quote:


Disk /dev/hda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 12430 99843943+ 83 Linux
/dev/hda2 12431 13067 5116702+ 82 Linux swap / Solaris
/dev/hda3 13068 15617 20482875 83 Linux

Disk /dev/hdb: 122.9 GB, 122942324736 bytes
255 heads, 63 sectors/track, 14946 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 8924 71681998+ 7 HPFS/NTFS
/dev/hdb2 8925 14945 48363682+ f W95 Ext'd (LBA)
/dev/hdb5 8925 14945 48363651 7 HPFS/NTFS
[root@siawash siawash]#


Here is my menu.lst file

Quote:


[root@siawash siawash]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/hda1
# initrd /boot/initrd-version.img
#boot=/dev/hda

default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu


title CentOS (2.6.18-128.4.1.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-128.4.1.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-128.4.1.el5.img

title CentOS (2.6.18-92.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-92.el5.img


[root@siawash siawash]#

Would anyone be kind enough to show me a template to add windows into my menu.list

Would it be something like;

title Windows
root (hd1,1)
kernel (i don't know what to put here ) quiet
initrd (or what image to point it to )



Many thanks in advance

pljvaldez 08-17-2009 07:41 PM

Sure, look at the Grub Booting Tips in my signature. Basically you don't need the kernel or initrd lines, instead replacing it with chainloader +1. But you'll probably also have to use the map function because Windows needs to think it's on the 1st primary hard disk.

siawash 08-18-2009 04:55 PM

Hi, I solved the problem the hard way. I thought you would be interested in how I did it.

I added this to /grub/menu.lst

Quote:


root (hd1,1)
chainloader +1
boot

This did not seem to make any difference. The boot menu only offered Centos. Later I realized you have to hit enter on the menu to get another sub menu. But at the time I decided go by your post to change over the slave drive to one storing Centos and set up windows as the master drive.

This time I did not get Centos instead booting straight into windows. I disconnected the drive storing windows and booted back into centos. I modified menu.lst and changed over the drives root thus;

Quote:


# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd1,0)
# kernel /boot/vmlinuz-version ro root=/dev/hdb1
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=5
splashimage=(hd1,0)/boot/grub/splash.xpm.gz
hiddenmenu

title CentOS (2.6.18-128.4.1.el5)
root (hd1,0)
kernel /boot/vmlinuz-2.6.18-128.4.1.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-128.4.1.el5.img

title CentOS (2.6.18-92.el5)
root (hd1,0)
kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-92.el5.img

title Windows 2000
rootnoverify (hd0,0)
chainloader +1

This works but if I want to boot into windows I have to hit enter on the main centos menu and get a sub-menu. BTW i know how to map lilo but not grub. I thought grub does not need to be remapped manually.

BTW when I was installing Centos I got an option to configure grub which offered an option to add a second OS. Unlike other linux distros such as Debian, it could not see Windows on second drive. There was an option to add. But when i used this option and selected the second drive I would get a error message saying;

Quote:


This device is already being used for another boot entry


pljvaldez 08-18-2009 05:15 PM

I don't think the map is for grub's benefit, but for Windows.

Larry Webb 08-19-2009 05:41 AM

saiwash, I think you should have made your windows entry with the

rootnoverify (hd1,0)
chainloader +1

You had windows on the second hd and in the first partition.

You would not have to use the map signals seeing windows was in the first partition of the drive.

siawash 08-19-2009 07:03 AM

Hi again, I am experiencing a similar problem on a second machine. This one has vista and OpenSUSE on same hard drive. This is one of those cheap laptops that comes with vista without CD's. The OS is stored on specific partition which if i mess with voids warranty. I kept getting missing bootloader. So i reinstalled OpenSUSE.

This is results of fdisk -l



Quote:


eugene@linux-1mth:~> sudo /sbin/fdisk -l
root's password:

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x294599de

Device Boot Start End Blocks Id System
/dev/sda1 1 1402 11261533+ 12 Compaq diagnostics
/dev/sda2 1403 15918 116592640 7 HPFS/NTFS
/dev/sda3 15919 16403 3895762+ 82 Linux swap / Solaris
/dev/sda4 * 16404 30401 112438935 f W95 Ext'd (LBA)
/dev/sda5 16404 19014 20972826 83 Linux
/dev/sda6 19015 30401 91466046 83 Linux
eugene@linux-1mth:~>

This is menu list

Quote:


# Modified by YaST2. Last modification on Wed Aug 19 12:21:06 IST 2009
default 0
timeout 8
##YaST - generic_mbr
gfxmenu (hd0,4)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.1
root (hd0,4)
kernel /boot/vmlinuz-2.6.27.7-9-default root=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080401BB6F00WDJ07H1F-part5 resume=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080401BB6F00WDJ07H1F-part3 splash=silent showopts vga=0x317
initrd /boot/initrd-2.6.27.7-9-default

###Don't change this comment - YaST2 identifier: Original name: Vendor diagnostic###
title Vendor diagnostic
rootnoverify (hd0,4)
chainloader +1

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows
"/boot/grub/menu.lst" 28L, 1262C 16,23 Top



According to fdisk I think grub is point to the correct partition without any joy. Can anyone help?

Larry Webb 08-19-2009 01:29 PM

title Windows
rootnoverify (hd0,1)
chainloader +1


All times are GMT -5. The time now is 11:41 AM.