john wen said:
What is the meaning of "active partition"?
What is the difference between active partition and boot
partition?
The partition table can only have 4 entries which can designate primary
partitions and/or extended partitions. Only a primary partition can be
given the attribute of "active"; i.e., you cannot make a logical drive
in an extended partition the "active" partition drive. The MBR (master
boot record) only knows how to read the partition table. It doesn't
know how to interrogate logical drives within an extended partition.
The BIOS loads a bootstrap program that loads the MBR into memory. The
MBR then reads the partition table to see which of the primary
partitions is marked with the attribute "active". The MBR then uses the
partitioning information to find sector 0 of the active primary
partition. This is the boot sector for that primary partition. The MBR
then loads the boot program in that boot sector of the active primary
partition and passes control to it to continue the boot process. None
of which has even involved Windows or any operating system at this point
(except that it is possible to replace the MBR with a customized version
for a particular operating system; the MBR normally can read the
partition table only on the same hard drive as where the MBR was read
which is usually the first physical hard drive, but replacement MBR
programs can read the partition tables on other hard drives).
- BIOS loads MBR from first physical hard drive.
- MBR reads partition table on the same hard drive as the MBR.
- MBR looks for a primary partition marked as active. If no primary
partition is marked active, boot stops with error.
- MBR loads the boot sector from the active primary partition.
- Boot sector (program) loads the rest of the OS starter files (the
program in the boot sector may itself be an OS starter file). This is
when the OS starts to load.
________________________________________
And if you want really detailed information:
At the completion of the Power On Self Test (POST), the BIOS bootstrap
routine generates an INT 19. INT 19 is also called when the
Ctrl-Alt-Del keys are pressed. On most systems, Ctrl-Alt-Del causes a
short version of the POST to be executed before INT 19 is called. INT
19 usually tries to read a boot sector from the first floppy drive. If a
boot sector is found on the floppy diskette, that boot sector is read
into memory at location 0000:7C00 and the BIOS checks that the last two
bytes of the sector are a "55 AA" signature. If so, the routine jumps to
memory location 0000:7C00 to execute the boot loader program in charge
of loading and starting the operating system (IO.SYS for MS-DOS/Win9xME
and NTLDR for WindowsNT4/2K). If the last two bytes are not "55 AA", a
BIOS-dependant message such as "Non-bootable disk" or "Non-System" is
issued and the machine halts.
If no boot sector is found on the first floppy drive because it was
formatted as a data-only diskette or there is no diskette in the floppy
drive, INT 19 tries to read the Master Boot Record (MBR) from the first
physical hard drive. The MBR is not part of any partition. Creating,
deleting, and resizing partitions will affect the partition table in the
MBR but not the master boot code in the MBR. If an MBR is found, its
master boot code is read into memory at location 0000:7C00 and INT 19
jumps to memory location 0000:7C00. The master boot code in the MBR will
attempt to locate an active (bootable) primary partition in its
partition table in a simple case. Since the partition table reflects
partitions only on that physical drive, the master boot code can only
load the boot program for an operating system on that same physical
drive. The operating system must be in a primary partition; the master
boot code can only read the partition table to determine the start of
each primary partition; logical drives under an extended partition are
not defined in the partition table in the MBR. The master boot code
will load the operating system in the primary partition marked as
"active".
The MBR is contained in the sector located at cylinder 0, head 0, sector
1 of the hard disk, and is created by a disk utility such as the DOS
FDISK or FIXMBR utility. Each operating system has a program similar to
FDISK that creates a functionally similar MBR. Each sector of a hard
drive contains 512 bytes, and the MBR is no exception. The first
446-bytes of the MBR contains a program, the master boot code, that is
executed each time the hard disk is booted. The rest of the MBR
contains a 2-byte header, and, most importantly, four 16-byte partition
table entries. Each partition table entry within the MBR contains
valuable information about your partitions. The table below illustrates
this:
Start End SectorsBefore # of Sectors
BI H S C SI H S C SB SB SB SB NS NS NS NS
0h 1h 2h 3h 4h 5h 6h 7h 8h 9h Ah Bh Ch Dh Eh Fh
Legend:
BI: Boot Indication.
H: Starting/Ending Head for the partition
S: Starting/Ending Sector for the partition
C: Starting/Ending Cylinder Number
SI: File System Indicator
SB: Number of sectors before the partition
NS: Number of sectors in this partition
The MBR contains information for up to four primary partitions, or three
primary partitions and one extended partition. This is because there are
only four 16-byte partition table entries. There are also other
inherent limitations to the MBR. First, the MBR is written to strictly
adhere to BIOS Int13 calls. This means that the MBR must be contained
within the first 1024 cylinders, 256 heads, and 63 sectors/track (i.e.,
8 GB) of the hard disk. There are other techniques used at the device
level to overcome the BIOS Int13 limitation, but at the MBR level, this
barrier remains. Second, the MBR does not contain any reference to
logical partitions. This is why the operating system's loader program
must be in a primary partition. Microsoft refers to this as the "system
partition" which contains operating system loader file(s). The rest of
the files for the operating system, called the "boot partition", can be
in a different partition or logical drive on the same or different drive
as the system partition. Typically the system and boot partitions are
within the same drive partition.
As noted above for a floppy diskette, it is bootable only if its boots
sector ends with a "55 AA" signature. The same is true for partitions
on hard drives; they are bootable only if their boot sector (the first
sector in their partition) ends with the "55 AA" signature. The
function of the master boot code in the MBR is to load and transfer
control to the boot program in the boot sector of the partition.
However, the boot "sector" for a partition is somewhat of a misnomer;
the boot "sector" can be up to 16 sectors long, so the loader program in
the partition boot sector could be up to 8,192 bytes long. However,
this loader program is not necessarily the loader program for the
operating system. For example, NTLDR for Windows 2000 is 209 KB in size
and would not fit within the partition's boot sector. The boot code in
the partition boot sector identifies what is the operating system loader
program, loads that file, and then transfers execution to it. Whereas
the master boot program is generally operating system independent, the
boot sector of the active primary partition is dependent on both the
operating system and the file system.
The master boot code in the MBR uses its partition table to determine
which primary partition, the active one, is bootable. The partition's
boot sector contains the loader program specific to the operating system
in that partition. So the master boot code in the MBR need not be
operating system specific, and in fact can be replaced by boot managers
and drive overlay programs. The master boot code is critical to
starting the operating system and it always executes and is why it is
also a favorite target for "boot sector" viruses.
References:
http://support.microsoft.com/default.aspx?scid=kb;en-us;114841
http://support.microsoft.com/default.aspx?scid=kb;[LN];140418
http://www.powerquest.com/support/primus/id34.cfm
http://www.pcguide.com
http://www.oberon.ethz.ch/bootstrap.html