LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-16-2005, 09:01 PM   #1
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Boot sector in multiple partitions


This came up in at least two recent threads, but never got totally resolved.

I have understood that a hard disk has 63 sectors set aside for boot code, partition tables, and ??. The boot loader goes in the first sector. If there are four partitions, then those partition tables are also in the first sector. More than four, and partition tables will be found in the second sector--and maybe beyond??

If there is a "boot sector" elsewhere on the disk---in an extended partition, etc. then where exactly is it and what is it for?
 
Old 12-17-2005, 12:50 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,894

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Don't quote me on this. But I'll give you my understanding of how it works.

The MBR (boot sector) is the first sector of the disk; 512 bytes in size. It can hold information about 4 partitions, that's all. That can be 4 primary bootable partitions, or two primary and two extended partitions (if you have two disks), or some combination the primary and extended.

However, extended partitions can be sub-partitioned into something like 15 more partitions (I could be wrong about the number). The boot sector still points to only two primary and two extended partitions (or however you have it set up).

Within the extended partitions, each partition can have a complete distro, assuming the partitions are large enough. The bootloader of each OS is installed to the partition; not the MBR. Only one distro serves as the Master Bootloader (the one written to the MBR). It's config file points to the locations of the other OS roots, and the location of each OSs compressed kernel image.

So, only one boot sector on the disk, but more that 4 partitions with installed distros.

Last edited by bigrigdriver; 12-17-2005 at 12:53 AM.
 
Old 12-17-2005, 02:24 AM   #3
b0nd
Senior Member
 
Registered: Jan 2005
Distribution: Slackware, BackTrack, Windows XP
Posts: 1,020

Rep: Reputation: 45
Hello bigrigdriver,

your concept seems to be right.

regards
 
Old 12-18-2005, 01:04 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,515
Blog Entries: 4

Rep: Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955
The Master Boot Record (MBR) is like what an old mainframer would call a Volume Table of Contents (VTOC). It is a label of sorts, on the front of a disk-volume, that describes what is in it, including (in this case) the primary partition structure.

Since the MBR contains only four partition-slots, if you need more than four partitions you do so by declaring the fourth to be an extended partition, which means that it contains an extension partition-table.

The MBR also contains the bootstrap-program that is executed by the BIOS when you turn-on the computer. The bootstrap program, in turn, locates and starts the boot loader, such as Grub or Lilo or NTLDR.EXE, that actually initializes the operating system of choice.

There is only one MBR per disk-volume.
 
Old 12-18-2005, 02:13 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,157

Rep: Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875
BTW an IDE drive can be divided into 64 partitions and a SCSI drive into 16 partitions. Any primary partition can be designated as an extended partition.

There is a boot sector for each partition in addtion to the MBR. Its use is determined by the OS filesystem. The FAT boot sector is described by MS http://support.microsoft.com/kb/q140418/

linux uses the the partition boot sector for boot loader stages.
http://www.bglug.ca/articles/linux_boot_process.html

Last edited by michaelk; 12-18-2005 at 02:15 PM.
 
Old 12-18-2005, 08:25 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Original Poster
Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by michaelk
There is a boot sector for each partition in addtion to the MBR. Its use is determined by the OS filesystem. The FAT boot sector is described by MS http://support.microsoft.com/kb/q140418/
This takes us back to the original question---where are the other boot sectors? Somewhere in the first 63 sectors? ( I not see this area as being part of any partition---since a look at raw data in the partition table typically shows the first partition starting at sector 63)
 
Old 12-18-2005, 09:29 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,157

Rep: Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875
The first sector of a partition is the boot sector.

http://www.ata-atapi.com/hiwtab.htm

Last edited by michaelk; 12-18-2005 at 09:36 PM.
 
Old 12-19-2005, 06:35 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Original Poster
Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by michaelk
The first sector of a partition is the boot sector.

http://www.ata-atapi.com/hiwtab.htm
My read of that article tells me that the mbr is in the first sector of the hd--regardless of the number of partitions. He also describes "partition sectors" which contain the partition tables.

I did not find language that says each **partition** has a boot sector.
 
Old 12-19-2005, 09:34 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,157

Rep: Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875Reputation: 1875
I do not know if I fully understand it myself....
The first sector of the hard drive is the MBR. Enough said.
The first sector of a partition is the boot sector.

In the windows world.
http://support.microsoft.com/?kbid=114841
Quote:
The Master Boot Record contains the partition table and a small amount of executable code. The executable code examines the partition table and identifies the active (or bootable) partition. The Master Boot Record then finds the active partition's starting location on the disk and loads an image of its first sector, called the Boot Sector, into memory. The Master Boot Record then transfers execution to that Boot Sector image.

Whereas the Master Boot Record is generally operating system independent, the Boot Sector of the active partition is dependent on both the operating system and the file system. In the case of Windows NT and Windows NT Advanced Server, the Boot Sector is responsible for locating the executable file, NTLDR, which continues the boot process. The only disk services available to the Boot Sector code at this stage of system boot up are provided by the BIOS INT 13 interface. The Boot Sector code must be able to find NTLDR and file system data structures such as the root directory, the File Allocation Table (FAT) in the case of an MS-DOS FAT volume or the Master File Table in the case of an NTFS volume.
In the linux world grub uses the boot sector as in the linked I posted previously.
 
Old 12-19-2005, 07:49 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Original Poster
Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Thank you!!

I need to go back a look at one of my Linux setups nad try to find what you are describing. For example, in one setup, I thought I found grub stage 2 beginning in the 2nd sector---way before the srart of the first partition.....
Confusing to say the least.
 
Old 12-19-2005, 11:31 PM   #11
canaan
LQ Newbie
 
Registered: Dec 2005
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by michaelk
The first sector of a partition is the boot sector.

http://www.ata-atapi.com/hiwtab.htm

I think it is correct that the first sector of Primary Partition and Logical Partition is the boot sector.

But for extended partition, the first sector should be parition table sector, just like the MBR of the whole disk..
 
  


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
Can't configure Lilo to boot multiple Linux partitions SlackwareInAZ Slackware 11 09-10-2005 01:04 PM
what partitions(mount points) can you reuse in a multiple boot linux system? scottk88 Linux - General 5 08-01-2005 11:49 AM
Software related boot problem affecting multiple ext2 partitions sindi Linux - Software 0 11-28-2004 02:29 PM
Boot Sector on dual boot PC. Remove Mandrake and replace with FreeBSD Phin666 *BSD 1 10-30-2004 05:02 PM
No boot sector found, error at boot areeves88 Linux - General 3 01-18-2003 08:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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