LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 10-03-2005, 12:39 AM   #1
prabhatsoni
Member
 
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 229

Rep: Reputation: 30
Grub - not booting my xp on hdd


Hi everybody,

I have 2 drives:
hda has FC -1,
hdd has XP.
GRUB is installed on the MBR.
Now when I boot I get the correct spash image having the boot option of linux as well xp. If I choose linux, it boots regularly. But when I choose xp, it does not boot.
I went through documentation, I found that is some problem and something may have to be done. For the present I have to go to boot-time-setup, and choose "boot from secondary-slave" to use my windows.
Earlier when my XP was on hda and FC1 was on hdd, there was no problem.
I have a feeling that if I install grub on hdd (XP drive), probabely it would sort out. But then I will have to something to make the mbr point to the hdd.
Any ideas how it could be sorted out. I would not want to change the hard disk data cables and re-install the FC1.

Thanks in advance.


Prabhat Soni

Last edited by prabhatsoni; 10-03-2005 at 12:41 AM.
 
Old 10-03-2005, 01:00 AM   #2
Theta13579
Member
 
Registered: Aug 2005
Location: Milky Way Galaxy
Distribution: Slackware
Posts: 34

Rep: Reputation: 15
Exclamation

The problem is that if you want to boot both it is best to place linux side by side with windows, on the same master drive!!!!

I have a master drive split 50/50 of Lin and Wind with the secondary master as free space to share between Lin and Wind.

no problems!

The boot sector of the hda is not responsible for the bootsector of hdb, hdc, hdd ....

If you can boot the second drive (first) with grub and get to both linux and windows, do that; also,
I assume since you don't wan't to reinstall linux, this also means you are unwilling to reinstall Windows on the same drive as linux.

Use the BIOS to get to each OS, otherwise you have just painted yourself into a corner.

(BACK UP ALL YOUR DATA THAT YOU WANT TO KEEP)


Paint Dries.

Last edited by Theta13579; 10-03-2005 at 01:09 PM.
 
Old 10-03-2005, 01:56 AM   #3
asuka
LQ Newbie
 
Registered: Oct 2004
Location: Korea
Distribution: Debian,Gentoo,FC2
Posts: 10

Rep: Reputation: 0
INSIDE device.map, check

(hd0) /dev/hda
(hd1) /dev/hdb
(hd2) /dev/hdc
etc...

INSIDE grub.conf, change the winxp section to look like this
WinXP is on hd1 here. You'd want to change hd1 to what hdd is mapped to.

title WindowsXP
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
chainloader +1

Last edited by asuka; 10-03-2005 at 01:59 AM.
 
Old 10-03-2005, 02:05 AM   #4
alfNtexas
Member
 
Registered: Sep 2005
Location: Houston, Tx
Distribution: debian, SuSe, Fedora
Posts: 32

Rep: Reputation: 15
I'm not so sure he is painted into a corner.. There was a similar thread in debian-user ml and one guy fixed the problem by doing something like disconnecting /dev/hda (his linux disk) and reinstalling his XP, then rebooting again with BOTH drives alive, did some other strange stuff and the final result was, Grub loaded his Debian from hda and XP from hdb... go figure...

I needed to do the same thing for a friend of mine who is in a wheelchair but damn... that was a lot of work ... I still look now and then for an easier solution, when I find it, I'm gona write a HOWTO so the rest of the world won't have to go through this..
 
Old 10-04-2005, 02:01 AM   #5
prabhatsoni
Member
 
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 229

Original Poster
Rep: Reputation: 30
Thanks Asuka,
The solution provided by you has worked.
But tell me if I shift my XP-drive to hda, and linux-drive to hdd, what will I have to do (other than changing the cables, that is):
1. Booting with a boot disk, I will have to give
grub>grub-install hda
2. Then I will have to accordingly modify the grub.conf. ?

Will it work ?
Then will I not have to change configuration files like /etc/fstab, becasue it contains entries pointing to hda !




Prabhat Soni

Last edited by prabhatsoni; 10-04-2005 at 02:11 AM.
 
Old 10-08-2005, 07:54 PM   #6
aus9
Senior Member
 
Registered: Oct 2003
Location: Australia
Posts: 4,258

Rep: Reputation: Disabled
it depends on bios boot order pretending you keep it booting to hda then its hda that needs the bootloader.

print out your existing /boot/grub/menu.lst as a guide for the changes to come

then install xp to hda and let xp bootloader go into mbr for hda
then install linux to hdd and let grub overwrite the mbr for hda.....yep hda

modern linux distros have no problem with booting xp or linux from diff drives but if you need help read my signature and the final outcome should be this

grub in mbr for first drive

menu.lst

title ms
root (hd0,0)
makeactive
chainloader +1

title linux
root (hd1,X) depends where you put
kernel etc
initrd etc
 
Old 10-08-2005, 08:15 PM   #7
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,402

Rep: Reputation: 212Reputation: 212Reputation: 212
If you propose to change the installation of your hard drives (moving hdb to hda, and moving hda to hdb), do it the easy way.

First, edit grub.conf (or menu.lst if you use that) to change the grub configuration BEFORE you change the physical location of the drives.
Especially, since xp will be on hda after the hard drive switch, edit the grub.conf to remove the map (hd0) (hd1) etc. references and leave the chainloader line in place (after the drive switch, you won't need the map lines).

Second, edit /etc/fstab to change the locations of the partitions (from /dev/hda to /dev/hdb and vice versa).

Third, run the grub-install utility (or the older manual way of installing grub) to install it to the mbr of hdb BEFORE the drives are swithed. That way, grub will be in the mbr of the disk when it becomes hda, and you won't need a boot disk to boot into Linux to try to fix it (it's fixed before you start swapping disks).

Fourth, power down, disconnect the box, open it and switch the drives. Put it all back together, power up, and grub should still work IF the changes to grub.conf and /etc/fstab and grub was installed to the mbr of the disk which will be hda after the switch, were done before the drive switch.

That's the technique I used a few weeks ago to move my primary drive to slave and add a new (larger) primary. I had no problems booting back into SuSE.
 
Old 10-10-2005, 04:05 AM   #8
aus9
Senior Member
 
Registered: Oct 2003
Location: Australia
Posts: 4,258

Rep: Reputation: Disabled
thats neat......well done
 
Old 10-10-2005, 06:42 PM   #9
TexasDevilDog
Member
 
Registered: Nov 2003
Posts: 54

Rep: Reputation: 15
I would like to add my setup for future searches.

I have a sata drive that has FC4:
/dev/sda1 = /boot
/dev/sda2 = /
/dev/sda3 = swap

Then I have a ide drive that has WindowsXP NTFS, only one partition

In BIOS, my first boot is my sata drive. This is how grub looks. Note: WinXP is default for my girl friend.

Code:
[root@localhost Richard]# cat /boot/grub/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/sda2
#          initrd /initrd-version.img
#boot=/dev/sda
default=1
timeout=3
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.11-1.1369_FC4)
        root (hd0,0)
        kernel /vmlinuz-2.6.11-1.1369_FC4 ro root=LABEL=/ rhgb quiet
        initrd /initrd-2.6.11-1.1369_FC4.img
title WindowsXP
        map (hd1) (hd0)
        chainloader (hd1)+1

Last edited by TexasDevilDog; 10-10-2005 at 08:11 PM.
 
Old 10-10-2005, 07:54 PM   #10
aus9
Senior Member
 
Registered: Oct 2003
Location: Australia
Posts: 4,258

Rep: Reputation: Disabled
I am not sure if that boots but if it does not, and grub is in mbr for sata then try changing your ms menu to swap (map) with the extra line
map (hd1) (hd0)
map (hd0) (hd1)
chainloader +1

there is no need for the boot command that is for command mode use if you are stuck at a grub prompt with no menu
 
Old 10-10-2005, 08:11 PM   #11
TexasDevilDog
Member
 
Registered: Nov 2003
Posts: 54

Rep: Reputation: 15
Quote:
Originally posted by aus9
I am not sure if that boots but if it does not, and grub is in mbr for sata then try changing your ms menu to swap (map) with the extra line
map (hd1) (hd0)
map (hd0) (hd1)
chainloader +1

there is no need for the boot command that is for command mode use if you are stuck at a grub prompt with no menu
Yeah, it works fine. I have been using it for a while. I guess it just never gets to the boot command. Silly me.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Booting of raw ISO from GRUB/LILO (though preferably GRUB) Orkie Linux - Software 22 08-08-2011 08:43 AM
Trouble booting on new hdd mjkmkk Linux - General 1 08-27-2004 06:23 AM
1st HDD = RH9.0 (grub) ... How do I modify grub when adding 2nd hard disk ? Onyx^ Linux - Software 1 09-05-2003 09:16 AM
Booting from a USB HDD - HOW DO I m.westwood-hill Linux - General 2 05-01-2003 01:05 AM
Booting from a USB HDD - HOW DO I m.westwood-hill Linux - Software 0 04-30-2003 04:20 AM


All times are GMT -5. The time now is 11:14 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration