GRUB and MBR questions from a real newbie

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read this

Re: GRUB and MBR questions from a real newbie

Postby Rimmsy on Tue Mar 04, 2008 6:16 pm

As I said, "no worries". I know you weren't being rude...so chill man! 8) I will work through it...they say the best way is learning by doing.

I think I might just start again and try and do it in a more informed manner using knowledge that has been explained to me and what I can find in wikis and guides around the place...I should be able to get it to work.

With all the info provided by you guys...I know I am on the right track.

Cheers
Rimmsy
Rimmsy
Level 1
Level 1
 
Posts: 12
Joined: Sun Mar 02, 2008 6:34 pm

Linux Mint is funded by ads and donations.
 

Re: GRUB and MBR questions from a real newbie

Postby muskratmx on Tue Mar 04, 2008 7:39 pm

If your going to back off and redo the partitioning, Take stock of what you have.

One drive or two or three? If I had a small drive with say 40gb, I'd install windows on it, installed as the primary master while doing so. Don't even bother jumpering the rest of the drives in right now, because I'd change it later. After your windows is working fine booting and all. I'd remove it from the primary master postition, and place it in secondary master or slave, depending on if I had two more drives or just one more. Now get them all jumpered right so as your bios sees them all

Then I'd take my biggest fastest drive and place it in primary master postition and ether another one in primary slave or my windows drive there, whichever. Mind you windows won't boot there yet. But in an emergency you could swap the ribbons and always boot windows because we won't be over writting the windows drive MBR this way. When we install Linux now on the primary master and install grub to the primary master's MBR, it should pickup windows and load a stanza for windows there.

After having setup the large drive I'd partion it with a small (about 500mb) /boot partion as partition #1 make it bootable. Then you can make the rest of your partition as you please, even making one ntfs or fat32, windows will see it as drive D: windows won't even see the /boot partition, or any of the rest of linux partition. So your ntfs partition can be 2 or 3 whatever you want. Don't forget to make a swap partition it should be twice your memory but not more than 4 gb.

Give yourself one large partition for /home, all your distros installed can use the same /home just give each a different user name, and do not format that partition during the install, all your installs will also use the same swap partition, no need for more than one of those.

But only use the /boot once by whichever distro you want to be in control of grub. All other installs will have /boot inside of their own /(root) partition. You can manually change that afterwards, if you want, but no need to.

I've set up several boxes this way, windows never even knows we placed it in the back seat because grub does that little remapping trick and windows believes it's on drive C: and the ntfs partition on the primary master appears as drive D:. But when Linux boots the drives will appear in their proper order.
User avatar
muskratmx
Level 4
Level 4
 
Posts: 226
Joined: Sun Dec 09, 2007 1:30 pm
Location: TX/MX Gulf Coast

Re: GRUB and MBR questions from a real newbie

Postby Rimmsy on Tue Mar 04, 2008 8:46 pm

muskratmx wrote:If your going to back off and redo the partitioning, Take stock of what you have.

One drive or two or three? If I had a small drive with say 40gb, I'd install windows on it, installed as the primary master while doing so. Don't even bother jumpering the rest of the drives in right now, because I'd change it later. After your windows is working fine booting and all. I'd remove it from the primary master postition, and place it in secondary master or slave, depending on if I had two more drives or just one more. Now get them all jumpered right so as your bios sees them all

Then I'd take my biggest fastest drive and place it in primary master postition and ether another one in primary slave or my windows drive there, whichever. Mind you windows won't boot there yet. But in an emergency you could swap the ribbons and always boot windows because we won't be over writting the windows drive MBR this way. When we install Linux now on the primary master and install grub to the primary master's MBR, it should pickup windows and load a stanza for windows there.

After having setup the large drive I'd partion it with a small (about 500mb) /boot partion as partition #1 make it bootable. Then you can make the rest of your partition as you please, even making one ntfs or fat32, windows will see it as drive D: windows won't even see the /boot partition, or any of the rest of linux partition. So your ntfs partition can be 2 or 3 whatever you want. Don't forget to make a swap partition it should be twice your memory but not more than 4 gb.

Give yourself one large partition for /home, all your distros installed can use the same /home just give each a different user name, and do not format that partition during the install, all your installs will also use the same swap partition, no need for more than one of those.

But only use the /boot once by whichever distro you want to be in control of grub. All other installs will have /boot inside of their own /(root) partition. You can manually change that afterwards, if you want, but no need to.

I've set up several boxes this way, windows never even knows we placed it in the back seat because grub does that little remapping trick and windows believes it's on drive C: and the ntfs partition on the primary master appears as drive D:. But when Linux boots the drives will appear in their proper order.


Thanks Muskratmx!

Sounds like a plan!

Cheers
Rimmsy
Rimmsy
Level 1
Level 1
 
Posts: 12
Joined: Sun Mar 02, 2008 6:34 pm

Re: GRUB and MBR questions from a real newbie

Postby Fred on Wed Mar 05, 2008 7:47 am

Rimmsy,

I haven't had much time to be on the computer in the last couple days. I see muskratmx has taken the time to give you a lot of really good advice. I suggest that you follow it. :-)

Anything you don't know is hard. Anything that you know is easy. Once learned, it will be easy. I promise. :-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: GRUB and MBR questions from a real newbie

Postby Husse on Wed Mar 05, 2008 7:49 am

I think you're doing fine without me :)
Just a note
Then it inserts a complete system onto the MBR

No, no - but this is (probably) just a slip of the tongue
MBR is one sector 512 bytes so it does not contain much :)
Just a partition table and a "pointer"
Google for it if you're interested
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19714
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: GRUB and MBR questions from a real newbie

Postby Fred on Wed Mar 05, 2008 10:13 am

Husse,

You know we couldn't do without you. Besides, who is going to keep me honest and correct my silly mistakes? :-)

Enjoy life,

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: GRUB and MBR questions from a real newbie

Postby Husse on Fri Mar 07, 2008 7:31 pm

@ Muskrat/Steve
You write
Notice the two map lines. If windows was in the primary master position it would only have one map line.

I checked the grub manual before advising someone else and it does not say anything about that
This is all there is about that
13.3.23 map
— Command: map to_drive from_drive

Map the drive from_drive to the drive to_drive. This is necessary when you chain-load some operating systems, such as DOS, if such an OS resides at a non-first drive. Here is an example:

grub> map (hd0) (hd1)
grub> map (hd1) (hd0)


The example exchanges the order between the first hard disk and the second hard disk. See also DOS/Windows.

I have not explored this specific part of grub - it's a fact of life that people install Win before Linux....
so the need is not pressing
I looked a bit more and found another manual that was really interesting (for a nerd :))
http://www.linuxselfhelp.com/gnu/grub/h ... rub_4.html
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19714
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: GRUB and MBR questions from a real newbie

Postby muskratmx on Sat Mar 08, 2008 4:12 pm

I checked the grub manual before advising someone else and it does not say anything about that


Code: Select all
Map the drive from_drive to the drive to_drive. This is necessary when you chain-load some operating systems, such as DOS, if such an OS resides at a non-first drive. Here is an example:

grub> map (hd0) (hd1)
grub> map (hd1) (hd0)


It does if you understand, the key phrase above is "non-first"

As with almost all Unix format manuals, they lack in read ability. I made the statement ...
Notice the two map lines. If windows was in the primary master position it would only have one map line.


...from experience. When one installs windows first, then installs a linux distro with a good script, which picks up the windows install and inserts it into the menu.lst file automatically, you'll only see one map line or maybe no map line. True the map line is needed for chainloading, But dual map lines, is grub doing a trick, flopping drive positions, 2nd to first position.

If you have installed DOS (or Windows) on a non-first hard disk, you have to use the disk swapping technique, because that OS cannot boot from any disks but the first one. The workaround used in GRUB is the command @command{map} (see section map), like this:

grub> map (hd0) (hd1)
grub> map (hd1) (hd0)


