LOS Unit 2-2
LOS Unit 2-2
LOS Unit 2-2
Inodes are numbered sequentially, starting at 0. Inode 0 is reserved for unallocated directory
entries, inode 1 was the inode of the bad block file in historical UNIX versions, followed by the
inode for the root directory, which is always inode 2 and the inode for the lost+found directory
which is inode 3.
Directory files contain only the list of filenames in the directory and the inode associated with
each file. All file metadata is kept in the inode.
ReiserFS
ReiserFS is a general-purpose, journaled computer file system formerly designed and
implemented by a team at Namesys led byHans Reiser. ReiserFS is currently supported on
Linux (without quota support). Introduced in version 2.4.1 of the Linux kernel, it was the first
journaling file system to be included in the standard kernel. ReiserFS is the default file system on
the Elive, Xandros,Linspire, GoboLinux, and Yoper Linux distributions. ReiserFS was the default
file system in Novell's SUSE Linux Enterprise until Novell decided to move to ext3 on October
12, 2006 for future releases.
FeaturesAt the time of its introduction, ReiserFS offered features that had not been
available in existing Linux file systems:
• • Metadata-only journaling (also block journaling, since Linux 2.6.8), its most-publicized
advantage over what was the stock Linux file system at the time, ext2.
• • Online resizing (growth only), with or without an underlying volume manager such as LVM.
Since then, Namesys has also provided tools to resize (both grow and shrink) ReiserFS file
systems offline.
• • Tail packing, a scheme to reduce internal fragmentation. Tail packing, however, can
have a significant performance impact. Reiser4 may have improved this by packing tails where it
does not hurt performance.[5]
POST operation: POST is a processes of checking hardware availability. BIOS will have a list of
all devices which are present in previous system boot. In order to check if a hardware is available
for the present booting or not it will send an electric pulse to each and every device in the list that
it already have. If an electrical pulse is returned from that device it will come to a conclusion the
hardware is working fine and ready for use. If it does not receive a single from a particular device
it will treat that device as faulty or it was removed from the system. If any new hardware is
attached to the system it will do the same operation to find if its available or not. The new list will
be stored in BIOS memory for next boot.
Selecting First Boot Device: Once the POST is completed BIOS will have the list of devices
available. BIOS memory will have the next steps details like what is the first boot device it has to
select etc. It will select the first boot device and gives back the control to Processor(CPU).
Suppose if it does not find first boot device, it will check for next boot device, if not third and so
on. If BIOS do not find any boot device it will alert user stating "No boot device found".
Stage 2: MBR loading
Once the BIOS gives control back to CPU, it will try to load MBR of the first boot device(We
will consider it as HDD). MBR is a small part of Hard Disk with just a size of 512 Bytes, I repeat
its just 512 Bytes. This MBR resides at the starting of HDD or end of HDD depending on
manufacturer.
What is MBR?
MBR(Master Boot recorder) is a location on disk which have details about
• o Primary boot loader code(This is of 446 Bytes)
• o Partition table information(64 Bytes)
• o Magic number(2 Bytes)
Boot Loader
A boot loader, also called a boot manager, is a small program that places the operating
system (OS) of a computer into memory. When a computer is powered-up or restarted, the
basic input/output system (BIOS) performs some initial tests, and then transfers control to
the Master Boot Record (MBR) where the boot loader resides. Most new computers are
shipped with boot loaders for some version of Microsoft Windows or the Mac OS. If a
computer is to be used with Linux, a special boot loader must be installed.
For Linux, the two most common boot loaders are known as LILO (LInux LOader) and
LOADLIN (LOAD LINux). An alternative boot loader, called GRUB (GRand Unified
Bootloader), is used with Red Hat Linux. LILO is the most popular boot loader among
computer users that employ Linux as the main, or only, operating system. The primary
advantage of LILO is the fact that it allows for fast boot-up. LOADLIN is preferred by some
users whose computers have multiple operating systems, and who spend relatively little time
in Linux. LOADLIN is sometimes used as a backup boot loader for Linux in case LILO fails.
GRUB is preferred by many users of Red Hat Linux, because it is the default boot loader for
that distribution.
LILO :
LILO (LInux LOader) is a boot loader for Linux and was the default boot loader for most Linux
distributions in the years after the popularity of loadlin. Today, most distributions use GRUB as
the default boot loader. LILO has been discontinued in December 2015, with a request for
potential developers.
LILO does not depend on a specific file system, and can boot an operating system (e.g., Linux
kernel images) from floppy disks and hard disks. One of up to sixteen different images can be
selected at boot time. Various parameters, such as the root device, can be set independently for
each kernel. LILO can be placed in the master boot record (MBR) or the boot sector of a
partition. In the latter case, the MBR must contain code to load LILO.
The lilo.conf file is typically located at /etc/lilo.conf. Within lilo.conf there are typically two
section types. The first section, which defines the global options, contains parameters which
specify boot location attributes. The second section(s) contain parameters associated with the
operating system images to be loaded.
When LILO loads itself it displays the word “LILO”. Each letter is printed before or after some
specific action. If LILO fails at some point, the letters printed so far can be used to identify the
problem.
(nothing)
No part of LILO has been loaded. LILO either isn't installed or the partition on which its boot
sector is located isn't active. The boot media is incorrect or faulty.
L
The first stage boot loader has been loaded and started, but it can't load the second stage boot
loader. The two-digit error codes indicate the type of problem. This condition usually indicates a
media failure or bad disk parameters in the BIOS.
LI
The first stage boot loader was able to load the second stage boot loader, but has failed to execute
it. This can be caused by bad disk parameters in the BIOS.
LIL
The second stage boot loader has been started, but it can't load the descriptor table from the map
file. This is typically caused by a media failure or by bad disk parameters in the BIOS.
LIL?
The second stage boot loader has been loaded at an incorrect address. This is typically caused by
bad disk parameters in the BIOS.
LIL-
The descriptor table is corrupt. This can be caused by bad disk parameters in the BIOS.
LILO
All parts of LILO have been successfully loaded.
GRUB :
GNU GRUB is a bootloader (can also be spelled boot loader) capable of loading a variety of free
and proprietary operating systems. GRUB will work well with Linux, DOS, Windows, or BSD.
GRUB stands for GRand Unified Bootloader.
GRUB is dynamically configurable. This means that the user can make changes during the boot
time, which include altering existing boot entries, adding new, custom entries, selecting different
kernels, or modifying initrd. GRUB also supports Logical Block Address mode. This means that
if your computer has a fairly modern BIOS that can access more than 8GB (first 1024 cylinders)
of hard disk space, GRUB will automatically be able to access all of it.
GRUB can be run from or be installed to any device (floppy disk, hard disk, CD-ROM, USB
drive, network drive) and can load operating systems from just as many locations, including
network drives.
What about LILO?
LILO supports only up to 16 different boot selections; GRUB supports an unlimited number of
boot entries.
LILO cannot boot from network; GRUB can.
LILO must be written again every time you change the configuration file; GRUB does not.
LILO does not have an interactive command interface.
How does GRUB work?
When a computer boots, the BIOS transfers control to the first boot device, which can be a hard
disk, a floppy disk, a CD-ROM, or any other BIOS-recognized device. We'll concentrate on hard
disks, for the sake of simplicity.
The first sector on a hard is called the Master Boot Record (MBR). This sector is only 512 bytes
long and contains a small piece of code (446 bytes) called the primary boot loader and the
partition table (64 bytes) describing the primary and extended partitions.
By default, MBR code looks for the partition marked as active and once such a partition is found,
it loads its boot sector into memory and passes control to it.
GRUB replaces the default MBR with its own code.
Furthermore, GRUB works in stages.
Stage 1 is located in the MBR and mainly points to Stage 2, since the MBR is too small to
contain all of the needed data.
Stage 2 points to its configuration file, which contains all of the complex user interface and
options we are normally familiar with when talking about GRUB. Stage 2 can be located
anywhere on the disk. If Stage 2 cannot find its configuration table, GRUB will cease the boot
sequence and present the user with a command line for manual configuration.
Stage 1.5 also exists and might be used if the boot information is small enough to fit in the area
immediately after MBR.
The Stage architecture allows GRUB to be large (~20-30K) and therefore fairly complex and
highly configurable, compared to most bootloaders, which are sparse and simple to fit within the
limitations of the Partition Table.
Linux System Process Initialization (SysV)
Traditionally, Linux systems (and Unix systems before them) have used a sequential startup
mechanism, which is described here. There is another page that describes a newer mechanism,
known as Upstart and yet another page that describes an even newer mechanism known as
systemd.
This older method of system initialization is still in wide use. Moreover, for compatibility
reasons, much of its functionality is incorporated into upstart and systemd.
The method described on this page originated in a Unix version from AT&T Bell Labs, called
"System V" where the "V" is Roman-numeral 5. "System V" is often abbreviated "SysV" and so
that is what we use to distinguish this mechanism from the upstart and systemd mechanisms.
After the Linux kernel initialization is completed, the init script executes the program /sbin/init.
/sbin/init reads the file /etc/inittab which determines a series of scripts to be run to complete the
initialization process:
1. The first script that init runs is /etc/rc.d/rc.sysinit. This script does several initialization tasks.
2. The next thing init does (again driven by entries in /etc/inittab) is run /etc/rc.d/rc, passing it a
number known as the runlevel. Certain runlevels are standard: