Help - Search - Members - Calendar
Full Version: Grub And 2 Drives - Need Help Asap...!
Linuxhelp > Support > Technical Support
Yakoob
I've got 2 drives:
80mb, devided into 2 partitions, Window98SE
40MB, Linux (redhat 7); removable drive (pocket)

So I installed the linux using the Anaconda installer and I was to select boot loader - I chose GRUB. I also specified that I don't want install linux on my Windows drive.
I found out that the GRUB MBR was installed in BOTH drives BUT the essential files for GRUB only on my linux drive! So if I remove my Linux HDD, GRUB will throw disk errors at me and not boot windows (kinda defeats the purpose of having a removable drive).

Other thing I don't understand:
When I boot my PC from the windows drive I get the nice GRUB splash screen and can choose linux or windows
When I boot my PC from the linux drive, I get the GRUB shell
Why is that?

Also, what can I do to "fix" my problem? There are two things I'd like to do:
1. Bring back the OLD configuration: Windows drive doesn't have GRUB just the default loader; Linux has GRUB;
-When I boot my PC w/o linux drive, windows loads instantly
-When I boot my PC w/ linux drive, GRUB loads and lets me choose linux/windows
2. Install full GRUB on both drives;
-When I boot my PC w/o linux drive, GRUB launches and lets me boot (only?) windows
-When I boot my pc w/ linux drive, GRUB launches and lets me boot linux or windows

How can I achieve one of the two? For the first option, I've heard I should use fdisk /mbr but I've also heard it's quite dangerous and might make my drive unbootable. About the latter option, I thought I could just invote GRUB shell and use the "setup" command to install GRUB on my windows drive... should it look like this:
setup hd(0,0)
???
And why when I boot from my linux drive I don't get the splash screen but the shell?

Help greaitly appriciated!
michaelk
First of all need help ASAP, urgent for a subject etc is considered rude.

grub is a multi stage boot loader so its not completely contained in the MBR. When it can not find its config file grub.conf (or sometimes menu.lst) you get the shell prompt. In addition the menu contains a hard reference to the root partition located in the MBR. Moving drives around changes this reference so it will screw up the boot process. In addition there is the /etc/fstab which Redhat usually uses lables but there is some hard partition IDs used for swap. By booting different drives will change the partition ID and so linux will have difficulties booting.

fdisk /mbr will not damage the disk/

To bring back the MBR for just booting windows use fdisk /mbr


-When I boot my PC w/o linux drive, windows loads instantly
-When I boot my PC w/ linux drive, GRUB loads and lets me choose linux/windows

I don't know of anyway to implement your ideas with existing bootloaders.

If your computer's BIOS has the capability to select which hard drive to boot from you could install grub to the linux drive. Select this drive to boot 1st, the windows drive 2nd. This will give you the option to boot windows or linux when the linux drive is installed. When the linux drive is removed the BIOS will automatically boot the windows with no bootloader.

I don't know if not having the linux drive as the primary master what grub will determine as hd(0,0). You might have to add some statements in the grub.conf to map the drives. Also running linux without the windows drive will possibly screw up the /etc/fstab file when running with the windows drive.
Yakoob
Sorry I didn't mean to sound rude sad.gif

thanks for the help and the answer you provided is exactly what I was talking about in option 1 (the one you quoted).

I've done it earlier because I always turned off my windows HDD before installing linux JUST IN CASE, this one time I didn't do that and GRUB "attacks" it aswell...

Btw, My windows drive is not removable and is Primary Slave while Linux is Secondary Master (so I guess windows is first here) and I have 2 partitions on my windows disk: c: and d:, windows is on d: in a windows.000 folder (not windows !)... is fdisk /mbr safe ? and should I remove my linux disk before doing it?

You mentioned that you get the shell if there is no config/list file, but I get shell when I but my pc from the linux drive and there is a /boot/grub folder (I have even modified the file a bit and it did work so I know it's the correct one) ..???
Also if you don't mind, how do I install grub on linux itself? do I have to d/l grub and install it in linux or can I use the existing grub to modify it?
just to let you know:
Windows drive: c -> /dev/hdb1 -------- hd(0,0) in grub
windows dirve : d -> /dev/hdb5
Linux drive: /dev/hdc1 --------- hd(1,0) in grub
michaelk
fdisk /mbr is safe. No need to remove the linux drive. It will rewrite the first MBR it finds i.e. in your case hdb.

I don't know how grub works exactly but if you boot from the linux drive it recognizes the drive as hd(1,0) not hd(0,0) like it was first installed. You can reinstall grub using grub-install /dev/hdx. Check out the grub website for complete documentation.
cagey cretin
I just used fdisk /mbr the other day for another reason, and returned the windows boot record nice and neatly. smile.gif
Yakoob
Ok, thank all, I'll try that then...
and if it does make my disk unbootable.. you shalt pay !!!!!!!!!! wink.gif tongue.gif
hughesjr
Doing fdisk /mbr will fix your windows drive ... but then you won't be able to boot to linux unless you use a boot disk or can change the BIOS to boot to secondary master.

Now there is a really cool program on the Debian install CD called sbm.bin (it's called Smart Boot Manager). You can write it to floppy disk pick what Drive you want to boot from....I highly recommend it. I think you can also get it here:

http://btmgr.webframe.org/
Yakoob
Thanks!
Yeah I can change the boot sequence in my BIOS and I was thinking about exactly what you mentioned (sorry for not making it clear enough):
First it boots linux, then windows, so if linux is in, linux will boot and if it is not, windows will...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.