I've done this many times, installed windows on a drive, solo! Then moved said drive to slave and insert a freash drive and installed linux. After which grub adds the second map line so windows, (being chain loaded) will think it's the first drive. Because windows will not boot on the second drive if windows knows it's the second drive. MS doesn't like the back seat.

There is an alternative way of doing things, but it's usually used eternally on disks, allowing you to install and boot windows to the second or third partition. It's called hiding partitions. But that's another topic for another day.

Then it inserts a complete system onto the MBR


No, no - but this is (probably) just a slip of the tongue
MBR is one sector 512 bytes so it does not contain much :)


Actually it wasn't a slip of the tongue. What is a system? OS? Nothing more than a kernel!

The grub kernel is installed onto the MBR, using 400 and some odd bytes, That in why you can issue commands on the command line from grub. Now I will grant you, grub needs to access menu.list to get some commands and data. It also needs to access stages files, but these are basicly the same as the linux kernel accessing the modules. That is why if those files reside on disk that require spicial drivers, you get grub errors. Because the drivers haven't been loaded yet.

So I suppose my slip of the tougne, was in using the word complete, in relation to the MBR. But my point was grub is an OS unto it's self. You can build a floppy disk holding everything and boot into grub and proform task without ever booting into another OS. So I stand corrected. :oops:

I'll say The complete grub kernel is installed into the MBR. Grub being the pointer.

I looked a bit more and found another manual that was really interesting (for a nerd :))
http://www.linuxselfhelp.com/gnu/grub/h ... rub_4.html


That's an excelant manual, I've bookmarked it .It's what I've been pointing to all along. Grub is another OS. If you look at that pages all the commands he states to issue are done in a grub shell. You are actually running Grub not Linux, that might be why you feel it's (for a nerd)! So in reallity, if your dual booting, (Win and Linux) your really triple booting. You have to get grub to play nice with windows and linux so they can cohabitate.

So I guess the moral of the story is, if your going to use grub, learn grub. And like they say Linux isn't windows, nether is grub linux.
User avatar
muskratmx
Level 4
Level 4
 
Posts: 226
Joined: Sun Dec 09, 2007 1:30 pm
Location: TX/MX Gulf Coast

Re: GRUB and MBR questions from a real newbie

Postby Husse on Sat Mar 08, 2008 5:58 pm

Thanks for this post - I have no experience at all of Win on the second disk. I think XP and Vista can handle it, but I may be wrong. Earlier versions than XP definitely can't
OK - I wrote "pointer" in MBR and knew it really is a minute program. If that's the kernel of grub I stand corrected (to an extent) :)
However for both Win and Linux I have never contemplated MBR as anything but a partition table and a way to find the "real" boot loader, so I did not pay enough attention to it
This was interesting though
There is an alternative way of doing things, but it's usually used eternally on disks, allowing you to install and boot windows to the second or third partition. It's called hiding partitions. But that's another topic for another day.

Solves a problem for another guy, I was looking for the way to "swap partitions" so the stupid Win thinks it's in C
//Edit by husse/Oh no - it did not, seems to be only if there are two Win partitions on the disk.
Must find out if grub can help with Windows in another partition than the first//
Grub is so hard to understand that you almost get a head ache :) but I think I understand it decently but for the chainload thing which I'm beginning to grasp
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19714
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: GRUB and MBR questions from a real newbie

Postby muskratmx on Sat Mar 08, 2008 7:45 pm

Must find out if grub can help with Windows in another partition than the first//


That's exactly what hiding does, now mind you I have never done it, because one windows install at a time is far to much disk consumption for me.

Another problem arises if you installed more than one set of DOS/Windows onto one disk, because they could be confused if there are more than one primary partitions for DOS/Windows. Certainly you should avoid doing this, but there is a solution if you do want to do so. Use the partition hiding/unhiding technique.

