[Guide] Operating System Boot Process.

Status
Not open for further replies.

swatkat

Technomancer
:arrow: Hard Disk and Partitions:-

Partitioning is a process of dividing the Hard disk into several chunks, and use any one of the partition to install OS or use two or more partitions to install multiple OSes.
But you can always have one partition, and use up the entire Hard disk space to install a single OS, but this will become data management nightmare for users of large Hard disks.
This is where advantage of partitioning lie!

Now, because of the structure of the Master Boot Record (MBR), you can have only four partitions, and these four partitions are called Primary Partitions.
Again, If we have a large hard disk, we can not have only four primary partitions, hence Extended Partition is introduced. This Extended Partition is not a usable partition by itself, but it’s like a “container” and it is used to hold Logical Drives!
That is this Extended Partition can be subdivided into multiple logical partitions.

In order to boot into a Partition, it must be designated as bootable partition or Active Partition. Active Partition is that partition which is flagged as bootable or which contains OS, this is generally a Primary Partition.


:arrow: Boot Records: Master, Partition, Extended, Logical Extended:-

Master Boot Record (MBR):- MBR is a small 512 bytes partition which is at the first physical sector of the hard disk. The location is denoted as CHS 0,0,1 meaning 0th Cylinder, 0th Head and 1st Sector. MBR contains a small program known as bootstrap program which is responsible for booting into any OSes. MBR also contains a table known as Partition Table.
This Partition Table is a table which lists the available Primary Partitions in the hard disk. So it can have only four entries. This rises another question, what if we have more than four partitions? This is solved by Extended Partition principle. Partition Table considers whole Extended Partition as one Primary partition and lists it in the table!
So a Partition Table can have two possible entries:-
1] up to 4 Primary Partitions
2] up to 3 Primary Partitions and 1 Extended Partition.(Total not exceeding 4)

Partition Boot Sector (PBR):- This is the logical first sector, that is sector at the start of a Primary Partition. This is also 512 byte area, which contains some programs to initialize or run OS files.All Primary Partitions have it’s own PBRs.

Extended Boot Sector (EBR):- This is the logical first sector, that is the sector at the start of the Extended Partition. This EBR contains a Partition Table, which lists the available Logical Partitions inside Extended Partition. That is it contains the Starting addresses of each Logical Partitions.

Logical Extended Boot Sector (LEBR):- This is the logical first sector residing at the start of each Logical Partition. This is similar to PBR for Primary Partitions.



:arrow: Single OS Boot Process:-

Whenever PC is turned ON, BIOS takes the control, and it performs a lot of operations. It checks the Hardware, Ports etc and finally it loads the MBR program into memory (RAM).
Now, MBR takes control of the booting process. Functions of MBR, when there is only one OS is installed in the system are as given below:-
1] The boot process starts by executing code in the first sector of the disk, MBR.

2] The MBR looks over the partition table to find the Active Partition.

3] Control is passed to that partition's boot record (PBR) to continue booting.

4] The PBR locates the system-specific boot files (such as Win98's io.sys or WinXP’s ntoskrnl).

5] Then these boot files continue the process of loading and initializing the rest of the OS.



:arrow: Multiple OS Boot Process:-

Whenever there are multiple OSes, be it multiple Windows or Windows with Linux, then Boot process will be slightly different.
Actually, there can be two different types of Boot Process in multiple OS environment, Microsoft way and Non-Microsoft way (or Third Party Boot Loader way!).

Microsoft way:- Microsoft Master Boot loaders doesn’t recognize other types of OSes like Linux (in default, that is!), hence using Microsoft MBR in the presence of Linux is ruled out.
Consider the case that (this is the general case), there is one Primary partition and some Logical Partitions inside Extended Partition. Now if Win98 is installed in the Primary Partition, and afterwards WinXP is installed in a Logical Partition, then theoretically both OS should have their own Boot Records, i.e PBR for Win98 and LEBR for WinXP, which contain program to boot the respective OS, so that each individual OS can be booted up by the MBR by passing control to respective PBR of the OS as described in previous section.

But this does not happen in Microsoft Boot loader! It does a peculiar thing, that it always considers the current Active Partition as the default System/Boot Partition.
That is Primary Partition in which Win98 was installed is the Active Partition, then when WinXP is installed another partition, instead of writing the code for booting in it's partition, WinXP writes the code in current Active Partition (that is, where Win98 is installed)!
Program responsible for loading the WinXP is ntldr standing for NTLoader. Theoretically, this should be in it’s partition, but this copied to that of Win98.
Then files responsible for Win98 booting is combined into a single file called bootsect.dos and this is also placed in the Win98 partition.
Then, WinXP creates another file called boot.ini which contains the names of Microsoft OSes installed and path for System files of each OS.

After all this prelims, Windows multiboot can be represented as below:-
1] When BIOS hands over control to Microsoft MBR , this program looks into Partition Table for Active Partition.

2] Then it hands over the control to the PBR of Active Partition. In this case, the Active Partition is where Win98 was installed.

3] But Win98 PBR has been altered by WinXP, and it no longer contains Win98 boot program (like io.sys or msdos.sys). But it contains ntldr! Peculiarity is that one OS’s Boot program is in another OS’s Partition!

4]ntldr looks into boot.ini file and finds out the Microsoft OSes installed in the System and displays the option menu.

5] When user slects Win98, the file bootsect.dos (which is in same partition) is executed, and if WinXP is selected, ntoskrnl is executed (which is in another partition!).

