is this booting info correct?

Jerry McAllister jerrymc at msu.edu
Thu Dec 17 00:02:17 UTC 2009


On Thu, Dec 17, 2009 at 07:33:58AM +0800, Fbsd1 wrote:

Everything but the last couple of paragraphs are correct.

> Users with Microsoft/Windows knowledge of how a hard drive is configured
> may have a terminology issue with FreeBSD. Microsoft/Windows and FreeBSD
> use the word partition to mean different (but related) things.
> 
> FreeBSD and Microsoft/Windows have primary-partitions, but they call
> them different things. FreeBSD calls the Microsoft/Windows
> primary-partition a slice.
> 
> The number of hard drive primary-partitions/slices is determined by the
> motherboard BIOS (Basic input output system), not the operating system.
> Standard motherboard BIOS limits hard-drives to 4 main divisions
> 
> Each of those are called primary-partitions in Microsoft/Windows
> terminology and slices in FreeBSD terminology.
> 
> Each primary-partition/slice can be sub-divided into smaller chunks. In
> Microsoft/Windows, they are called extended-partitions. They are
> implemented very differently and are not compatible with FreeBSD. In
> FreeBSD the sub-divisions are called partitions.
> 
> Each one of the 4 max primary-partitions/slices can be made bootable.
> The first physical track of the allocated space of each
> primary-partition/slice has an initial sector (512 byte block) that is
> called the boot sector. If it contains boot up code the motherboard BIOS
> considers it to be bootable.

This is the '3rd' level (phase) of the boot process.  The first being 
the BIOS, the second being the MBR and the third being the slice boot
sector.

> 
> Each physical hard drive in the PC has it's own MBR (Master Boot
> Record). The MBR is located in sector-0 of the first physical track on
> the hard drive. The standard MBR in Microsoft/Windows and FreeBSD
> defaults to booting the first primary-partition/slice allocated on the
> first hard drive cabled to the PC.

Each drive has a sector 0.   When you install FreeBSD you can write
an MBR in to that sector 0.   You can also install other (third party)
MBRs in to that sector.

> There are MBR booting programs that you can load into the MBR on the
> first physical cabled hard drive to scan for other bootable
> primary-partitions/slices on this hard drive and any other hard drives
> cabled to the PC. It displays a menu giving you the option to choose
> which one you want to boot from. This gives you the ability to have more
> that one operating system installed on your PC at one time.

The sector isn't the MBR.   The code and table that gets written to
that sector is the MBR.    If you don't want to boot from the drive - 
eg just use it for data, you can ignore that sector and not write any
MBR in to it.

The MBR has a little table in which is marked which slice to
continue the boot with.   The FreeBSD MBR (and some others) sets
that to be the current slice when a boot is done.   So, the last
slice to be booted is always the default boot the next time.  You
can manually change that with fdisk(8).

Some people have wanted to have a fancier MBR than can fit in a
single sector.   Almost all systems nowdays use that 0 sector, but
then just ignore the rest of the track that it is in.  So, there are
several "wasted" sectors following the MBR.   Those people have made
use of that space to install a more elaborate MBR, depending on 
that extra space never being used for anything else - which is a pretty
good bet.  In fact, I don't quite understand why people don't just
go ahead and define the standard so that track is specified as available
for MBR.

The MBR is fairly basic and conforms to a fairly tight but primative
system for finding and initiating boot sectors in slices/primary
partitions.    Because that part is almost all the same across most
systems, most MBRs can boot most OSen on PCs if they want to.  MS does
not seem to want to, but FreeBSD and Linux can.

But, the boot sector in each slice/primary partition is unique to
the OS being booted.   It has a common boot flag setup and a common place
to jump to to begin execution, but the rest is OS specific.

Basically, the BIOS does its thing and looks for an MBR in sector 0 of
the drives in its boot list.   The first one it finds, it loads in
and transfers control to it.   The MBR does a couple checks and looks
for a bootable slice and which is flagged to be the default boot.  It
puts up a simple boot menu allowing you to choose.  If you do not 
respond in time, it goes with the flag setting.  

The MBR then reads in the first (boot) sector of the slice and transfers
control to it.   That sector code knows how to find what it needs to
finish the boot, load the kernel, etc and start up init which gets
everything else going.   

The process has changed in detail, but not much in concept since the
beginning of computer OSen.  The reaason it is called booting is that
especially in the old days, when some parts of the startup were keyed
in by hand, it had the feeling of the system pulling itself up by
its own bootstraps - an old and popular country saying.

Anyway, you were essentially correct, except on some details of
what the sector 0 and slice boot sector contain and how the
default boot slice is determined.

////jerry

> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list