GRUB, MBR and NTLDR confusion
Alan McKinnon
alan at linuxholdings.co.za
Wed May 24 13:27:34 UTC 2006
On Wednesday 24 May 2006 13:15, िऩऩाद wrote:
> Hi
>
> I have 2 hard disks. /dev/hda(primary) and /dev/hdb(slave) 40gb
> each. I have been facing a problem of bootloaders when installed on
> the MBR. To be safe and avoid any further problems I have decided
> to go with ntldr the windows bootloader. My first hdd has Win XP
> Slack 10.2 and FC3. The 2nd hd is solely for experimentation and
> contains Ubuntu 5.10 only. Whilst googling for information I found
> that GRUB can be loaded on to the boot partition instead of the MBR
> and also ona floppy or CD.
Grub can be installed on the MBR of a disk, or the boot sector of a
partition. What you want is to install it to the MBR of /dev/hda.
Do not try and make NTLDR the primary boot loader - that way lies
madness.
> Now my problem is I do not have a seperate boot partition. In turn
> whilst installing ubuntu I installed GRUB on /dev/hdb2.
You are confusing to things that are not related. All grub needs to
know is how to find the kernel images when it boots an OS. A boot
partition is purely for your convenience, not grub's.
> I created a linux.bin file by issuing
> dd if=/dev/hdb2 of=/linux.bin bs=512 count=1
> and copied it to C:\ and also added it to boot.ini and named it as
> linux.
This will make life really hard for yourself. Rather follow the method
I describe below.
> When I start the pc I get this option along with the windows XP
> option but on selecting it the system hangs with a constant beeping
> sound. Is there any other solution? Have I gone wrong somewhere?
> I do not want to install GRUB on to MBR but instead use the ntldr
> to boot Linux
> Currently I am booting by inserting the first cd of the slackware
> and issuing the boot command with the root as the specific
> partition
First, the background. When an average BIOS-based machine boots, it
goes to the first sector of the boot drive. This is set in the BIOS
and can be changed, but it's normally the primary master - /dev/hda.
The BIOS reads the code it finds there and executes it. The intention
is that this code will somehow start the OS. Keep in mind that the
boot loader is not part of the OS, it's just bundled with it to make
life easier. What grub does is install an MBR which loads an
intermediate part of grub from disk (it knows where that is), this
runs which loads the rest of grub (it also knows where this is) and
bing! you get a grub boot screen. Press enter and grub loads the OS.
1. Install Windows. It *will* put it's own boot loader onto /dev/hda -
don't worry, this can be fixed.
2. Pick a Linux distro that you will consider will be in control of
grub - let's say it's Slack. Direct the installation to put grub on
the MBR of /dev/hda. This will overwrite what Windows did, this IS
what you want.
3. Install all the other distros, and tell the installer to put grub
on the boot sector of the partition containing it's /boot (whatever
that is). In your case this might be FC and Ubuntu.
Now you might have this setup (exact partition numbers don't matter
much, it;s the principle that applies):
/dev/hda1 - XP
/dev/hda5 - Slack /boot
/dev/hda6 - Slack /
/dev/hda7 - FC / (no separate boot)
/dev/hdb1 - Ubuntu
Slack installed grub on /dev/hda. It will have set up grub to start
itself, so start Slack and add stanzas to /boot/grub/grub/conf or
menu.1st for the other OSes:
title FC
root (hd0,6)
chainloader +1
title Ubuntu
root (hd1,0)
chainloader +1
title Windows
root (hd0,0)
chainloader +1
Because FC and Ubuntu installed a second grub in their boot sectors,
this works nicely. Windows does the same thing anyway. So starting
Slack takes you through grub only once, the others take you through
two loaders.
This is by far the easiest way to do it and get it working. There are
other configurations that are more elegant but require a bit more
knowledge of what's going on.
Rule #1: Do not make Windows your primary boot loader. It is designed
to ignore any other non-MS OSes and make your life difficult. It can
be done, but it's not pretty.
Rule #2: Don't try and get around this by changing the boot device in
the BIOS every time you boot to Linux. This is just too painful
Caveat: When you do the routine re-install Windows every 6 months
thing, it WILL nuke your grub. This is not a disaster, it simply
overwrites the MBR, and that's not where grub is. To fix it, start
Linux from a LiveCD and run grub-install from a console. Everything
goes back the way it should be.
--
If only me, you and dead people understand hex,
how many people understand hex?
Alan McKinnon
alan at linuxholdings dot co dot za
+27 82, double three seven, one nine three five
More information about the ubuntu-users
mailing list