LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-09-2009, 02:38 AM   #1
janvanha
LQ Newbie
 
Registered: Aug 2009
Posts: 2

Rep: Reputation: 0
Getting better insight in the Master Boot Record


Hello, I'm a Newbie in Linux, although experienced user of Windows.
I'm working with Ubuntu 9.0.4, Vista and XP in multiboot on a PC with two Hard Disks. HDa has Vista and Ubuntu, HDb has XP.
I read that the MBR is on the first record of the HD. My question is ; on which of the two HD's is the MBR to be found in my case? HD0, HD1?
If it is on only one HD, how can it see the partitions on the other HD?
Thanks in advance for any clear explanation.
Janvanha
 
Old 08-09-2009, 03:14 AM   #2
theacerguy
Member
 
Registered: Jan 2009
Location: on my pc!
Distribution: openSUSE 11.2 opensolaris 2009.06
Posts: 218
Blog Entries: 7

Rep: Reputation: 32
well you have ubuntu on the first hdd which i presume you are using grub which /dev/hda2 would be hd(0,1) for grub and xp would be /dev/hdb1 and hd(1,0) in grub but ubuntu will be the mbr meaning grub is in the mbr and i assume vista was the first partition making it /dev/hda1 and hd(0,0) in grub but grub isnt always in the mbr sometimes in /boot/ which is common so it might not be in the mbr it may be longhorn (win bootloader) but that is inactive but still there

Last edited by theacerguy; 08-09-2009 at 03:14 AM. Reason: typo
 
Old 08-09-2009, 04:33 AM   #3
ronlau9
Senior Member
 
Registered: Dec 2007
Location: In front of my LINUX OR MAC BOX
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Posts: 2,369

Rep: Reputation: Disabled
Quote:
Originally Posted by janvanha View Post
Hello, I'm a Newbie in Linux, although experienced user of Windows.
I'm working with Ubuntu 9.0.4, Vista and XP in multiboot on a PC with two Hard Disks. HDa has Vista and Ubuntu, HDb has XP.
I read that the MBR is on the first record of the HD. My question is ; on which of the two HD's is the MBR to be found in my case? HD0, HD1?
If it is on only one HD, how can it see the partitions on the other HD?
Thanks in advance for any clear explanation.
Janvanha
Most linux distros write GRUB in MBR of SDA .
But you can decide where to write GRUB .
Just imagine that you can boot up from all you're HD drive and you're prepare to change the boot order of you're HD in the BIOS you can decided
to let you're windows MBR untouched and write GRUB on the MBR of a other drive
You even can decide to write GRUB on the boot partition of SDA1 being the
second partition of SDA , but in this case you need a other boot loader to boot the OS
 
Old 08-09-2009, 05:24 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
The MBR is defined as the first sector (512 bytes) of the hard drive.

There must be boot code (e.g. GRUB) in the MBR of any device that the BIOS attempts to boot. In the BIOS setup, the boot order is defined. The BIOS will try each device in turn until it finds one that is bootable. In your case--without more information, we can't know which device has GRUB on it.

GRUB knows the available devices from the BIOS. It then refers to its configuration file (/boot/grub/menu.lst) to determine where it will send control.
 
Old 08-11-2009, 11:34 AM   #5
janvanha
LQ Newbie
 
Registered: Aug 2009
Posts: 2

Original Poster
Rep: Reputation: 0
So far I can follow you. But suppose:
1. Win XP is on the sdb, so we will find its bootcode on the bootsector of sdb1
2. and suppose that Vista and Ubuntu are respectiveley on sda1 and sda2.
3. that in the bios sda1 was indicated to start from,
All information about partitions on the sda-device will be easily found.
But what about the information on the sdb-device where XP is on? How and when is this info collected?
(It is needed by Grub in order to compose the different boot options.)
Sorry to bother but this is to improve my understanding.
Thanks in advance
Janvanha
 
Old 08-11-2009, 12:08 PM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
The first sector of each HD has both the root of the partition table and boot code.

Depending on how you use the BIOS during boot, the mbr code on the second hard drive might never get used.

There is also a position for secondary boot code at the beginning of each partition. Windows normally uses that. I'm less sure under what conditions Grub uses that.

A normal Windows MBR just transfers control to the secondary boot code at the start of whichever partition is marked active on the current drive.

The most usual way to chain load Windows from Linux is to configure Grub to transfer control to that same secondary boot code.

So for XP on sdb1 you might tell the bios to directly boot to the mbr on sdb without touching whatever you have in the mbr of sda. Or you might leave the bios always booting to the mbr in sda, which (in your example) loads grub from the /boot/grub directory on sda2, which then chain loads to the secondary boot code on sdb1 never using the boot code in the mbr of sdb.

There are many other ways. I just described the common ones.

Last edited by johnsfine; 08-11-2009 at 12:10 PM.
 
Old 08-13-2009, 01:47 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This is worth a read for general background: http://en.wikipedia.org/wiki/Master_boot_record
 
  


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
master boot record goldeneagle1234 Linux - Newbie 2 11-09-2008 08:58 AM
master boot record help sfr7 Linux - Laptop and Netbook 10 04-25-2004 08:52 AM
Master Boot Record linuxuser05 Linux - General 3 01-11-2004 06:57 PM
master boot record alaios Linux - General 1 04-22-2003 08:41 AM
master boot record dark_light Linux - General 11 07-03-2002 05:21 AM

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

All times are GMT -5. The time now is 03:18 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