LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Using GRUB to load XP on *third* drive (SATA) (https://www.linuxquestions.org/questions/linux-general-1/using-grub-to-load-xp-on-%2Athird%2A-drive-sata-286428/)

gvaught 02-04-2005 10:59 PM

Using GRUB to load XP on *third* drive (SATA)
 
Greetings all. I hope this goes quick as it's late here and I have a client early in the morning.

My situation is thus: I have a working box, running Sarge (Debian) quite nicely for several months now. Well, this box has a P4 2.8GHz process with 512MB RAM and approx. 200GB of hard drive. All this computer and Linux doesn't come close to maxing it out (I'm really not a power user, yet). So, with all of this computer I decided it really could run Windows, too. So, I unplugged my IDE hard drives and added a third SATA drive and installed Windows on it. Everything is great to this point. Then I plug the IDE drives back in and boot back into Debian, just as I'd wanted. My problem comes in as what does Linux see the SATA drives as? How is it listed in the /dev directory? /dev/hdc? No, that's what the DVDROM shows up as (as well as CDROM and a host of other names). Is the SATA drive listed as /dev/sda? I really don't know.

Now for the real issue - GRUB. In order to boot into this Windows set up, I need to know what to do in GRUB. In the past, my dual-boot boxes have included sections like the following:
Code:

title Win ExPee
rootnoverify (1,0)
map (0,0) (1,0)
map (1,0) (0,0)
savedefault (not so sure about this line)
makeactive
chainloader +1

I know I need to do SOMETHING like that, but I'm not sure what. BTW, the SATA drive is connected directly into the mobo on SATA0 connector.

If there's anything else I can provide that would be of assistance, please let me know.

gd2shoe 02-05-2005 09:10 PM

You're close. I don't think you need either the savedefault or makeactive lines.

The trick is to map the correct drive. I'm not sure what your sata drive shows up as, so I can't give a clear-cut answer. Here's my understanding. The grub numbers start at the first bootable device in bios. I believe the numbers climb from there.

If I had to take a guess, I'd try mapping (hd0) with (hd4).

Start Debian and go to the console. "cat /proc/partitions" will give you a list of all drives and their partitions on the machine. Try to use the following conversion:

hda -> (hd0)
hdb -> (hd1)
hdc -> (hd2)
hdd -> (hd3)
hde -> (hd4)
hdf -> (hd5)

And so forth. If it shows up as a scsi device (sd0) then I don't know what to try, except one number at a time until it goes.

gd2shoe 02-05-2005 09:32 PM

For clarity:
(altering your above example)

Code:

title Win ExPee
rootnoverify (hd4,0)
map (hd0) (hd4)
map (hd4) (hd0)
chainloader +1

I could be missing something, but I don't think so. Just substitute the correct drive number in place of the '4'.

gvaught 02-06-2005 01:39 PM

Oh, I wish I had caught you last night. I hope you're still around (or back).

My specific situation is this:
IDE0 -> hda -> 80GB (this has all of my "essential" Linux/Debian filesystems)
IDE1 -> hdb -> 120GB (this has my "opt" filesystem)
SATA0 -> sd0 -> 80GB (this is my Windows XP installation)

I installed Windows XP on the SATA drive, with the other drives removed from the system. I then connected the IDE drives and did my Debian install. GRUB was loaded automagically and found the XP install (which it labeled as hd2,0).

First I had to modify /boot/grub/menu.lst to read "rootnoverify (hd2,0)" since it was having problems with NTFS. Once I got past that hurdle, it runs the script and just sits there.

I'll try removing (commenting out) the savedefault and makeactive lines to see if that helps. In the mean time, I'd like some further assistance/feedback on how to go about getting this fixed.

Thx.

gvaught 02-06-2005 01:58 PM

One thing I just noticed (btw, it didn't work) was that the error I get after the "map" line (it only shows one before the error) I get the following error:

Unrecognized device string. (or command or something like that)

Also, I checked /boot/grub/device.map and sda is hd2, so that much I'm pretty confident on.

Anyway, if you or anyone you know, or even someone you don't know, has a suggestion, I'm willing to listen and probably try it.

(As long as it doesn't start with "rm")

gvaught 02-06-2005 04:18 PM

Definitely "Unrecognized device string." after the following:
Code:

rootnoverify (hd1,0)
map  (0,0)(1,0)

And it looks like it never reaches the next line:
Code:

map  (1,0)(0,0)
Any suggestions?

Oh, FYI, I found in BIOS where I could make the SATA drive be the second drive, thus the change in the number used in GRUB. Didn't work as hd2, anyway, so why not change it.

syg00 02-06-2005 06:42 PM

Generally grub finds IDE drives first, then SCSI (SATA included)
So, in your case (prior to moving the SATA in the BIOS);
hda <=> hd0 for grub
hdb <=> hd1
sda <=> hd2

Your map commands are wrong - use the format posted by gd2shoe

gvaught 02-06-2005 07:38 PM

Did that. Edited my menu.lst file to include the following block (correcting previous erroneous entries):

Code:

title  Microsoft Windows XP Professional
rootnoverify (hd2,0)
map  (hd2)(hd0)
map  (hd0)(hd2)
# savedefault
makeactive
chainloader +1
boot

Still get the "Unrecognized device string" error after the first "map" line. Edited the device.map file to reflect changes and STILL getting the error.

Went back into BIOS and put the drives back the way they were before I started mucking with things - same results.

So, now the drives are listed, in BIOS and device.map, as they were to begin with. The menu.lst has the drive designations as they were when detected by the GRUB installation. It doesn't work without the "map" line and it doesn't work with the "map" lines. Help?

gd2shoe 02-06-2005 08:18 PM

I'm back.

I think you need a space between (hd2) and (hd0). The "info" file for grub has a space in their example.

gd2shoe 02-06-2005 08:22 PM

Oh, and I still don't think you need the "makeactive" line either.

I know you don't need the "boot" line. This one doesn't matter whether you remember it or forget it. If it isn't at the end of the section GRUB will issue it anyway.

syg00 02-06-2005 08:47 PM

Less changes is good.
One at a time is best.
If the map file reflects your hardware, don't change it - or at least change it back.
Reverse the order of the map commands. Don't know if it's relevant, but makes sense (to me) to remap hd0 first.

If all else fails, edit the menu when it comes up. Then you can entered each command line by hand - and "tab completion" works.
So try map ({tab} to see what grub thinks the lie of the land is.
Note that in this case you *WILL* need to enter the boot command.

gvaught 02-07-2005 07:26 AM

gd2shoe, you, my friend, are now my super-hero for the day.

I had already gone back to zero (including with the map file), so that was good. But thanks for the sage advice, syg00. It's always nice to have the voice of reason (cover the basics, first) when I've been struggling for two days.

But changing
Code:

map (hd2)(hd0)
into
Code:

map (hd2) (hd0)
(note the added space between the sets of parens) was something I don't think I could ever have thought of on my own.

Ahhhh, this is what I love about open source - geeks helping geeks.

In any event, now I can boot into Debian, as always, AND boot into Windows without having to go into BIOS and set the SATA drive as the boot drive.

Sweet.

Well, I could sit here and gush wonderful pleasantries about Linux, Open Source and gd2shoes for hours, but I have a client who needs assistance "first thing Monday morning", which is probably about two hours before I'll get there but they'll have to deal with it.

May God smile largely upon you today, gd2shoe and syg00.


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