and moved back and forth between (1) and (2) when installing
new releases in the same general family of Linuxes - e.g.,
FC 1 -> FC 2 -> FC 3, etc.
However I'm a little concerned about mucking up the boot
partition if I install something different, like Debian, or want
to add something very different like FreeBSD.
I understand I can install the kernel and boot info in a /boot
directory under each root partition, but I'm confused as to where
GRUB is actually located on the HDD under that situation. I didn't
think there was enough room in the MBR for it. If in one of the
root partitions, then it would be destroyed when I installed a
new release in that partition. Can anyone clarify?
Regards,
Charles Sullivan
This is best understood by considering the process which grub itself is
installed, not when grub is working properly as the loader.
The setup sequence for grub is generally as follows:
1. Grub files are copied to /boot/grub (i.e. the stage files)
2. The configuration file /boot/grub/menu.lst file is created/modified to
include parameters appropriate for your system. *Actually, this step is
optional; grub will still work as a loader if you can manually provide
the correct information at boot.
3. The grub shell is used to interactively setup the loader:
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
Going through these steps one at a time:
1. The root command tells grub where to look for _its_ files. Don't
confuse this with other meanings for the word _root_.
2. The setup command tells grub to proceed with the install, based on what
partition type is in use at _its_ root partition. Specifically, it
builds links between the first stage loader (MBR), and the other stage
files. The later stage files give the loader the ability to read
filesystems (ext2, xfs, reiserfs, etc.) The link is set based on the
type of partition in use at the time of the install. With this link in
place, the loader will be able to read the partition dynamically in the
future. This ability is grub's big advantage over other loaders. It will
be able to find any file on _its_ root partition.
And note, similar links are required if the stage1 loader is installed
on the partition (BPB), instead of the MBR.
3. quit: exit the grub shell
Once it is setup, it will just work, unless it becomes broken. It can
read any file that is on _its_ root partition (the boot partition).
Note: it can be broken by reformatting the partition or by
deleting/changing the "stage" files at /boot/grub. The links from the
MBR/BPB to the partition must remain consistent with the stage files.
Final note: If you have a boot partition, then entries in menu.lst will be
relative to that partition (i.e. /grub, not /boot/grub.)
Grub is a very flexible loader. After thinking about it just now, I
see that there are even more ways it can be used. My explanation covers
the basic case, though.
--
Douglas Mayne
Thanks for the detailed explanation Douglas, but I'm still a little
unclear. Suppose I want to install two Linux distros on a new HDD
and not use a boot partition. Do I end up with something like
this:
MBR -> grub stage1
hda1 extended
hda5 swap
hda6 home (1)
hda7 root (1)
/boot
kernel (1) and other boot files
/grub
grub stage 2 (1) files
hda8 home (2)
hda9 root (2)
/boot
kernel (2) and other boot files
/grub
grub stage 2 (2) files
Do I still get the GRUB version selection menu (Fedora) when I
reboot the system, or would I have to (Ugh!) boot from a floppy
or CD each time? Or do the grub stage 2 files exist in only
one of the root partitions?
And if hda6 and 7 are later reformatted (same partitions, just
cleared) and a new version of Linux installed, will GRUB still
work or will I wipe out something critical?
Or should I forget the whole thing and continue to use a boot
partition? :-)
Regards,
Charles Sullivan
> On Sun, 29 Jan 2006 12:04:07 -0700, Douglas Mayne wrote:
>
>> On Sun, 29 Jan 2006 17:45:07 +0000, Charles Sullivan wrote:
>>
>>> In the past I've partitioned my Linux i86 HDD like this:
>>> hda1 boot
>>> hda2 extended
>>> hda5 home (1)
>>> hda6 swap
>>> hda7 root (1)
>>> hda8 home (2)
>>> hda9 root (2)
>>>
>>> and moved back and forth between (1) and (2) when installing
>>> new releases in the same general family of Linuxes - e.g.,
>>> FC 1 -> FC 2 -> FC 3, etc.
>>>
<snip>
>>
>> Grub is a very flexible loader. After thinking about it just now, I
>> see that there are even more ways it can be used. My explanation covers
>> the basic case, though.
>
> Thanks for the detailed explanation Douglas, but I'm still a little
> unclear. Suppose I want to install two Linux distros on a new HDD
Do you mean, "new" as in "new" from the store? This drive is installed
in addition to any drives in your system. Or do you mean, "new" as in
"new format of the one existing disc"?
Note: comment inline.
As I implied, grub is a very flexible loader, and it is rare when the
fallback to floppy boot is required. The best course is just to plan in
advance what you intend to do, including the boot loader. Grub will
usually be able to accomodate your plan. Any time you spend learning
about the loader will pay off later.
Understanding what you're doing...
If you totally wipe out your partition with the "upper" stage files, then
you'll need to reinstall before Grub will work again. Note: my question
(above) and your answer will dictate how to proceed. Maybe, you should
make a grub floppy at this point so you will have a fallback position.
Specific advice...
One way to proceed is to keep your boot partition intact. When you
install new linux distributions, elect to install the grub loader on
_its_ root (linux) partition. That way, you can add a simple menu
entry on the "master" list on your boot partition's menu.lst. The new
entries on the "master" list would look something like this:
title Slackware Linux
rootnoverify (hd0,5)
chainloader +1
title OpenSuse Linux
rootnoverify (hd0,6)
chainloader +1
This approach saves copying the kernel and detailed menu.lst entry
necessary to load a specific distribution's kernel. You will have a
layered menu (menu upon menu), but in my opinion that is the simpler
choice.
Just keep your plan straight in your mind (or on paper). You are
more likely to have success that way.
--
Douglas Mayne
By "new" I meant new-from-the-store. I should probably explain
that when my current "main" HDD gets a little age on it, I buy a
new (and usually larger) one. I physically install it as /dev/hda
and load Linux on it from scratch. I physically relocate the
old one to /dev/hdb or hdc and copy over whatever files I need
onto the new /dev/hda. Eventually the old one is removed and
stored - if I ever need it I can just plug it in again as /dev/hda
and boot it up.
OK, I think I'm now getting the picture: I keep a boot partition
but the only things on it are the grub files - the kernel
and such goes into the /boot directory on the root partition for
that particular Linux version and a grub stage 2 loader goes
in the PBR of the same root partition. Is that correct?
Regards,
Charles Sullivan
> On Sun, 29 Jan 2006 14:00:39 -0700, Douglas Mayne wrote:
>
>> On Sun, 29 Jan 2006 20:14:02 +0000, Charles Sullivan wrote:
>>
>>> On Sun, 29 Jan 2006 12:04:07 -0700, Douglas Mayne wrote:
>>>
>>>> On Sun, 29 Jan 2006 17:45:07 +0000, Charles Sullivan wrote:
<snip>
Ok, then one of the first steps with the new disc would be to build a boot
partition (with dual booting in mind.) Setup the grub loader, per the
usual drill.
>
> OK, I think I'm now getting the picture: I keep a boot partition but the
> only things on it are the grub files - the kernel and such goes into the
> /boot directory on the root partition for that particular Linux version
> and a grub stage 2 loader goes in the PBR of the same root partition. Is
> that correct?
>
Note: comment inline.
You've got it, almost. I reread my last post and wished I could have been
clearer. The confusion comes because you will be dual booting. What I
am advocating is _independant_ boot methods, controlled by one "master"
grub. Any other linux distributions which may be installed will be setup
with their own boot loaders on their own root (linux) partitions. Because
the loaders are independant, the grub stanza's using "chainloader" is
appropriate (and the grub stage files don't really enter into the big
picture at this level of abstraction.)
For example, say you are installing Slackware as a test linux
distribution. (That is a terrific idea, BTW ;-)). Slackware uses
lilo by default for its bootloader. "Setup" offers to install lilo
as one of the final setup steps. You would choose to install lilo at
on the root (linux) partition. Then, you would manually add a "Slackware"
stanza to your grub menu (as I showed earlier). The two loaders are
independant, connected by chainloader. You can fix the loader for
slackware to use grub after Slackware is booted the first time.
You could then install another linux distribution, using the same idea.
You could then install another linux distribution, using the same idea.
:
:
etc.
It's harder to describe, than it is to do. As I said, layout your plan on
paper, and you'll be on your way. Here is a table for getting started.
Partition Used for Size or % Comments
--------- ----------- ---------- ---------
MBR boot loader 512 bytes Use grub
1 grub (master) 10-100M no need to be too stingy
2 common swap ? if only one distro at a time
3 extended ? remainder of disc
5 Slackware ? rocks!
6 OpenSuse ?
7 Ubuntu ?
etc.
--
Douglas Mayne
Many thanks Douglas. Your patience in explaining it all to me
is greatly appreciated, and your example layout makes for a very
clean looking system. Now to try it out with my new HDD!!!
Regards,
Charles Sullivan