LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-09-2006, 09:52 AM   #1
arunka
Member
 
Registered: Mar 2005
Posts: 60

Rep: Reputation: 15
Boot loader


HI all
can anyone let me know how does the boot loader will come to know whether the disk already contains one more operating system installed?

Regards
Arun
 
Old 06-09-2006, 10:47 AM   #2
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
The short answer is it doesn't.

The long answer is Grub can find it out.

The major difference betwee a MS system boot loader (no name ) and the Linux boot loaders (Grub or Lilo) is the former has no target to boot .

MS system MBR is like a blind person searching a OS for booting. It does so by examining each of the 4 primary partitions in the bootable hard disk to see if any one has the boot flag switched on and proceed to boot it when the first one is found. In all partitioning programs of MS and Linux systems when a primary partition boot flag is switched on the other one will be automatically switched off and so there can never be more than one active primary partition.

Linux's Grub and Lilo do not use the boot flag at all. The partition to be booted in "always" declared up front. In Grub it is by
Code:
root (hd1,2)
in Lilo it is by
Code:
root=/dev/hdb3
As Grub counts from 0 and so hdb3, being the 3rd partition of the 2nd hard disk will be known as (hd1,2) in Grub. This "declare the boot partition first" feature is the key to why Linux can boot from either primary or logical partition while a "standard" MS system can only cope with the former.

Ulike Grub which refers to all bootable partitions by the same root statement Lilo uses
Code:
other=/dev/hdb1
for non-Linux partitions or any partition that it has to boot by chainloading (A Lilo can chainload a fellow Linux too)

Grub is slightly more powerful than Lilo in that it can operate without an OS attached to and acts as a mini OS in its own right. Grub has a rich set of commands, available at any Grub prompt (when booted without a OS) or at a Grub shell (after booted to a Linux) that can interrogate the hard disks, display any of the text files (like /boot/grub/menu.lst or /etc/lilo.conf) and restore the boot loader.

In a Grub prompt if any of the partitions, say (hd2,10) has a boot loader inside it can be booted up by Grub manually by these lines
Code:
root (hd2,10)
chainloader +1
boot
Therefore Linux boot loader Grub can find out any bootable partition just by trial and error.

Think I may have given away a Howto to hack any PC.
 
Old 06-09-2006, 01:41 PM   #3
arunka
Member
 
Registered: Mar 2005
Posts: 60

Original Poster
Rep: Reputation: 15
HI
Thanks for the reply..
But my question was , while installing the Linux , once we start configuring/Installng boot loder , how will it recognises that already one OS is installed on the disk??

Arun
 
Old 06-09-2006, 03:27 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
The bootloader will not detect a different operating system (that's not its job). Depending on what distro you intend to install, it might recognize other operating systems and automatically configure the bootloader for them. It depends on how user-friendly your distro strives to be.

Again, the job of the bootloader is only to do what it's told. Grub's `root' command is able to validate linux (and BSD?) kernels on some types of partitions. For other things (Windows, Plan9, etc.) Grub should be told to `chainload' that operating system (sometimes, it should be told first to lie to the operating system it's chainloading).
 
Old 06-10-2006, 05:24 PM   #5
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
It is the "duty" of every Linux installer to check every partition and include it for booting if a boot loader is found inside!!!. MS system always has a boot loader at the boot sector of the begining of the partition and so you need to point a gun at the installer's head to stop from booting it.

The partition id known to the installer/boot loader and that is why the installer can labelled it as a Windows but could not determine if it is a Win2k or XP even its partition id is 7 indicating a NTFS partition.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wireless Keyboard not working to select boot options (Grub boot loader) psrini_vasan Fedora 7 12-16-2009 05:45 PM
To load/boot Red Hat Enterprise Linux 4 WS from Microsoft's Boot Loader (NTLDR) dhawal Red Hat 1 09-25-2005 07:08 AM
To load/boot Red Hat Enterprise Linux 4 WS from Microsoft's Boot Loader (NTLDR) dhawal Linux - General 1 09-25-2005 07:07 AM
Grub boot loader menu shows two linux boot options pramos Linux - Newbie 3 09-12-2004 11:40 PM
How to add a boot record which used to startup windows under my Grub boot loader? yunxiang Linux - Newbie 6 02-01-2003 02:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:29 AM.

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
Open Source Consulting | Domain Registration