LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-22-2008, 03:50 AM   #1
vedang
Member
 
Registered: May 2006
Posts: 89

Rep: Reputation: 15
Basic question related to MBR and filesystem.


I have a doubt about MBR and partitions.
Please clear my doubts if I am right or wrong. As per my assimption

1. MBR resides at very first sector of the HDD and location of partitiions
start after MBR. MBR is not part of the first partition and MBR is not
located on first sector of the first partition.
2. In case of Single boot of Linux or Dual boot with xp grub stage 1 boot
loader is always on MBR and it locates grub stage 2 boot loader form
/boot partition.


While learning Linux my faculty told that MBR resides in the first sector of the first partition.
And on MBR there is a bootable exe which is not grub and something else.

I think what he is teaching us is wrong.

Please guide me if I am right or wrong.

If possible please provide me detailed info. about it.
 
Old 02-22-2008, 04:12 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
The MBR is the first sector of the hard drive. The MBR contains the partition table (up to 4 partitions only), plus the first part of the bootloader, which tells where to find the rest of the bootloader. If the only OS installed is Windows XP (or some other Windows flavor), the MBR has part of windows ntldr along with the partition table. If the OS is Linux, then the MBR has the partition table plus part of the Linux bootloader (grub, lilo, or some other).

In the case of Linux, the stage 1 of grub tells grub where to find the rest of grub (in /boot directory).

Grub may install stage 1 to the MBR, but it may also be installed elsewhere if the system administrater chooses to use Windows ntldr as the bootloader. In that case, the first sector of the partition may be used in a manner similar to the MBR. That first sector of the partition is called the boot sector.

To understand better, suppose you install a Linux distribution, but you don't want the bootloader in the MBR. During installation, you choose to install grub to the root partition. In that cast the boot sector (the first sector of the partition) comes into play. Grub stage 1 and the partition go into the boot sector, with the rest of grub in /boot directory.

If you choose to install the bootloader to the root of the filesystem, you either need another bootloader in the MBR to boot, or you need a boot floppy or boot cd to boot.
 
Old 02-22-2008, 04:35 AM   #3
vedang
Member
 
Registered: May 2006
Posts: 89

Original Poster
Rep: Reputation: 15
Basic question.

Thanks bigrigdriver.


That means My assumptions are right.



thanks for the information.

One more query.

as MBR contains 446 bytes of boot code 64 bytes of partition table and 2 bytes for magic number.

In this case is the poarititon table on MBR same as actual partition table? though it contains only 4 partitions.

Last edited by vedang; 02-22-2008 at 04:38 AM.
 
Old 02-22-2008, 06:12 AM   #4
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 727

Rep: Reputation: 74
Hi.

The article at http://en.wikipedia.org/wiki/Mbr discusses the variations in MBR formats and uses ... cheers, makyo
 
Old 02-22-2008, 06:32 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
One day some-one (me ???) should go and correct that article.
 
Old 02-22-2008, 06:58 AM   #6
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 727

Rep: Reputation: 74
Hi, syg00.
Quote:
Originally Posted by syg00 View Post
One day some-one (me ???) should go and correct that article.
Perhaps someone has; I see that the article was changed on 2008.02.15.

I often cite articles there because they are accessible to most people. A book like Scott Mueller's Upgrading and Repairing PCs can be useful in situations like this, but is often overkill**2. I certainly agree that Wikipedia is not always 100% correct.

What would be the 3 most important corrections you would make to the MBR article at http://en.wikipedia.org/wiki/Mbr ? ... cheers, makyo
 
Old 02-22-2008, 07:38 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by vedang View Post
One more query.
as MBR contains 446 bytes of boot code 64 bytes of partition table and 2 bytes for magic number.
In this case is the partition table on MBR same as actual partition table? though it contains only 4 partitions.
The MBR contains what could be called the primary partition table. It provides for 4 primary partitions or 3 primaries + 1 extended.

An "extended partition" is really just the beginning of a linked list to one or more partition tables which appear in the "boot sector" of the logical partitions. These partition tables have the same structure as in the MBR, but only two entries are recognized. The first links into the actual partition area, and the second is another extended partition which links to the second logical partition.........etc.
 
Old 02-23-2008, 02:26 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Quote:
Originally Posted by makyo View Post
What would be the 3 most important corrections you would make
Why 3 - or, stated another way, why only 3 ???.
My beef with most of these articles (on the web, not just *pedia) is they are generally very M$oft centric.
Sure (by default) they define the architecture of the "basic" DOS MBR/partition structure, but their brain-dead implementation ain't the "be-all and end-all".
That reference to the Linux use of "disk identity" - really needs to be fixed.
 
Old 02-23-2008, 06:56 AM   #9
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 727

Rep: Reputation: 74
Hi, syg00.
Quote:
Originally Posted by syg00 View Post
Why 3 - or, stated another way, why only 3 ???.
My beef with most of these articles (on the web, not just *pedia) is they are generally very M$oft centric.
Sure (by default) they define the architecture of the "basic" DOS MBR/partition structure, but their brain-dead implementation ain't the "be-all and end-all".
That reference to the Linux use of "disk identity" - really needs to be fixed.
I asked for 3 so that your time wasn't wasted with a laundry list of non-critical items, and to see an indication of how many I'm overlooking that might be crucial.

The MS-centric aspect is not surprising given that 90+% of PCs run MS operating systems. Most Linux systems seem to work with that implementation. My limited experience with others -- BeOS, for example -- exposed me to some alternate possibilities. The article also noted some that allowed more than 4 partitions, which might be of importance, but also encountered far less frequently.

The article mentions some of these other, non-MS formats for the MBR, which was the important aspect I wanted the OP to see.

I don't have the knowledge to criticize the section on signatures. The gloss in the LKML message emphasizes the use by installers. Given the level of information in the Wikipedia article, what would you change in the reference to Linux:
Quote:
Linux uses the NT disk signature at boot time to determine the location of the boot volume.[10]
Thanks for your time ... cheers, makyo
 
  


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
Filesystem-Related Kernel Panic Arg0nyX Linux - Kernel 2 07-04-2007 04:28 PM
How to Remove MBR from /dev/cciss/ filesystem ahpin Linux - Server 7 06-24-2007 12:08 AM
basic ncurses doubt .. related to raw() and cbreak() ... tuxfood Programming 2 08-28-2004 12:15 PM
lilo uninstallation query (not MBR related) thenerdgod Linux - General 1 11-25-2003 11:18 AM


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