Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using GRUB to Dual-Boot Windows on a Second Hard Drive
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Darth_Daver
n00b
n00b


Joined: 22 Sep 2002
Posts: 44

PostPosted: Sat Oct 12, 2002 8:28 pm    Post subject: Using GRUB to Dual-Boot Windows on a Second Hard Drive Reply with quote

Linux has been my primary desktop OS since 1998. I use Windows less every year, but I still keep a Windows partition for the odd application, usually a game. I have the best results with Windows 2000 Pro (Win2k), but this information can be applied to any version of Windows through Windows XP.

The Windows bootloader is designed to make things tough on users like us. It insists on installing to and booting from the MBR of /dev/hda. LILO and GRUB can boot from any active primary partition on /dev/hda so I always installed Windows to /dev/hda1 and installed my Linux bootloader to boot from my /boot partition on /dev/hda2, which I created as an active primary partition. Since Windows frequently needs to be reinstalled, this helped avoid the inevitable overwriting of the MBR by Windows.

For some reason, however, Win2k and XP change their own system partition to be the active partition any time I boot them. This of course prevents my preferred bootloader from booting, but GRUB provides a way to safely contain such viral activity. ;-)

GRUB provides a way for you to trick Windows to boot from a slave drive (/dev/hdb in this example). First you have to configure a hard drive as /dev/hda (master drive on the primary IDE bus) in order to successfully complete the installation of Windows. Once that is done, configure the hard drive to be the slave drive on that IDE bus. Add your Linux hard drive as the master on the same bus. Complete the installation of Linux on the master drive. Now you have Linux on /dev/hda and Windows on /dev/hdb. We will assume that you installed the Linux /boot directory to /dev/hda1 and the Windows system partition on the C: drive (/dev/hdb1).

Here is the contents of my /boot/grub/menu.lst file with added explanatory comments. Everything after a # is my added comment, and the comments are not in my actual menu.lst file, although they should not hurt. GRUB counts everything starting from 0.

# BEGIN /boot/grub/menu.lst

default 0 # This sets the first menu entry to boot by default.
timeout 5 # There will be a 5 second delay before the default is booted
splashimage=(hd0,0)/boot/grub/splash.xpm.gz # The boot menu graphic

title=Gentoo # This is the name displayed for the first entry
root (hd0,0) # GRUB's way of pointing to /dev/hda1 (drive 0,partition 0)
kernel /boot/bzImage root=/dev/hda3 # kernel name and / location

title=Gentoo-test # Menu entry for testing new kernels
root (hd0,0)
kernel /boot/bzImage-test root=/dev/hda3

title=Windows 2000 Pro
map (hd0) (hd1) # Tell the first hard drive to pretend to be the second
map (hd1) (hd0) # Tell the second hard drive to pretend to be the first
root (hd1,0) # Tell GRUB Windows is on /dev/hdb1 (No pretending here)
rootnoverify (hd1,0) # GRUB won't attempt to mount the Windows drive
makeactive # Sets the partition to active
chainloader +1 # Tells GRUB to load the Windows bootloader when done

# END of /boot/grub/menu.lst

The syntax of the Windows root and rootnoverify commands was a bit confusing because I originally assumed I should map to the partition after the map commands swapped drive locations, but GRUB is not fooled by that. When I saw that it was trying to mount an ext3 file system instead of FAT32, I figured out what was wrong.

I know and like LILO. GRUB has some nice features, though, and it is the future so I recommend you take the time to learn it. I hope this "How To" is helpful.
Back to top
View user's profile Send private message
kermitjunior
Apprentice
Apprentice


Joined: 04 Aug 2002
Posts: 167

PostPosted: Tue Oct 22, 2002 9:50 pm    Post subject: Someone here to thank you! Reply with quote

It can be frustrating when no one replies to your hard work, so I wanted to say thank you.

I knew GRUB could switch the mapping of drives, but haven't wanted to figure it out yet.

So thanks for taking the time to write that out for those of us with limited time. Now I can at least contain windows to one drive.... "Bad OS! Go sit by yourself"
_________________
-----
Toshiba Satellite A15-S157, 2.2 Celery, 40GB, 512MB
AMD Athlon XP 1900+, 640MB PC2100, ABIT KG-7R
IBM 120GB (Linux), WD 30GB (WinDoze), ATI All-In-Wonder 128 Pro PCI
Back to top
View user's profile Send private message
Sequentious
Apprentice
Apprentice


Joined: 07 Jun 2002
Posts: 290
Location: London Ontario Canada

