LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-11-2005, 11:31 AM   #1
mohit_garg
Member
 
Registered: Jul 2005
Location: india
Distribution: redhat, bsd
Posts: 34

Rep: Reputation: 15
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!
 
Old 07-11-2005, 11:55 AM   #2
jeffreybluml
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: Fedora Core 1, Mandrake 10
Posts: 405

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

Simple enough...
 
Old 07-11-2005, 11:57 AM   #3
tuxrules
Senior Member
 
Registered: Jun 2004
Location: Chicago
Distribution: Slackware64 -current
Posts: 1,144

Rep: Reputation: 56
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!
 
Old 07-11-2005, 12:07 PM   #4
mohit_garg
Member
 
Registered: Jul 2005
Location: india
Distribution: redhat, bsd
Posts: 34

Original Poster
Rep: Reputation: 15
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 ntdetect.com?
 
Old 07-11-2005, 12:10 PM   #5
cuiq
Member
 
Registered: Aug 2004
Location: Philly
Distribution: Debian Lenny, FreeBSD
Posts: 577

Rep: Reputation: 30
Forgive me,

I don't quite understand what you are asking.

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

Or

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

thanks

Last edited by cuiq; 07-11-2005 at 12:12 PM.
 
Old 07-11-2005, 12:14 PM   #6
Psibur
LQ Newbie
 
Registered: Jul 2004
Location: . <-- You Are Here
Distribution: Slackware 2.4.30
Posts: 20

Rep: Reputation: 0
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.
 
Old 07-11-2005, 12:21 PM   #7
jeffreybluml
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: Fedora Core 1, Mandrake 10
Posts: 405

Rep: Reputation: 30
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...
 
Old 07-11-2005, 12:23 PM   #8
mohit_garg
Member
 
Registered: Jul 2005
Location: india
Distribution: redhat, bsd
Posts: 34

Original Poster
Rep: Reputation: 15
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:

http://www.tburke.net/info/ntldr/ntl...king_guide.htm
i dont know much about windows boot sequence!
 
Old 07-11-2005, 12:26 PM   #9
mohit_garg
Member
 
Registered: Jul 2005
Location: india
Distribution: redhat, bsd
Posts: 34

Original Poster
Rep: Reputation: 15
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!
 
Old 07-11-2005, 12:26 PM   #10
jeffreybluml
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: Fedora Core 1, Mandrake 10
Posts: 405

Rep: Reputation: 30
Read this...

http://www.redhat.com/docs/manuals/l...e/ch-grub.html

I know it's old, but still somewhat informative...
 
Old 07-11-2005, 12:28 PM   #11
cuiq
Member
 
Registered: Aug 2004
Location: Philly
Distribution: Debian Lenny, FreeBSD
Posts: 577

Rep: Reputation: 30
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
#boot=/dev/hda
default=0
timeout=10
title Vidalinux Desktop OS (2.6.8.1-vidalinux_r2)
root (hd0,1)
kernel /boot/vmlinuz-2.6.8.1-vidalinux_r2 root=/dev/ram0 init=/linuxrc
initrd /boot/initrd-2.6.8.1-vidalinux_r2.img

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)
makeactive
chainloader +1

---------------------------------------------------
The above example is if you have two hard drives.

This is if you only have one:

--------------------------------------------------

title Windows
rootnoverify (hd0,4)
makeactive
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
/boot/grub/grub.config

For more detailed instructions you can check out:

http://vidalinux.net/wiki/index.php/Grub

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

Hope this helps

Last edited by cuiq; 07-11-2005 at 12:29 PM.
 
Old 07-11-2005, 12:35 PM   #12
mohit_garg
Member
 
Registered: Jul 2005
Location: india
Distribution: redhat, bsd
Posts: 34

Original Poster
Rep: Reputation: 15
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!
 
Old 07-11-2005, 12:38 PM   #13
cuiq
Member
 
Registered: Aug 2004
Location: Philly
Distribution: Debian Lenny, FreeBSD
Posts: 577

Rep: Reputation: 30
The following is from the Grub Manual:

----------------------------------------------------
Overview

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

1.

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: http://home.freeuk.net/foxy2k/disk/disk3.htm

------------------------------------------------------

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.
 
Old 07-11-2005, 12:50 PM   #14
cuiq
Member
 
Registered: Aug 2004
Location: Philly
Distribution: Debian Lenny, FreeBSD
Posts: 577

Rep: Reputation: 30
You might also find better info in the grub manual @

http://www.gnu.org/software/grub/manual

-----------------------------------------------------

I apologize if my answers were not helpful.
 
Old 07-11-2005, 12:56 PM   #15
mohit_garg
Member
 
Registered: Jul 2005
Location: india
Distribution: redhat, bsd
Posts: 34

Original Poster
Rep: Reputation: 15
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 ntdetect.com 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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script that checks for existence of files Rotwang Linux - General 3 12-02-2005 02:11 PM
Device existence problem..... roshu Mandriva 2 02-07-2005 06:01 AM
Scanner's temporal existence phantompgr Fedora 0 10-14-2004 06:51 PM
Why grub prompt after installing Grub inder Debian woody 3.0r2? velan Debian 1 04-20-2004 04:55 AM
check for existence of file j-me Linux - Newbie 5 07-29-2003 07:58 AM


All times are GMT -5. The time now is 04:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration