Linux Basics(3 of 6):
Boot Loader, MBR & First Sector of a Hard Drive:
Boot Loader: It is a very smal program, during boot process BIOS executes this program and this
program loads /boots operating system. During instalation of an operating system,
depending upon our provided setings the operating system writes boot loader
program either in the MBR (first sector of hard drive) in first sector of the partition in
which operating system is being instaled.
When we tel operating system to write Boot Loader program in first sector of the
partition then we have to set that partition active.
MBR: Master Boot Record is very first record of a hard drive. Where the operating system
normaly keeps Boot Loader program. When we create partitions on a hard drive then
tools like fdisk keep Partition Table in MBR.
First Sector of a Hard Drive:
We can force Linux to keep its Boot Loader program in first sector of the partition in
which we are instaling Linux. But if we instal Boot Loader program in first sector of a
partition then we have to make that partition ACTIVE.
Initial Boot Process:
- During boot process BIOS after Power On Self Test (POST) checks Boot Priority and
goes to the first sector (MBR) of the first boot device and tries to load Boot Loader
program. If it does not find Boot Loader there then it checks the active partition of the
hard drive and tries to find Boot Loader program on first sector of Active partition.
Therefore when we keep Boot Loader program in first sector of a partition then we
have to make that partition active.
- Boot Loader tels where the kernel is present and starts to load kernel.
- And then kernel finaly loads complete operating system.
Registry Concept in Linux:
Registry is a centralized place where windows operating system keeps current system,
services and application configuration information. BUT in Linux we do not have
centralize registry concept. For each task of the system and for each service and
application we have separate configuration information (registry). These files are
caled configuration files.
Most of the system and services’ configuration files are present in /etc directory.
Directory and File Location:
/ Parent of all directories.
|_boot Contains files that are required to boot Linux system like kernel, boot loader files etc.
| Path: /boot
|_etc Contains System, Services’ and application configuration files.
| Path: /etc
|_home Contains home directories of al users created with default setings. Home directories
| are given same name as user name. A home directory for a user is a place where user
| have ful rights. And can create files directories etc.
| Path: /home
|_lost+found Similar to Recyclebin in windows
| Path: / lost+found
|_bin Contains user level commands that are found in almost al Uinux.
| Path: /bin
|_sbin Contains admin level commands that are almost found in al Uinux.
| Path: /sbin
|_lib Contains library files that are required by many commands
| Path: /lib
|_dev Contains device files
| Path: /dev
|_usr Volume wise it is the biggest directory of Linux operating system some of its sub
| | directories are important.
| | Path: /usr
| |_bin Contains Linux specific user level commands.
| | Path: /usr/bin
| |_sbin Contains Linux specific admin level commands. Specialy service related files are
| | present in it.
| | Path: /usr/sbin
| |_src A main directory for keeping al kind of source codes for compilation.
| Path: /usr/src
|_var var is for variable. Contents of this directories keep changing.
| | Path: /var
| |_log Main log directory for system, application and service log. It contains many sub
| | directories.
| | Path: /var/log
| |_spool Main spool directories that contain separate spool directories for separate applications
| | and services. Path: /var/spool
| |_mail Contains Mail boxes of al users.
| | Path: /var/spool/mail
| |_mqueue Mail queue directories. Users’ incoming and out going mails are kept
| | here before sending them out or delivering them to user’s mailboxes. In
| | this directories we can process emails for iruses and Spam.
| | Path: /var/spool/mqueue
| |_cups Holds print jobs before printing. It is print spool directory.
| Path: /var/spool/cups
|_mnt Default mount point. (wil be explained later in “Mounting Process” section)
| Path: /mnt
|_tmp Temp directory to hold temporary files created during instalation of software etc.
|_opt Default location for third party software instalation like Oracle etc.
| Path: /opt
|_proc Keeps system, service and application status information. It is volatile it is populated
as system boots and its contents are deleted in shutdown process.
Note: There are certain other directories but their function is not important especialy at this stage.
In Linux we cannot access a medium (a device that hold data line hard drive, floppy,
Cdrom and USB. To access these we have to mount them on an Empty directory
(mount point). Then that directory / mount point is acts as the mounted medium.
Suppose you have mounted /dev/hda1 partition on /mnt directory. Then /mnt wil
become that partition and what ever you copy in /mnt is actualy goes to /dev/hda1.
Mount command creates link between device file and mount point.
After we umount /mnt it wil become a normal directory again.
Note: Mounted partitions can be viewed in “df” & “mount” command.