LINUX Boot Process


Linux boot process includes 3 stages:
1. The BIOS Stage
2. The bootloader Stage
3. The Kernel Stage


The BIOS Stage
The Linux boot process starts with the BIOS stage. The basic input/output system, BIOS is a small memory module on the motherboard. It's used during the boot process to initialize a system's hardware components.
The BIOS uses the information stored in the C MOS chip - another memory module on the motherboard that contains information about the system's hardware configuration.

During the boot process, the BIOS tests that all the hardware components on the motherboard are working. This is known as the power-on self-test (POST).


After performing the POST, the BIOS locates the drive or disk from which the OS must be booted. Typically it is configured to attempt to boot from a sequence of different devices in a certain order - so if the first listed device isn't available or doesn't work, the next one can be used. For a drive to be bootable, it must have a Master Boot Record (MBR) in it's first sector which is known as the boot sector. You need to format a disk to add an MBR to it's boot sector. You can also configure a system's hard disk as the primary boot disk and an optical drive as a secondary boot disk. This ensures that you can boot the OS from a removable disk if the main hard disk fails and the computer won't boot normally.

Bootloader Stage
After the BIOS stage, the bootloader stage involves loading two types of pre-cursor software into memory. The first pre-cursor software that's loaded during the bootloader stage provides enough information for the OS to be loaded into memory. The bootloader is usually found in the MBR of the boot disk. After the bootloader is loaded, the CPU can access the disk and memory(RAM). The other pre-cursor software that's loaded during the bootloader stage is an image of a temporary virtual file system called the initrd image or initial RAMdisk. This prepares the system so that the actual root file system can be mounted. It performs steps such as detecting the device that contains the file system and loading required modules. At the end of the bootloader stage, the bootloader loads the kernel into memory.

The Kernel Stage
In the kernel stage, the virtual root file system created by the initrd image runs the Linuxrc program. This program prepares the real file system for the kernel and then dismounts the initrd image.

The Kernel checks for new hardware and loads any required device drivers. If then mounts the actual root file system. Finally, it runs the init process.

The init process uses the parameters in the /etc/inittab file to load the rest of the system daemons. Once this process finishes, you can log in and use the system.

The most common bootloaders for Linux are LILO(Linux Loader) and GRUB (Grand Unified Bootloader). Both these bootloaders enable you to choose which OS kernel to load during boot time.

Storage Devices


Floppy Disks
Solid State Drives or SSDs
Optical Storage Devices
Flash Drives
Hard Disk Drives

Floppy Disks

A floppy disk consists of a thin, oxide-coated magnetic disk that's protected within a hard, plastic shell. They are largely obsolete. They can store a maximum of 1.44 MB per 3.5" disk and have slow data transfer rates.

They are also vulnerable to damage due to environment conditions such as heat and condensation.


SSDs

It uses integrated circuits to store data. It can be used in place of a hard drive. Like a hard drive it uses SATA(Serial Advanced Technology Attachment) interface and block I/O operations

An advantage of SSD over a hard drive is that it doesn't contain any moving parts. This reduces noise and the potential for damage through wear and tear.

It uses non-volatile memory chips that don't lose data when a system's power is off. This technology makes the SSD faster and more energy efficient but more expensive than hard disk.

Optical Storage Devices

CDs, DVDs are examples of Optical Storage Devices.

CDs and DVDs store data in lands and pits. The lands represent 1 and the pits represent 0 in binary computing. The coputer transforms the binary or digital data into user friendly format.

CDs are 1220 mm in diameter and are 1.2 mm thick. They can store up to 700 MB of data/74 minutes of audio content.
Single sided DVD can store up to 4.7 GB of data/120 minutes of audio content. Dual later can store approximately twice the amount of data as single sided DVDs.

Flash Drives

Small, portable, external storage devices that can store a large amount of data. It uses a flash memory chip which does not depend on electric current to retain data.

Hard Disk Drive

A hard disk drive is a computer's main storage device. It consists of multiple platters coated with a magnetic surface material. The drive reads information from these platters and writes information to them.

The speed at which theplatters spin determines how fast the disk reads and writes information. Modern disk speeds range from 4,200 RPM for low power portable drives to 15,000 RPM for high end server-based drives.

3 Types of Hard drives

IDE (Integrated Drive Electronics)
SATA (Serial Advanced Technology Attachment)
SCSI (Small Computer System Interface)


IDE (Integrated Drive Electronics)

A 40-pin, 80-wire ribbon cable connects an IDE drive and other devices to the IDE interface on a computer's motherboard.

Most motherboards with an integrated IDE controller include 2 IDE channels: Primary and Secondary. You can install a master drive and a slave drive on each. Slave drive provide extra storage space or serve as a backup drive.

By default, the master drive on the primary channel is used as the boot drive however you can change this using the CMOS setup program.

You cannot have more than 1 master or slave drives on the same channel.


SATA (Serial Advanced Technology Attachment)

They use a point-to-point connection topology, so that each SATA drive has it's own hard disk channel and bandwidth isn't shared between different devices or controllers. This makes SATA drives faster than IDE drives.

SATA bus uses 2 channels, one for transmitting dataserially bit by bit and another for conforming the reciept of data to the sender.


SCSI (Small Computer System Interface)


External SCSI hard drives connect in a communication chain. Rather than connecting each drive directly to the controller, only the first device connects to the controller and the subsequent SCSI devices connects to the one before it. Using many parallel drives is a benefit of SCSI as it provides constant and reliable access.

The controller has 2 connectors. An internal connector that connects all devices inside a server with a ribbon cable and an external connector connects all external devices to the controller.

Each device in the chain has a unique ID. The SCSI controller uses this ID to send data to the appropriate device. Early controllers supports upto 7 devices plus the controller with IDs 0 to 7. Modern ones supports upto 15 devices plus the controller with IDs 0 to 15. The higher a device's SCSI ID, the higher it's priority.