PostPosted: Tue Oct 22, 2002 11:37 pm    Post subject: Reply with quote

This is a lifesaver for a friend whos computer came only with a pesky "recovery" cd.

THANKS!
_________________
--
Chris I
chris@cidesign.ca :: www.cidesign.ca/~chris/
Back to top
View user's profile Send private message
Darth_Daver
n00b
n00b


Joined: 22 Sep 2002
Posts: 44

PostPosted: Sun Oct 27, 2002 7:08 pm    Post subject: You're Welcome Reply with quote

You are both welcome. Thank you for taking the time to show your appreciation and provide feedback. It is nice to know that my work helped others.
Back to top
View user's profile Send private message
Ian
l33t
l33t


Joined: 28 Oct 2002
Posts: 820
Location: Newport, RI

PostPosted: Tue Oct 29, 2002 10:41 pm    Post subject: Reply with quote

um, question about this...

i just installed gentoo, and i made everything work, up to grub. i had some problems before, but i did as the installation manual told me, and everything worked. but, the installation manual calls the file with all the stuff "grub.conf", not "menu.lst". when i booted up, it just went to the grub menu, and i couldn't boot (or at least i don't know the command to boot from the "grub>" prompt). does the fact that i made a "grub.conf" as opposed to "menu.lst" file matter? i'd just like to clarify that problem.

grr, i just realized i missed the tiny line in the manual that tells you to link the two files. is there a way to do this without reinstalling and recompiling everything?
Back to top
View user's profile Send private message
Darth_Daver
n00b
n00b


Joined: 22 Sep 2002
Posts: 44

PostPosted: Wed Oct 30, 2002 1:08 am    Post subject: Don't Worry Reply with quote

Ian,
It sounds like you have identified your error, and all you really need to do is mount your file system to create a link to complete that last step. There are good instructions for "Using Gentoo CD to repair a broken system" here:

http://forums.gentoo.org/viewtopic.php?t=5317

Other bootable Linux installation CDs give you the same disaster recovery capabilities, but I assume you have a Gentoo CD handy since you just completed the installation. :-)

Whatever you do, don't panic and do something rash. Your system definitely sounds salvageable. You should not need to install your system again unless you want to. Of course, installing again is a good way to learn, but having new experiences using new tools to fix problems like this is also a good way to learn.

Good luck,
Dave
Back to top
View user's profile Send private message
Ian
l33t
l33t


Joined: 28 Oct 2002
Posts: 820
Location: Newport, RI

PostPosted: Wed Oct 30, 2002 1:34 am    Post subject: Reply with quote

lol, i actually went back right after i posted this and tried doing just what you said, and amazingly, it worked. after that things went downhill though...

grub came up perfectly fine, and looked all pretty. i hit enterto boot linux, and i got a kernel panic, probably because i made another stupid mistake earlier in the install. it may be because i did a stage1 install, and i'm still not sure what the variables were supposed to be set at :P, so i think i'm gona go back and try a stage2 or 3 install to avoid that. also, when i tried to boot windows from grub, it didn't want to work either, but luckily they're on seperete physical drives, and my bios can boot off of drive 0 - 3, so i can choose at will which to boot from (makes it much easier if i get fustrated and want to ignore linux for a while :)). i think i have to try redoing a complete install (from stage2 or 3) using the above tips, and it will hopefully work this time :D.
Back to top
View user's profile Send private message
julmust
n00b
n00b


Joined: 13 Oct 2002
Posts: 57
Location: Landskrona, Sweden

PostPosted: Sat Nov 02, 2002 11:26 pm    Post subject: Reply with quote

thanks a lot for the tip! this really helped me and a few friends out. now I don't have to make changes in BIOS each time I have to boot up wintendo :)
_________________
hm.. help me.
Back to top
View user's profile Send private message
carambola5
Apprentice
Apprentice


Joined: 10 Jul 2002
Posts: 214
Location: Madtown, WI

PostPosted: Sun Nov 03, 2002 5:23 pm    Post subject: Reply with quote

Ian wrote:
grub came up perfectly fine, and looked all pretty. i hit enterto boot linux, and i got a kernel panic, probably because i made another stupid mistake earlier in the install. it may be because i did a stage1 install, and i'm still not sure what the variables were supposed to be set at :P, so i think i'm gona go back and try a stage2 or 3 install to avoid that. also, when i tried to boot windows from grub, it didn't want to work either, but luckily they're on seperete physical drives, and my bios can boot off of drive 0 - 3, so i can choose at will which to boot from (makes it much easier if i get fustrated and want to ignore linux for a while :)). i think i have to try redoing a complete install (from stage2 or 3) using the above tips, and it will hopefully work this time :D.