The good thing about Microsoft way is that, it’s very easy to configure (you don’t have to configure at all!).
But the bad thing about Microsoft MBR is that, the two OSes are not independent of each other.It is because, that Microsoft MBR always boots into the Active Partion (that is it always boots into Win98 Partition, but executes WinXP program!) and from here other OSes are loaded.
This does not provide flexibility of installing multiple Microsoft OSes in a random order, because here older version of OS should be installed first and then newer versions of OSes should be installed.

This boot process also has two limitations:-
1] There can be only one Real Mode DOS based OSes like Win95/Win98 along with NT based OSes. If you want both Win95, Win98 with any NT based OS, then it’s simply not possible.

2]Microsoft MBR looks for Active Status in Primary Partitions only and not in Logical Partitions. This means, Microsoft OSes should be installed in Primary Partitions only if it should be bootable (For this reason itself, WinXP boot file ntldr is placed in Primary Partition of Win98 instead of it’s own Logical Partition).

But this has led to misconception that only OSes in Primary Partitions can be booted. But by replacing Microsoft MBR by any other sophisticated MBR program which also looks for Active Status in Logical Drives, we can boot into OSes which are in Logical Drives directly. This is where third party Boot Loaders come into picture!


Non-Microsoft way:- Third-party Boot Loader load before the OS, so they are independent of the OS. Therefore, they work fine with all versions of Windows and DOS.
In this system, installing multiple OSes is conceptually simple. First make as many Primary Partitions and Logical Partition as you want. Then set the status of one of the Partition as “Active”, and install on OS. After this set the status of that partition as “Hidden” (or “Inactive” ) and set another Partition as “Active” and install another OS and this can be done for all Partitions. By this older versions of Windows can be installed after the installation of new ones.
Then Third Party Boot Loader reads all Partitions (including Logical Partitions)from the Partition Table and provides with an option of OSes to boot.

The functions of a Third Party Boot Loader can be stated as below:-
1] Displays a list of all OSes present in both Primary and Logical Partitions.

2] When an user selects one OS, Boot Loader makes the Partition of that OS as Active, and passes the control to it.
This step is the most important deviation from Microsoft way, because in Microsoft MBR, the “Active” Partition always remains same and after booting into it, OSes in other (Logical) Partitions are booted.
But here, a Partition is flagged as Active at the time of the selection by the user,by this way, any OS can be booted directly, by toggling it’s Inactive/Active Status when an user selects it.


3] Then, the Boot Sector of the corresponding OS takes control and loads the OS. This Boot Sector may be PBR of a Primary Partition or LEBR of a Logical Extended Partition.

By this way, each OS remains independent of each other. That is, boot programs (ntldr) of WinXP can remain in WinXP’s partition and Win98 boot programs (io.sys, msdos.sys) can remain in it’s partition..
Since Third Party Boot Loaders are independent of OS, they support all type of OSes like Windows, Linux, Unix, BeOS etc.


A good Boot Loader is XOSL, which has a graphical interface and supports upto 24 OSes and it can also boot OSes installed in Logical Partitions.
Download XOSL
 

tuxfan

Technomancer
Good informative post :) Are these your own words? If yes, great work. If no, still great work, but please let us have the source. May be there's some more info there at that place.
 

tuxfan

Technomancer
swatkat said:
it's my work indeed!
Then, hats off to you buddy. GRAND WORK :D

theraven said:
2 brainiacs fighting for it eh ? :D
nice work swat ... as usual :)

Not fighting, just clarifying. Trying to find out how much credit is due for the work to sawtkat :D As it turned out, lots of it is due :)
 

Sourabh

Laptoping
i wod like the guys to check this and temme

swatkat wht is tht forum and u posted there abt 10 days back and so late on digit

very badd !!

whts tht portal abt ??
 
OP
swatkat

swatkat

Technomancer
Sourabh said:
i wod like the guys to check this and temme

swatkat wht is tht forum and u posted there abt 10 days back and so late on digit

very badd !!
whts tht portal abt ??

Sourabh, found it! :wink:
i think you Google'd the Post tilte, and my post in CCSP came in 3rd! i really didnt checked out that!
It is a Computer Security forum. Yea, i posted there some days back, someone there had some doubts about the boot.ini and dual booting stuff!
But, this guide was posted first here.
 

Sourabh

Laptoping
well isnt it a good idea to get more info abt the topic which are posted

everyone has to be more broad minded and use the forum to learn more new things

i read the whole thing in ur post and wanted more info about it

anyways a good Guide

keep them coming
 

nmanikoth

Right off the assembly line
Thanks very much for the useful info for laymen like me!
Can you please guide me how to recover data from my 250 GB SATA drive? Had formatted the OS partitions and re-installed, now the remaining 7 partitions are inaccessible and show the partition names as "Local Disk" with file system as "Raw".
Thanks in advance.
 

Cool Joe

The Black Waltz
^Your boot.ini is damaged or missing.
Follow the steps mentioned here to solve the issue.
-----------------------------------------
Posted again:
-----------------------------------------
And look at the date of the previous post! :p
 
Last edited:

prudhivisekhar

In the zone
really nice info.!!!!!!!!!!!11
-----------------------------------------
Posted again:
-----------------------------------------
Really informative.:smile:
 
Last edited:

Rahim

Married!
The explanation is very lucid. Thanks swatkat.

@Krazy Bluez: The info doesnt become old and unimportant just because the thread is old.
 
Last edited:
Status
Not open for further replies.
Top Bottom