If GRUB hides a DOS (or Windows) partition (see section hide), DOS (or Windows) will ignore the partition. If GRUB unhides a DOS (or Windows) partition (see section unhide), DOS (or Windows) will detect the partition. Thus, if you have installed DOS (or Windows) on the first and the second partition of the first hard disk, and you want to boot the copy on the first partition, do the following:

grub> unhide (hd0,0)
grub> hide (hd0,1)
grub> rootnoverify (hd0,0)
grub> chainloader +1
grub> makeactive
grub> boot


Grub is so hard to understand that you almost get a head ache :) but I think I understand it decently but for the chainload thing which I'm beginning to grasp


But it begins to become so much easier when you think of Grub on it's own terms doesn't it?

Chainloading is one area, which I've still to conquer entirely. I can chainload windows now with little problems. But haven't been able to chainload Linux. By theory one can install a bootloader to the partition record of a given partition and chainload from the bootloader in MBR to the bootloader in the partition record. I haven't acomplished that yet.

You might ask why would one want to do that? Well some linux distros use LiLo, and if I could manage that, I could boot it with it's own pretty splash screens and all. Another reason is because every time I do a linux install, I have to reboot two or three times working on writing the grub stanza correct. I do a linux test of distros usually about every week or two.

The grub stanza it's self isn't that default. It's the kernel boot perimeters that can be a bear, especially since I'm usually testing some distro I'm not familiar with and the programers do all sorts of stuff on that line.

However for both Win and Linux I have never contemplated MBR as anything but a partition table and a way to find the "real" boot loader


One last note, your still thinking in terms is MSwindows, Linux does not have a "real boot loader" like MS, The bootloader used to be LiLo (Linux Loader), Grub (Grand Unified Bootloader) is the new kid on the block. But both reside in the MBR and load the Linux kernel directly, where as MS has a loader which loads the kernel.

It's just that with LiLo, you have to over right the MBR each time you make changes, instead of editing a file like grub. Also Lilo does not have a shell like grub, where you can enter into that environment and do any work.
Last edited by muskratmx on Sun Mar 09, 2008 1:50 am, edited 1 time in total.
User avatar
muskratmx
Level 4
Level 4
 
Posts: 226
Joined: Sun Dec 09, 2007 1:30 pm
Location: TX/MX Gulf Coast

Re: GRUB and MBR questions from a real newbie

Postby Fred on Sat Mar 08, 2008 11:15 pm

muskratmx,

Greetings sir,

I read your comments above with interest. Noticed this:

Chainloading is one area, which I've still to conquer entirely. I can chainload windows now with little problems. But haven't been able to chainload Linux. By theory one can install a bootloader to the partition record of a given partition and chainload from the bootloader in MBR to the bootloader in the partition record. I haven't acomplished that yet.


Maybe this will help you a little bit. I have a computer that currently has 2 copies of Linux Mint 4 KDE CE, Kubuntu, Sidux, which I just added, and Sabayon. This is the main computer that my wife uses also. She likes Mint 4 KDE CE, so I have a separate install for her. I have a habit of breaking systems and then having to fix them, trying to do strange and unusual things. As you can imagine, this doesn't go over well with her when she wants to do something important, like read the obituaries. :-)

I did have separate boot and home partitions, but have now changed that. I put everything in / for each installation. And I now have a separate partition for booting only. A master boot you might say. It is not associated with any of the installs. You could use the boot of one of the installs as the master boot but this way the boot capability isn't tied to any one install. I call this partition /gboot.

Here is the layout. I have 1.5 Gig physical ram and two hard drives. They are both ide but it works just fine with sata too. To hold down on confusion, I will refer to partitions with the convention sdxx since thats the way most distros do now. I will refer to them as (hdx,x) when talking about grub.

Note: Edited grub notation to make it consistent with actual commands needed.

sda - Boot drive

sda1 - 300 MB - /gboot - ext2
sda2 - 1 Gig - swap
sda3 - 14 Gig - / - Mint 4 KDE - ext3
sda5 - 14 Gig - / - Mint 4 KDE - ext3
sda6 - 14 Gig - / - Kubuntu 7.10 - ext3
sda7 - 14 Gig - / - Sabayon - ext3
sda8 - 14 Gig - / - Sidux - ext3
sda9 - 14 Gig - /home/denise/My_Data - ext3
sda10 - 14 Gig - /home/fred/Backup - ext3