Usually when I get kernel panics in a newly installed system, the problem is actually with the grub.conf (or menu.lst) file. It's usually because I used the wrong hdd assignments for the root and/or kernel lines. These mistakes most likely occur when you are using 2 hard drives.

One way to make debugging this specific problem faster is to use multiple entries in the grub.conf file, using different kernel lines on each one. That way, you don't have to boot into the install CD to change the file all the time; you can simply reboot and choose a differently configured menu item.

Also, another quick way of testing the validity of an entry. If the blue graphic comes up in the grub bootloader, you know you have the right boot partition selected. Now, use the same partition combination (eg (hd0,0), hd(1,0), etc) for the "root" line.
_________________
Get Firefox!

Proper Web Development

I'm done at 999.
Back to top
View user's profile Send private message
vorplex
n00b
n00b


Joined: 29 Oct 2002
Posts: 48
Location: Pass Christian, MS.

PostPosted: Tue Nov 05, 2002 3:51 am    Post subject: Thanks Darth Reply with quote

you solved my Dual boot prob :lol:
Back to top
View user's profile Send private message
Spack
n00b
n00b


Joined: 02 Feb 2003
Posts: 32

PostPosted: Mon Feb 03, 2003 8:18 am    Post subject: Reply with quote

A slight variation which works a little better with the installation instructions. Will boot a new kernel by default but still provides the old one if this fails...saves modifying the list again after the new kernel is found to work
Code:
default 0
timeout 4
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title=Gentoo
root (hd0,0)
kernel /boot/bzImage root=/dev/hda3

title=Gentoo Old
root (hd0,0)
kernel /boot/bzImage.orig root=/dev/hda3

title=Windows XP
map (hd0) (hd1)
map (hd1) (hd0)
root (hd1,0)
rootnoverify (hd1,0)
makeactive
chainloader +1
Back to top
View user's profile Send private message
Evangelion
Veteran
Veteran


Joined: 31 May 2002
Posts: 1087
Location: Helsinki, Finland

PostPosted: Mon Feb 03, 2003 10:05 am    Post subject: Reply with quote

I currently run Debian in my home workstation, and it dual-boots with W2K. And I have a strange problem with it. Here is my setup:

Debian is in my first HD in /dev/hda (10gig HD). W2K is in my first ATA100-port (/dev/hde if I remember correctly. 30gig HD). First I had LILO installed in hda, and I had it set to boot both Debian and W2K. Debian booted like it should, but W2K wouldn't. It would start and then it would just hang (before you get the "progress-bar" in the bottom of the screen. Before the splash-screen). I never figured out how to fix that. So I started using a bit less elegant solution: My first boot-device is the floddy-drive, with second boot-device being the ATA100. When I want to run Linux, I insert my Debian boot-disk that boot up Debian. When I want to run W2K, I remove the boot-disk.

What could be causing the problem I described? How do I work around it? I would like to get rid of boot-floppies (not the most reliable thing in the world) when I migrate my workstation to gentoo.
Back to top
View user's profile Send private message
Spack
n00b
n00b


Joined: 02 Feb 2003
Posts: 32

PostPosted: Mon Feb 03, 2003 8:35 pm    Post subject: Reply with quote

Well according to the above you won't be able to do this with LILO.

So firstly you need to install GRUB. Then configure it as above but replacing hd1 with hd4 (since, in GRUB, hd4=hde).

Here's a GRUB howto for debian, which may help with the initial setup:

http://www.linuxorbit.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=539&page=1
Back to top
View user's profile Send private message
Xenarion
n00b
n00b


Joined: 16 Jan 2003
Posts: 54

PostPosted: Mon Feb 03, 2003 9:07 pm    Post subject: Reply with quote

Thanks man! Great job! I encountered the same problem, and this helped!
Just one question; what is "The boot menu graphic "?
Back to top
View user's profile Send private message
Spack
n00b
n00b


Joined: 02 Feb 2003
Posts: 32

PostPosted: Mon Feb 03, 2003 11:11 pm    Post subject: Reply with quote

That is the pretty background to the boot menu in GRUB. The default is a pretty gentoo image.
Back to top
View user's profile Send private message
Xenarion
n00b
n00b


Joined: 16 Jan 2003
Posts: 54

PostPosted: Tue Feb 04, 2003 7:16 am    Post subject: Reply with quote

