LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-05-2007, 11:10 AM   #1
coolblue
Member
 
Registered: Feb 2005
Posts: 126

Rep: Reputation: 15
How do I add XP to grub? XP is on hdb5....


I installed Ubuntu to hdb2 (primary) and XP was on hdb5 (logical).

Ubuntu didn't recognise XP installation.

How do I manually add the XP entry to grub? Plz help.

I tried the following but it doesn't work.

title Windows XP
root (hd1,6)
makeactive
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,6)
chainloader +1


It says,

Error 12: Invalid device request
Press any key to continue....

When I press a key, I get back to the grub menu. What do I do??

Thanks....

Last edited by coolblue; 05-05-2007 at 12:08 PM.
 
Old 05-05-2007, 01:02 PM   #2
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
Did you try it like this;
title=Windows XP
rootnoverify (hd1,6)
makeactive
chainloader +1
 
Old 05-05-2007, 01:51 PM   #3
coolblue
Member
 
Registered: Feb 2005
Posts: 126

Original Poster
Rep: Reputation: 15
Sorry that didn't help. I also tried using (hd1,4) but I get the same error.

Anyways this is the output of fdisk -l:

fdisk -l

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2432 19535008+ c W95 FAT32 (LBA)
/dev/sda2 2433 4864 19535040 f W95 Ext'd (LBA)
/dev/sda5 2433 4864 19535008+ e W95 FAT16 (LBA)

Disk /dev/sdb: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 3647 29294496 7 HPFS/NTFS
/dev/sdb2 3648 7294 29294527+ 83 Linux
/dev/sdb3 * 7295 12157 39062047+ 83 Linux
/dev/sdb4 12158 30515 147460635 5 Extended
/dev/sdb5 12158 25530 107418591 b W95 FAT32
/dev/sdb6 25531 30393 39062016 83 Linux
/dev/sdb7 30394 30515 979933+ 82 Linux swap / Solaris

Hope this info will be useful.

Plz help. I need to go into XP for an important task.

Thanks...

Last edited by coolblue; 05-05-2007 at 01:52 PM.
 
Old 05-05-2007, 02:12 PM   #4
vtel57
Member
 
Registered: Jul 2006
Location: Tampa, FL, USA
Distribution: Slackware64
Posts: 912

Rep: Reputation: 103Reputation: 103
Egads... I hadn't had enough coffee when I posted this. The post just below this has the correct solution to your problem.

Luck!

~Eric

Last edited by vtel57; 05-05-2007 at 03:55 PM.
 
Old 05-05-2007, 03:21 PM   #5
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
/dev/sdb5 12158 25530 107418591 b W95 FAT32
grub counts 0 1 2 3 4 5
Code:
Title=Windows XP
rootnoverify (hd1,4)
makeactive
chainloader +1
for this
/dev/sdb1 1 3647 29294496 7 HPFS/NTFS
Code:
Title=Windows XP
rootnoverify (hd1,0)
makeactive
chainloader +1
You still may have to do this for the sata drive if you have a error like
Code:
Filesystem type unknown, partition type 0x7
chainloader +1
something like
Code:
map (hd0) (hd1)
map (hd1) (hd0)
chainloader (hd1,0)+1
 
Old 05-06-2007, 02:33 AM   #6
coolblue
Member
 
Registered: Feb 2005
Posts: 126

Original Poster
Rep: Reputation: 15
I said XP is ONLY on hdb5. There are some other partitions with NTFS/FAT filesystem but theres nothing in them.

I do NOT have any SATA disks. Ubuntu recognises them as SATA coz Ubuntu 7.04 only has the SATA drivers which handles both IDE and SATA drives.

Do I still have to do mapping? Is mapping only for SATA disks?

Plz clarify.
 
Old 05-06-2007, 01:12 PM   #7
Duck2006
Member
 
Registered: Sep 2006
Distribution: Ubuntu 8.04 Hardy Heron LST
Posts: 346

Rep: Reputation: 33
Quote:
Is mapping only for SATA disks?
No IDE, PATA and SATA can be mapped

You may have to map as
map (hd0,0) (hd1,4)
map (hd1,4) (hd0,0)
 
Old 05-06-2007, 02:22 PM   #8
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Hmm, XP does not normally run from a logical partition - it needs a primary one. There is a bootloader that apparently erases the distinction between primary and logical so that windows could boot from anywhere but I forget its name. I thought it was Ranish.

Anyways, just try this:

title Windows XP
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,6)
chainloader +1

This assumes that you also have a hda and that GRUB is sitting on the MBR of that hda.

If that doesn't cut it, you know that you do need something more versatile than GRUB.

Last edited by jay73; 05-06-2007 at 02:26 PM.
 
Old 05-07-2007, 03:48 AM   #9
coolblue
Member
 
Registered: Feb 2005
Posts: 126

Original Poster
Rep: Reputation: 15
OK I'm quite fed up....I will be installing a fresh copy of XP on a PRIMARY partition in hdb I hope that will solve the problem right? One more question: When is mapping done? What is it used for and in which cases??

When I re-install XP on a primary partition on hdb, do I have to do mapping? Btw someone on another forum told me dat bcoz I've XP on hdb5, I should have hd1,4 and NOT hd1,6 in my grub file...is that right?? But I tried that too and it didn't work..

Thanks...
 
Old 05-07-2007, 05:49 AM   #10
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Quote:
When I re-install XP on a primary partition on hdb, do I have to do mapping? Btw someone on another forum told me dat bcoz I've XP on hdb5, I should have hd1,4 and NOT hd1,6 in my grub file...is that right?? But I tried that too and it didn't work..
Now let's see. GRUB starts counting from 0 so:

hdb1=0
hdb2=1
hdb3=2
hdb4=3
hdb5=4
and so on

In short, yes, hdb5 should be (hd1,4). Bad mistake, what was I thinking, mixing up -1 with +1...
Anyway, if even hd1,4 didn't cut it, then obviously you are facing the limitations of XP, which requires a primary partition. Did it ever run from there or did your put it there only recently?

Anyway, a second limitation of XP is that it wants to sit on the first disk (which disk is first depends on how the hard drives are ordered in your BIOS). By using mapping, you fool XP into thinking that it is really on the first disk while it is actually somewhere else. So:
map (hd0) (hd1)
map (hd1) (hd0)
is simply a way or temporarily rearranging disk order without touching anything. Your first drive (hd0) becomes second (hd1) and the second (hd1) is promoted to first (hd0). Now XP is happy because it gets the impression that it is really on the first disk.

Of course, no mapping is required as long as XP is actually on the first disk. Assuming that your are booting off hda (the drive to which you installed GRUB), you don't need any mapping if you install XP to that hda. Then it would be enough to use a simple:
root (hd0,X)
makeactive
chainloader +1
An alternative approach would be to go into BIOS and invert disk order, making hdb the boot disk instead of hda. But this would only create other problems: if your GRUB is on hda, you wouldn't be able to access it anymore and you would have XP booting all the time instead (GRUB also needs to be on the first disk - but inverting the disk order moves it to second); and if you have another windows on hda, then that one will now be on the second disk - so here again you would have to apply mapping.

Last edited by jay73; 05-07-2007 at 05:50 AM.
 
Old 05-07-2007, 08:11 AM   #11
coolblue
Member
 
Registered: Feb 2005
Posts: 126

Original Poster
Rep: Reputation: 15
Wow....that was quite helpful! So well-written and so beautifully explained! I understood everything

One last question: I've seen that in examples of mapping, theres something like "chainloader +1(hd0,1)" or something. What does this mean and why is it added?

And what does "rootnoverify" and "makeactive" stand for and why are they needed??

Thanks for your time and help
 
Old 05-07-2007, 08:56 AM   #12
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Hmm, let's see whether I can still talk sense when explaining those.

First of all, the chainloader. GRUB is an open source invention and as such knows how to boot open source operating systems directly (Linux, FreeBSD, OpenBSD, ...): GRUB passes control straight to the operating system. But windows is not exactly an open source system so GRUB can't boot it in a direct way; as a workaround, it first loads an intermediate file, which in its turn will boot windows. So we get some sort of a chain here: first GRUB, then the file, then windows = chainloading.

Rootnoverify is similar. GRUB tries to mount the root partition in order to retrieve some information that may be vital to booting; but because windows is a radically different system, GRUB can't make any sense of its root partition; by specifying "rootnoverify", you tell GRUB to just leave it alone and not mount it.

Makeactive: make the windows partition the active one. If you do this from a terminal:
su -
root password
fdisk -l
it will show all the partitions on your hard drives; the ones with a * are active partitions = partitions from which a system can boot; most Linux partitions do not care about active partitions but something like Debian does need one in order to boot. I have also noticed that the makeactive line is not needed when windows is mapped - I guess the mapping process does something which makes it superfluous but I'm still figuring that one out, really.

Last edited by jay73; 05-07-2007 at 08:59 AM.
 
Old 05-08-2007, 09:14 AM   #13
coolblue
Member
 
Registered: Feb 2005
Posts: 126

Original Poster
Rep: Reputation: 15
That was clear enough too...thanks
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to add os to grub fannymites Linux - Software 1 07-18-2005 09:27 PM
How to add GRUB ? wlaw Linux - Newbie 1 07-20-2004 10:44 AM
SAMBA hdb5 Share Exio Linux - Software 6 05-13-2004 11:07 AM
Add something to grub Pauli Fedora 6 03-24-2004 06:07 PM
please help...... I cant find the dev/hdb5 directory ra3oob Linux - Distributions 2 01-25-2003 05:38 PM


All times are GMT -5. The time now is 08:18 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration