Forums.Sureshkumar.net : A Perfect Place to Share Knowledge         Blogs     Games    Magazines    

"Sharing knowledge does not lessen your store, often it gets you more. Sharing plays a key role in relationships and bonding, happens in small steps and is assisted through community membership."

Go Back   SURESHKUMAR.NET FORUMS > TECHNICAL DISCUSSIONS > OTHERS
Register FAQ Members List Calendar Games Blogs Search Today's Posts Mark Forums Read

OTHERS If u have't find related section to place your query .. Please post your query in this section

   

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 09-07-06, 12:29 PM   #1 (permalink)
Senior Member
 
Join Date: Mar 2006
Location: India
Age: 24
Posts: 126
Thanks: 0
Thanked 10 Times in 6 Posts
Thanks: 0
Thanked 10 Times in 6 Posts
Rep Power: 4 abeetha.m has disabled reputation


Booting Process, Boot Sectors,
Partition Tables


The Booting Process


When a PC is powered on, the CPU immediately executes some
code in the ROM BIOS at FFFF:0000. This contains a jump instruction to go to
another location where the BIOS actually starts. The BIOS then performs several
jobs including the POST (Power On Self Test), copying itself into RAM
(shadowing), executing the video BIOS and looking for ROM BIOS extensions in
upper memory. The last thing the BIOS does is look for a boot sector on a disk
in drive A:, if not found, it looks for a master boot record on drive C:. If a
boot sector is found on drive A:, the system boots from that disk, otherwise
the system is booted from the first hard drive (drive C:). (Some BIOSes allow a
different boot sequence to be set). There is a very detailed breakdown of the
booting process in the book Upgrading and Repairing PCs by Scott Mueller. Some
additional details follow.










Boot Sectors and Master Boot
Records


Modern drives (IDE and SCSI) are always physically
formatted at the factory. This physical format (also called or low-level format
or LLF) defines the tracks and sectors which are the basic structure in which
data is stored.


Operating systems must define one or more partitions on a
drive, which are then given a logical (or high-level) format to define a file
system. The partitioning utility used by DOS is called FDISK and the logical
format is performed by the FORMAT command. The names of these programs may vary
with other operating systems.


There is no written "industry standard" as to how
FDISK programs must work, but for the most part they all work about the same,
so that various different operating systems are able to coexist on the same
drive (in different partitions).


The FDISK program (of any operating system) will create a
one-sector (512 bytes) master boot record (MBR) on the first sector (cylinder
0, head 0, sector 1) of any blank hard drive that it partitions. This may also
be called the master boot sector (MBS) or the partition sector or the master
partition sector. The FDISK program could also be used to define additional
partitions on a drive that already has an MBR defined by the same or another
operating system (OS).


The MBR contains a program that finds all of the partitions
listed in its partition table and in any extended partition tables. It then
looks for a partition in the MBR partition table that is marked active and then
loads the boot sector from the active partition. The boot sector in the active
partition contains code that loads the system files on that partition. Once the
system files are loaded, they may in turn load other files, this process varies
with different operating systems. With MS-DOS, IO.SYS loads first and in turn loads
MSDOS.SYS, which then processes CONFIG.SYS and then loads COMMAND.COM, which in
turn processes AUTOEXEC.BAT.


Every partition or volume on the drive contains a boot
sector with bootable code, but only the boot sector on the active partition
will be executed. Since the BIOS looks for the MBR on only the first hard
drive, the system can only be booted from an active partition on the first
drive, even though there may be several other hard drives, which may all
contain MBRs and boot sectors.


In addition to the boot code that loads the system files, a
boot sector contains a table called the Disk Parameter Block (DPB) or Media
Descriptor Table (MDT), which has details on the size of the partition. The
layout of this area may vary from OS to OS.










Partition Tables


The MBR in the first physical sector of a hard drive always
contains a partition table. This partition table (like all partition tables) is
64 bytes long and is followed by a two-byte signature (55AAh), which indicates
the end of the MBR. So the 64-byte partition table and the 2-byte signature
occupies the last 66 bytes of the 512-byte sector. The 2-byte signature is
checked by various programs (such as the boot code, the BIOS, and FDISK
programs) to verify that this is a valid partition sector.


A partition table consists of four 16-byte partition table
entries. It may not matter which of the 4 locations is used by an entry, since
the program in the MBR that searches for partitions on bootup will check all
entries in all partition tables.


There is a standard structure to the partition table entry,
which is followed by most or all operating systems.


The 16 bytes are defined follows:


Byte 1 = boot
indicator (80h - active, 00h - not active)


Byte 2 =
starting head of partition


Bytes 3,4 =
starting cylinder and sector of partition




(10 bits for cylinder, 6 bits
for sector)


Byte 5 =
partition type (also called system flag or system indicator)


Byte 6 = ending
head of partition


Bytes 7,8 =
ending cylinder and sector of partition




(10 bits for cylinder, 6
bits for sector)


Bytes 9,10,11,12
= relative sector offset of partition


Bytes
13,14,15,16 = total number of sectors in partition


The above fields for starting and
ending CHS values yield a limit of 1024 cylinders, 256 heads, and 64 sectors.
This works out to a drive size of about 8.4GB. Since DOS uses these CHS values,
it is limited to 8.4GB hard drives. Windows 95 can access larger drives, since
it uses the last 2 4-byte fields. This also requires a recent BIOS (one that
supports Int 13 Extensions and also correctly reports the size of drives over
8.4GB).


The first byte in the partition table is the indicator for
an active partition. If no partition is set active, the drive will not boot. If
more than one partition in the master partition table is set active, the drive
may not boot and probably an error message such as "Invalid partition
table" will be given. It should not matter if partitions on other drives
are set to active since only the first drive can be booted from.


The fifth byte in the partition table indicates the
partition type. Most operating systems have their own partition type codes to
identify their partitions. Some operating systems use several different types.
There are also various programs that create partitions which they may mark with
their own partition type indicators.


Here is a list of some of the more common partition type
codes:


00 - unused
partition table entry


01 - DOS -
12-bit FAT - Primary partition (less than 16MB)


04 - DOS -
16-bit FAT - Primary partition (16MB - 32MB)


05 - DOS -
Extended partition (12-bit or 16-bit FAT)


06 - DOS -
16-bit FAT - Primary partition (larger than 32MB) (BIGDOS)


07 - HPFS, NTFS,
Unix, others - see partition boot record


0A - OS/2 boot
manager


0B - FAT32 -
Windows 95 OSR2 (WIN95B)


0C - FAT 32 LBA
(requires Extended Int13 support in BIOS) WIN95B


0E - FAT 16 LBA
(requires Extended Int13 support in BIOS) WIN95


0F - FAT 16 LBA
Extended (requires Ext Int13 support in BIOS) WIN95


83 - Linux EXT2


A5 - FreeBSD,
NetBSD, 386BSD


A very complete list of partition
types appears in a document by Hale Landis - Part 2 of the Partition Tables
document in the How It Works Series - see end of this file for more info on
locating this document.


Normally the operating system used to boot a PC, whether
from floppy or hard drive, can see only partitions created by that operating
system. When more than one OS is used a system, the system must be rebooted for
each OS.


One way that different operating systems can be used on the
same drive (or system) is to use a "boot manager". Some operating
systems, such as OS/2, include such a program. System Commander is an example
of a commercially available boot manager program. These programs can work in
various different ways. Some will occupy the MBR, others will be located in
their own partition. It is also possible to just manually change the active
partition in the master partition table. This can be done using FDISK or by
editing the table with DEBUG or some other utility.


Following is a chart to illustrate some of what has been
discussed. This shows a drive that has been partitioned with DOS FDISK into a
primary partition and an extended partition containing 3 logical drives. Also
another partition has been created with a different operating system. Not all
operating systems support extended partitions and each operating system may
handle some of these details differently. The way that DOS handles extended
partitions can be confusing. The terminology used in the DOS FDISK program does
not really match what is actually happening. You can see here that what DOS
FDISK calls logical drives are actually primary partitions and that they are
contained within extended partition "wrappers" which nest inside each
other. The extended partition on this drive contains an extended partition
which contains an extended partition. Each extended partition contains a
primary partition.













Master Partition Table |
Master Boot Sector (MBS)
|




1. PRI DOS |
(also called Master Boot Record or MBR)|




2. EXT DOS |
Cylinder 0, Head 0, Sector 1
|




3. NON-DOS |
|




4. 55AA|
|
























Volume Boot Sector |
Primary DOS Partition
|




DPB 55AA| (contains no partition sector) |















FAT1 | FAT2 | Root DIR |
|















Data Area |
|
























Extended Partition Table | Extended
Partition | Extended |




1. EXT DOS | Sector (or EPBR)
| Partition |




2. PRI DOS | (usually blank except| |




3. | for partition table)| |




4. 55AA| | |













Volume Boot Sector | 1st logical drive in | |




DPB 55AA| DOS EXT partition | |















FAT1 | FAT2 | Root DIR |
partition) | |















Data Area | | |













Extended Partition Table | Extended
Partition | Extended |
|




1. EXT DOS | Sector | Partition |
|




2. PRI DOS | | | |




3. | | | |




4. 55AA| | |
|













Volume Boot Sector | 2nd logical drive in | | |




DPB 55AA| DOS EXT partition |
| |















FAT1 | FAT2 | Root DIR | partition) | | |















Data Area | | | |













Extended Partition Table | Extended
Partition | EXT |
| |




1. PRI DOS | Sector | Partn| |
|




2. | | |
| |




3. | | |
| |




4. 55AA| | |
| |













Volume Boot Sector | 3rd logical drive in | |
| |




DPB 55AA| DOS EXT partition |
| | |















FAT1 | FAT2 | Root DIR |
partition) | |
| |















Data Area | | |
| |
























Volume Boot Sector 55AA|
Non-DOS partition |
















|
|













Notice that all of the partition
sectors and boot sectors end with the 55AAh 2-byte signature. This same
signature is also used to mark the beginning of ROM BIOS extensions in upper
memory. The reason for using this particular value has something to do with the
fact that, in binary terms, it forms a checkerboard pattern - 55 would be
10101010 and AA is 01010101.


The DPB in the DOS boot sectors refers to the Disk Parameter
Block. The Non-DOS boot sector may or may not have a DPB.


The Master Boot Record (MBR) is always on the first sector
on the drive. The boot sectors or partition sectors at the beginning of each
partition are normally located in the first sector on a cylinder/head. So there
may some "slack space" following the MBR. On a drive with 63 sectors
per track, there may be 62 empty sectors following the MBR. This is how MS-DOS
does things, other OSes may differ.











__________________
abeetha
abeetha.m is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +6.5. The time now is 06:14 AM.





Search Engine Optimization by vBSEO 3.1.0