Err.. I dont get any image :( Its just black.
Back to top
View user's profile Send private message
Evangelion
Veteran
Veteran


Joined: 31 May 2002
Posts: 1087
Location: Helsinki, Finland

PostPosted: Tue Feb 04, 2003 7:23 am    Post subject: Reply with quote

Spack wrote:
Well according to the above you won't be able to do this with LILO.

So firstly you need to install GRUB. Then configure it as above but replacing hd1 with hd4 (since, in GRUB, hd4=hde).

Here's a GRUB howto for debian, which may help with the initial setup:

http://www.linuxorbit.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=539&page=1


I use LILO in debian 'cause that's the defaul boot-manager. With Gentoo, I would of course use Grub. I'm just worried that I'll encounter the same problem with Gentoo/grub than with Debian/LILO.
Back to top
View user's profile Send private message
Leoric
n00b
n00b


Joined: 27 May 2002
Posts: 8
Location: Oslo, Norway

PostPosted: Wed Feb 05, 2003 8:52 am    Post subject: didnt work for me Reply with quote

I replaced my linux hda with another drive and installed windows2k on it. Then I switched back and now my windows drive is hdb and linux is hda.

I tryed your grub config, but windows 2k says it cant read from the selected partition. If I install the windows drive as hda, then everything works.
Back to top
View user's profile Send private message
aridhol
Guru
Guru


Joined: 20 Jan 2003
Posts: 509
Location: Stockholm, Sweden

PostPosted: Thu Feb 20, 2003 12:13 pm    Post subject: Reply with quote

I got help earlier with this but I must say your explanation cleared ut up greatly!

I love actually understanding why I do things and not just do them because someone told me it was the right way :)

Thank you!
_________________
72 of Pitcairn Islands 49 inhabitants use Seti@Home
"If you buy a DVD you have a copy. If you want a backup copy you buy another one."
"Anyone who is capable of getting themselves made President should on no account be allowed to do the job."
Back to top
View user's profile Send private message
undrwater
Apprentice
Apprentice


Joined: 28 Jan 2003
Posts: 275
Location: Caucasia

PostPosted: Mon Feb 24, 2003 6:01 pm    Post subject: Reply with quote

Thanks for a wonderful topic! I'll be using this soon as Windows is migrated off my box! (can't wait!)

Quick question about the rootnoverify;
I have tried to install grub several times with Win2k as hda, but when Win2k is selected from the menu, i get a blank screen then the grub menu reappears (as if it's looping). Had to reinstall Win2k after this.

Does the rootnoverify option take care of this...or am i barking up the wrong tree?

Hope i'm not too off topic...and thanks!
_________________
Open-mindedness is painful...
Back to top
View user's profile Send private message
marsf
n00b
n00b


Joined: 02 Mar 2003
Posts: 10

PostPosted: Tue Mar 04, 2003 12:05 am    Post subject: Reply with quote

Thanks! I have been waiting 2 years for this :D

There are other ways to have both Windows and Linux, but I have always wanted this setup. I just seems to work best.
Back to top
View user's profile Send private message
helmers
Guru
Guru


Joined: 16 Sep 2002
Posts: 548
Location: Oslo, Norway

PostPosted: Sat Mar 08, 2003 5:29 pm    Post subject: Reply with quote

I'm trying this out now, I expect it to work, as I _almost_ :wink: had it right. Thanks for helping out!
_________________
C is for Cookies!
Back to top
View user's profile Send private message
aabragan
n00b
n00b


Joined: 15 Jul 2002
Posts: 33
Location: Columbus,OH

PostPosted: Tue Mar 11, 2003 10:59 pm    Post subject: map does not work Reply with quote

i am running gentoo 1.4 rc2, which i installed from the live cd. i tried the procedure above since i am running gentoo on my first hdd and windows xp on my second hdd but grub said that it did not recognise the map command. can some one help me out...
Back to top
View user's profile Send private message
plate
Bodhisattva
Bodhisattva


Joined: 25 Jul 2002
Posts: 1663
Location: Berlin

PostPosted: Wed Mar 12, 2003 12:42 am    Post subject: Reply with quote

Post your grub.conf, let's see it. Maybe it's just a typo.
Back to top
View user's profile Send private message
Punisha69
n00b
n00b


Joined: 07 Apr 2003
Posts: 20
Location: vancouver, BC

PostPosted: Mon Apr 07, 2003 11:51 pm    Post subject: Thank You Reply with quote

Darth Daver.
THANK YOU VERY MUCH.
this was EXACTLY what I needed to do to get mine to work
appriciate the help :)
:)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum