Re: GRUB advice needed.



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.
>
> 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?
>
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
.



Relevant Pages

  • Re: Fedora Core 2/Windows XP dual boot: selecting Linux doesnt work
    ... grub is installed on the /root partition, which is the first partition on hdc: hdc1, or in grub notation. ... Stage1 is the unpatched 512-byte file, that is patched and copied to the boot record during setup. ... This byte is initialized to 0xff in the stage1 file, but patched to 0x81 in your setup, to say "we are booting from disk." ...
    (comp.os.linux.setup)
  • Re: [opensuse] Yast & Grub bootloader different.
    ... My Grub bootup menu is different than the bootloader ... that shows up on the logon screen aat boot time. ... any boot loader for that matter, can only operate on one /boot partition at ... Grub doesn't scour the all hard drives on each install ...
    (SuSE)
  • Re: [Fwd: Re: [opensuse] Boot magic]
    ... Since I installed some milestones I can no longer boot the partition I want. ... I installed on part3 milestone 6 with its own boot directory in the rootdir. ... I only use the milestone 6 grub environment against my will. ...
    (SuSE)
  • Re: Boot manager for Windows only
    ... And also is GRUB capable of booting any ... > Windows partition or will it always hand over to the XP boot loader? ...
    (comp.os.linux.setup)
  • Re: Howto fix grub after converting to reiserfs
    ... The initial load of grub is done by the BIOS, which reads the boot sectors for additional information for the boot process. ... If you still have problems, and can come up with a small bit of additional disk space, near the beginning of the disk, create a separate partition for /boot and format it as ext3, move all the files from your existing subdirectory into this new partition, edit the menu.lst file to remove all references to '/boot', edit fstab to do a mount of this partition on /boot, and reboot. ... it will perform a full install presuming the Stage 2 or Stage 1.5^10 is in its final install location. ... 0, Filesystem type is fat, partition type 0x16 ...
    (Debian-User)

Quantcast