-   Linux - Newbie (
-   -   how does grub knows about existence of other OS? (

mohit_garg 07-11-2005 12:31 PM

how does grub knows about existence of other OS?
i ve been asking this question in many lugs but not getting a sharp answer. Most of the answers were apprehensive and abstract!

jeffreybluml 07-11-2005 12:55 PM

Grub has to be explicityly TOLD about the existence of other OS's, by way of the file /boot/grub/grub.conf

Simple enough...

tuxrules 07-11-2005 12:57 PM

I don't know what kind of abstract answers you got but AFAIK grub only reads the partition table to keep itself aware of the geometry. However, its entirely upto the config file and the user to setup the correct kernel and root paths in order to boot a particular OS.

But my answer can be just as abstract and downright wrong! :D

mohit_garg 07-11-2005 01:07 PM

i want to know that if windows is already there, what make grub to know its there?
i think in patition table, info about the OS is not there. does it have anything to do with active partitions or windows boot files like boot.ini, ntldr, or

cuiq 07-11-2005 01:10 PM

Forgive me,

I don't quite understand what you are asking.

Do you want to know how to get grub to recognize another OS?


Do you want this information just to understand how grub works in general?

Please explain?

NOTE: Please disregard this post. You answered my question above


Psibur 07-11-2005 01:14 PM

I'm pretty sure mohit_garg is asking what exactly grub looks for to tell it "Hey, this is an NTFS partition, it's this big, etc..."

I actually would like to know this myself, more out of curiosity than anything.

jeffreybluml 07-11-2005 01:21 PM

It appears that Grub reads the MBR (master boot record, first few sectors (right?) on hard drive) first upon install. This is where the info regarding any installed OS will be, as this is where the BIOS checks first to see where to boot from.

So, I can imagine this is the ONLY place a fresh grub install could possibly find the needed info.

Then again, I'm no expert...perhaps one of the gurus will chime in and confirm/deny...

mohit_garg 07-11-2005 01:23 PM

i wanna know the functionality of grub? what process and checks are made by grub at the time of installation of grub.
what happens is that if windows is not there grub doesn't show its entry at the boot time and vice versa, what information do grub uses at its installation to know that windows is there or not?
i read the following page and got confused reading it:
i dont know much about windows boot sequence!

mohit_garg 07-11-2005 01:26 PM

i ll be thankful if someone explain me in brief the the role of MBR, boot sectors and active partitions at the system boot up!

jeffreybluml 07-11-2005 01:26 PM

Read this...

I know it's old, but still somewhat informative...

cuiq 07-11-2005 01:28 PM

If Grub did not detect your Windows partition then you have to tell grub where it is.

Here is an example of menu.list:


# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
title Vidalinux Desktop OS (
root (hd0,1)
kernel /boot/vmlinuz- root=/dev/ram0 init=/linuxrc
initrd /boot/initrd-

title Slackware
root (hd1,0)
kernel /boot/vmlinuz-ide-2.4.26 root=/dev/hda3

title Windows
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,3)
chainloader +1

The above example is if you have two hard drives.

This is if you only have one:


title Windows
rootnoverify (hd0,4)
chainloader +1

Just add one of these two options to your grub config. file (depending on your hard drive setup i.e. two drives or one drive).

You can find the grub config file in

For more detailed instructions you can check out:

This is just one site there are many, many more.

Hope this helps

mohit_garg 07-11-2005 01:35 PM

cuiq. i got ur answer, and im well aware that i need to make entry myself to boot any other OS, but my question deals with fresh installation of grub?
i m sure some kind a check is made at that time!

cuiq 07-11-2005 01:38 PM

The following is from the Grub Manual:


Briefly, a boot loader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to an operating system kernel software (such as Linux or GNU Mach). The kernel, in turn, initializes the rest of the operating system (e.g. a GNU system).

GNU GRUB is a very powerful boot loader, which can load a wide variety of free operating systems, as well as proprietary operating systems with chain-loading1. GRUB is designed to address the complexity of booting a personal computer; both the program and this manual are tightly bound to that computer platform, although porting to other platforms may be addressed in the future.

One of the important features in GRUB is flexibility; GRUB understands file systems and kernel executable formats, so you can load an arbitrary operating system the way you like, without recording the physical position of your kernel on the disk. Thus you can load the kernel just by specifying its file name and the drive and partition where the kernel resides.

When booting with GRUB, you can use either a command-line interface (see Command-line interface), or a menu interface (see Menu interface). Using the command-line interface, you type the drive specification and file name of the kernel manually. In the menu interface, you just select an OS using the arrow keys. The menu is based on a configuration file which you prepare beforehand (see Configuration). While in the menu, you can switch to the command-line mode, and vice-versa. You can even edit menu entries before using them.

In the following chapters, you will learn how to specify a drive, a partition, and a file name (see Naming convention) to GRUB, how to install GRUB on your drive (see Installation), and how to boot your OSes (see Booting), step by step.

Besides the GRUB boot loader itself, there is a grub shell grub (see Invoking the grub shell) which can be run when you are in your operating system. It emulates the boot loader and can be used for installing the boot loader.


chain-load is the mechanism for loading unsupported operating systems by loading another boot loader. It is typically used for loading DOS or Windows.


The following is from:


The boot sector (also called the boot record) is the very first sector on a disk it has two important functions, the first one is to load in your operating system (I'm going to ignore that since it's not relevant for this) and secondly it tells us all kinds of useful(?) information about the disk that its on. A FAT32 boot sector is actually more than one sector long, three to be precise, so I don't see how it can accurately be called a boot sector, the boot record is probably a more accurate term.

Two important things that are stored in the boot sector are the size of each sector (analogous to size of each piece of paper in a notepad), usually 512 bytes (characters in layman's terms) and the total number of sectors (how many bits of paper). With this information we can tell how much data the disk will hold.
For instance a 1.44MB 3 1/2" disk has 2,880 sectors, with 512 bytes in each sector. There are 1024 bytes in a kilobyte and 1024 kilobytes in a megabyte byte, so 2880 sectors multiplied by 512 bytes means 1440KB or 1.406MB. Now as you may know these disks do not store 1.406MB of data, the maximum you can get is 1.38MB the remaining space is used for the file system.

The boot sector also supplies information on where to find the FAT's and root directory, you'll find out what these are later if you don't already know. Other information that the boot sector holds include:

* The name of the operating system that formatted it.
* Sectors per cluster, you'll find out about this when you get to the data area section.
* The maximum number of root directory entries you can have for the disk (this is explained later).
* The volume name, this is what is displayed when you type "VOL" at a DOS prompt or what is shown in "My Computer" for Windows users. (the volume name can also be stored in the root directory.)
* The serial number.

The boot sector is vital to be able to read the disk if this goes the operating system will not know what type/size disk it is dealing with, because of this fact the FAT32 file system stores a copy of the boot sector.
That's it for the none technical area so go on to the next section if you don't want in depth technical details if you do then keep reading.


Hope this will answer some of your questions.

cuiq 07-11-2005 01:50 PM

You might also find better info in the grub manual @


I apologize if my answers were not helpful.

mohit_garg 07-11-2005 01:56 PM

thanx buddy, i think i got enough food for thaught.
ok besides grub, in absence of linux, i.e. only windows are there, the control goes directly to ntldr, which shows all the listed windows versions. as i know each windows partition keeps its own set of ntldr, boot.ini and files. who decides which ntldr to be called?
i know the ques is not relevant to linux, but if u know and answer , will be a gift for me!

All times are GMT -5. The time now is 10:41 AM.