sdb - Slave drive

sdb1 - 1 Gig - swap
sdb2 - 42 Gig - /home/fred/My_Data

I cross mount sda9 on my Mint 4 KDE as /home/fred/Denise
I cross mount sdb2 on her Mint 4 KDE as /home/denise/Fred_Stuff

Ok, let's get to the meat of it. I like the Mint 4 grub so that's what I used. I copied the entire Mint 4 /boot partition to /gboot. You can delete the kernels from /gboot later if you wish. Doesn't help or hurt, as they won't be used anyway.

You need to install grub to the Mint 4 install you just copied the /boot from. In my case I typed:

sudo grub

root (hd0,2)

setup (hd0,2)

quit

You need to copy /etc/grub/message.mint to /gboot/grub/. Edit /gboot/grub/menu.lst and change the gfxboot line to gfxboot=/grub/message.mint . This will give you the nice Mint 4 boot screen.

While you are there you can go ahead and put your chainload lines in the /gboot/grub/menu.lst. They can go either before or after the Automagic kernel section. I put mine in before. You don't need any other boot stanzas that you might already have there, so erase them. Example:

EDIT: 8/1/2009 - The later versions of grub no longer need the "makeactive" line in the chainload stanza for booting Linux. Remove it from the below examples.


# lots of stuff

# gfxmenu=/etc/grub/message.mint

gfxmenu=/grub/message.mint

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
# timeout 10

timeout 15


# Pretty colours
color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

title Mint 4 - KDE CE Denise
root (hd0,2)
makeactive
chainloader +1

title
root

title Mint 4 - KDE CE Fred
root (hd0,4)
makeactive
chainloader +1

title
root

title Kubuntu 7.10
root (hd0,5)
makeactive
chainloader +1

title
root

title Sabayon
root (hd0,6)
makeactive
chainloader +1

title
root

title Sidux
root (hd0,7)
makeactive
chainloader +1

# The reason I use the "makeactive" line is some boot
# systems won't boot without the partition being made
# active. So I always put it in even though it isn't needed
# most of the time.

### BEGIN AUTOMAGIC KERNELS LIST

# lots of stuff!

## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## ## End Default Options ##

# deleted automagic boot stanzas

### END DEBIAN AUTOMAGIC KERNELS LIST

# deleted static boot stanzas




Ok. here comes the fun and mistake prone part. :-)

You must install Mint grub to the mbr of sda pointing to /gboot. In Mint open a terminal:

sudo grub

root (hd0,0)

setup (hd0)

quit

When you install a system, install grub to the partition that /boot is in for that installation. In my case that is the / partition. This can usually be done as part of the install. If not, choose not to install grub anywhere.

In some cases the Mint grub and the new install grub will not cooperate. As an example, Sidux and Kubuntu. When I tried to boot Sidux with this setup it booted fine, no problem. Kubuntu, on the other hand didn't like the Mint Grub. If you have a system that won't boot then you need to install the Mint grub to the partition /boot is in for the problem install. In my case with Kubuntu I did this in a Mint terminal.

sudo grub

root (hd0,5)

setup (hd0,5)

quit

From now on you can change distros without affecting your master boot setup. The only thing you will have to do is change the title line in /gboot/grub/menu.lst to the new distro name. And maybe do the above as I had to do for Kubuntu. Most distros are happy with Mint grub.

For the sake of being more complete, I should add. Edit each distro's /boot/grub/menu.lst and remove the static boot stanzas that appear there to clean up your boot screens some. I also reduce the time given for the default boot. This keeps the overall unattended boot time lower.

# timeout 10

timeout 4

I hope this sheds some light on the chainload issue. Bye-the-way, in case you haven't figured it out, Denise is my lovely bride of 45+ years. :-)

Enjoy,

Fred

EDIT: Don't forget. When you install another distro that formats its' partition on install, you will have to correct the UUIDs in /etc/fstab of all the existing systems that use UUIDs. You may have to do the same in /boot/grub/menu.lst also.
Last edited by Fred on Sat Aug 01, 2009 8:47 am, edited 7 times in total.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: GRUB and MBR questions from a real newbie

Postby Fred on Sun Mar 09, 2008 1:32 am

Look at chainloading like a system of pointers. That is not exactly correct but it simplifies it.

You install grub to the mbr of a bootable storage device. That grub points to a menu, usually located where the kernel you wish to boot is located. You then point to the kernel you wish to boot by selecting it from the menu.

When you chainload you point to another partition to boot. If grub is installed in that partition, it then points to the menu associated with that grub. You then point to the kernel you wish to boot and select it from that menu. You are now off and running.

The setup command tells where to install the bootable grub kernel. The root command tells where the menu associated with that grub kernel is. If you look at it like that it isn't quite as confusing.

Using a separate, independent boot partition and chainloading is a good way to boot an otherwise unbootable storage device like a usb stick or usb removable drive. A lot of BIOSs won't boot usb devices. This is especially handy if you don't have the space on a hard drive with a Windows install to install Linux. You can always free up 300 MB for a /gboot partition and boot Windows and the external drive from there by chainloading.

Fred
Last edited by Fred on Sun Mar 09, 2008 3:20 am, edited 3 times in total.
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: GRUB and MBR questions from a real newbie

Postby muskratmx on Sun Mar 09, 2008 1:45 am

Fred I understand the theroy of chain loading, it's just I've never quit got it to work.

Maybe.....

In some cases the Mint grub and the new install grub will not cooperate. As an example, Sidux and Kubuntu. When I tried to boot Sidux with this setup it booted fine, no problem. Kubuntu, on the other hand didn't like the Mint Grub.


Just maybe that was my issue also, I'll have to try that installing the same exact grub on the problematic partition. I did know and experience grub being quite different from one distro to another. And my understanding is some distros recompile grub to suit themselves much like they recompile the linux kernel. Hence the major differences even though the version number is the same.

Thanks Fred.
User avatar
muskratmx
Level 4
Level 4
 
Posts: 226
Joined: Sun Dec 09, 2007 1:30 pm
Location: TX/MX Gulf Coast

Re: GRUB and MBR questions from a real newbie

Postby Fred on Sun Mar 09, 2008 9:24 am

muskratmx,

You are welcome sir. Glad I could be of service my friend.:-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: GRUB and MBR questions from a real newbie

Postby Fred on Sun Mar 09, 2008 4:01 pm

For those that want a little more depth about how the grub process works, I decided to add this breakdown.

Actually it is pretty interesting.... kinda. :-)

The system is made up of 3 or optionally 4 parts. They work together to boot a main kernel or another bootable kernel or device.

1) Stage one is the kernel. it is very small. It must fit into just over 400 bytes of space. This is the part that is bootable and goes into the mbr of a drive or partition.

2) Stage 1.5 is optional, although almost all the implementations I am familiar with now use a stage 1.5. Stage 1.5 goes in the first few KB of the drive or partition after the mbr. Stage 1.5 is a translation module that knows what kind of file system is in use, where stage 2 and the menu.lst are, and tells the grub kernel how to load stage 2.

Stage 2 then calls the splash or graphic screens and menu.lst, and translates the predetermined options and user's selection into a boot command sequence that is passed on to another bootable kernel. This could be a Linux kernel, another Grub kernel, or just about any other bootable loader. At this point Grub's job is done and it gracefully exits and awaits another command.

Having said that, the only part the user usually sees when everything is working right is the boot screen with the user options. That is why I like to think of it in terms of pointers from kernel to menu to kernel. It just makes it easier for me to keep my small mind wrapped around the concepts. :-)

Fred
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Linux Mint is funded by ads and donations.
 
Previous

Return to Installation & Boot

Who is online

Users browsing this forum: No registered users and 18 guests