Re: Linux and Windows Disk Drive imaging




In article <PpDRm.72639$mn3.16186@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Joel Koltner <zapwireDASHgroups@xxxxxxxxx> wrote:
Thanks Dave; that's a reasonably simple approach. One last question: Is /grub
part of the "regular old file system" on a given partition (i.e., menu.lst,
etc. are stored within your, say, ext2 filesystem just like any other file),
or is it a special filesystem that GRUB understands but that actually occupies
parts of a partition separate from the rest of your files?

The former.

The only part of GRUB which isn't part of a normal filesystem, is the
boot-sector itself - the very first level. The later stages are all
stored in a standard filesystem.

I ask in that it's never been clear to me how, if menu.lst, etc. are all just
regular files, GRUB manages to access them since first it would have to be
able to find the ext2 or ext3 or reiserfs or jfs or a myriad of other
filesystem driver, which seems like a chick-and-egg problem.

When you run "install-grub", the installer asks your filesystem code
(e.g. ext2) where the later-stage loading files are (that is, their
actual sector offsets within the filesystem partition in which they
live). Specifically, it needs to know where "stage1" is, and the
"stage1_5" files for any filesystem formats you may need to use to
locate your kernel. I'm not sure whether it needs to know where
"stage2" is.

It patches these values into the bootloader and/or into stage1.

When you boot up, the boot-sector code now has enough information to
locate "stage1" on disk (without having to interpret any filesystem
structures) and it loads it. "stage1" has enough information to
locate the filesystem interpreter for EXT2, and loads that (and
"stage2", I think).

The menu.lst file, and any kernels and initial-RAMdisk images needed,
are locate dynamically by (e.g.) "e2fs_stage1_5" - it has enough
knowledge of the filesystem structure to be able to navigate
directories and load file contents (it's a purely read-only beast).
That's why you can navigate through directories dynamically, and boot
a kernel which wasn't even on the machine when you installed GRUB.

What this means, is that you need to re-run the grub installer and
write a new boot sector any time you move the low-level files around
(or update them), but don't need to do this low-level operation when
you edit menu.lst, or add a new kernel to your confirmation, or etc.

It's a more sophisticated system than LILO... which requires that you
re-run the low-level installer any time you change the kernel.
Replace vmlinux, and forget to run LILO again, and at best you'll
end up booting your old kernel rather than your new one. At worst,
you will sooner or later find that your old vmlinux file's sectors
have been re-used for a new file, and the "kernel" you just tried to
boot is actually Aunt Mamie's recipe for mango chutney.

Usually doesn't work too well...

--
Dave Platt <dplatt@xxxxxxxxxxxx> AE6EO
Friends of Jade Warrior home page: http://www.radagast.org/jade-warrior
I do _not_ wish to receive unsolicited commercial email, and I will
boycott any company which has the gall to send me such ads!
.



Relevant Pages

  • Re: Linux and Windows Disk Drive imaging
    ... etc. are stored within your, say, ext2 filesystem just like any other file), ... or is it a special filesystem that GRUB understands but that actually occupies ... The only part of GRUB which isn't part of a normal filesystem, ... Kernel update howto copyright Jan Panteltje 2009-always, ...
    (sci.electronics.design)
  • Re: root device name w/kernel-image
    ... > What filesystem is on your root and does the new kernel have built-in ... support for ext2. ...
    (Debian-User)
  • Re: Linux slower than doze!!!
    ... > was removed from the kernel I think, ... Truth is that ext2 is still valuable for many tasks. ... ext2 is good when you want a reliable, simple filesystem that supports ... Another example is debugging an ext3 system (happened too often ...
    (uk.comp.os.linux)
  • Re: corrupt superblock
    ... The superblock could not be read or does not describe a correct ext2 ... filesystem, ... errors went away when I compiled and used a newer kernel. ...
    (comp.os.linux.misc)
  • Re: [00/41] Large Blocksize Support V7 (adds memmap support)
    ... kernel and already must have fallbacks.... ... I don't agree with using higher order pages to fix SLUB vs SLAB performance ... as well as something the filesystem people recommend to get good coverage ...
    (Linux-Kernel)