Featured

    Featured Posts

Linux Boot Process

Have you ever wondered what happens while LINUX boot? 

Then you are at the right place !!!


The Boot process is the primary thing to know by all Linux users / administrators. Ofcourse it is one of the important interview questions of all the time.

[it is important to know the boot sequence which helps us to analyze the boot logs, understand what exactly happening at boot time and troubleshooting various boot related issues]

The process behind the scene, when we turn on the system and until the login prompt appears. This entire process is nothing but " boot process / boot sequence".

There are 6 stages available in Linux boot process:

Boot Process stages



BIOS:
  • Basic Input/output system (BIOS) will run (POST - Power On Self Test) to check all hardware and its operating state.
  • BIOS gets loaded in memory and checks system, connected peripherals, boot device (cd-rom ,floppy, hard disk) path. 
  • BIOS will determines the boot loader program and loads into memory.
  • Once boot loader program is loaded, BIOS hand over boot control to it.


MBR:
  • MBR is located in first sector of bootable drive, which is of size 512 bytes.
  • This 512 bytes is comprise of 446 bytes for primary boot loader, 64 bytes for partition table and 2 bytes for MBR validation check.  [ 512 = 446 + 64 + 2 ]
  • MBR contains the information about GRUB/LILO
  • LILO is Linux Loader which was used for old system.
  • Now boot control will move to GRUB stage.

GRUB:
  • Grand Unified Boot Loader.
  • The main config file for GRUB is /etc/grub.conf
  • It will display a splash image with the list of available kernels in your system  and wait for few seconds.
  • You can use Arrow keys and select the required kernel to load otherwise it will load the default kernel in a specified time present in /etc/grub.conf file.

sample grub.conf file :

  • It will have the details related to kernel and initrd image.
  • initrd - Initial Ram Disk is used to temporarily mount the root file system
  • The initramfs is used by the kernel to load drivers and modules necessary to boot the system. 
  • Once kernel and initramfs is loaded into memory, then the boot control will goes to kernel.

KERNEL:
  • Kernel will initialize and configure the system's memory and the hardware of the system ( processor/storage devices).
  • It will also helps to load all the necessary drivers.
  • kernel mounts the root partition as read-only, and free up any unused memory.
  • Kernel will execute /sbin/init. Since it is the first process which is generated by kernel,  init will have PID as 1 . Thus init is the parent or ancestor process of all process
  • Now the control will goes to init.
INIT:
  •  /etc/inittab file contains the run levels as follows:
sample inittab file:
  • Usually the default runlevel will be either 3 or 5, depends on your system.
  • Commands to check runlevel:
                 # who –r 
                 # runlevel

Runlevel:
  • The Runlevel directories will look's like  /etc/rc.d/rc*.d
  • Here * can be replaced by 0 to 6 . For ex: runlevel 0 will make use of /etc/rc.d/rc0.d
Runlevel  Directories:
Run level 0     →     /etc/rc.d/rc0.d
Run level 1     →     /etc/rc.d/rc1.d
Run level 2     →     /etc/rc.d/rc2.d
Run level 3     →     /etc/rc.d/rc3.d
Run level 4     →     /etc/rc.d/rc4.d
Run level 5     →     /etc/rc.d/rc5.d
Run level 6          /etc/rc.d/rc6.d
  • Depending on the selected runlevel, the init process will executes startup scripts under the subdirectories of  /etc/rc.d directory.
Thus Boot Process is completed.
If  everything goes fine, you should be able to see the Login prompt on your system.





-----------------------------------------------------------------------------------------------------------------------------------------------------
Thanks 😊



Linux - Filesystem Hierarchy - Directory Structure

Linux Directory Structure Overview:
Before we proceed with learning commands, it’s better to get a detailed idea about Linux's file structure.
The Linux file system structure looks like upside down tree.
This hierarchy is very easy to understand as all directory names are all self-explanatory.

Below picture shows how the directories were organised.





To list the Directories under " / "
Open Terminal
Change to / directory by typing “ cd / 
Type “ 
ls “ to view the contents ( Directories)


The Directory Structure in Unix & Linux are a unified Directory Structure where in all the directories are unified under the " " Root file system. Irrespective of where the File System is physically mounted all the directories are arranged hierarchically under the Root file system.

The Linux Directory Structure follows the "Filesystem Hierarchy Structure (FHS)" maintained by the Free Standards Group although most of the distributions sometimes tend to deviate from the standards.


Below is the detailed description of different directories under the Linux Filesystem Hierarchy :

/
The root directory.
Top level Directory, parent of all other directories.

/boot
Includes Linux boot related files / startup files, including the Linux kernel. Can be small; 16MB is usually adequate for a typical modular kernel. If you use multiple kernels, such as for testing a kernel upgrade, increase the size of this partition accordingly.

/root
Home directory of the root user.
Contains Root user related files

/home
Home directories for almost every user.
Contains normal user files
eg: /home/kiran

/bin
Contains Binary files.
Essential command line utilities.
Normal user commands.

/sbin
Super user binary files.
System administration/ Super user / root user commands.

/etc
Edit to configure.
Contains almost all  basic configuration files.

/usr
Unix Shareable resource.
Contains the packages which were installed with OS.
Includes many system administration commands & utilities.
  
/opt
Optional directory.
Contains packages which were installed manually.
eg: WordPerfect or Star Office.
  
/dev
Contains all device files.
eg: /dev/sda

/lib
Contain library files
Program libraries for the kernel and various command line utilities

/mnt
The mount point for removable media, including floppy drives,CDROMs.
eg: /mnt/partition1

/proc
Currently running kernel related processes, including device assignments such as IRQ ports, I/O addresses, and DMA channels.
Contains process related files.
eg: cat /proc/loadavg
       cat /proc/uptime

/tmp
Contains temporary files.
By default, Red Hat Linux deletes all files in this directory periodically.

/var
Variable data, including log files, mails and printer spools etc.,
eg: cat /var/log/messages
       cat /var/log/boot.log

/media
Contains removable media.

/srv
Services offered – server data



To list Directories under " / "



Graphical View of Directories under " / "







------------------------------------------------------------------------------------------------------------

Linux Command cheat sheet

This document will help you to refer the linux cmmands used in daily work life...

Click here here to download in pdf file: Linux command cheat sheet.









Will append the other commands soon...
Thanks!




Full Installation of RHEL in VMware instead of Auto Installation

Install RHEL (LINUX) by disabling Auto installation feature :

Step 1: Create New Virtual Machine.



 Step 2: Seclect Typical and click OK


Step 3: Browse the RHEL ISO file:



Step 4: Set Username and password and click Next:



Step 5: Click on Next button: 



Step 6: Click Finish:



Step 7: Double Click on Edit Virtual Machine Settings:



Step 8: Select CD/DVD - using file autoinst.iso and click Remove:



Step 9: Now click on Power on Virtual Machine :





Step 10: Now you can see Full installation window:








Continue & complete the installation ....



Cheers!😃

Steps to install RHEL on VMware


Please follow the below steps to install RHEL machine in Vmware:



Step 1: Open Vmware Workstation and click on "Create New Virtual Machine" or  File >> Create New virtual Machine.




Step 2: Select "Typical" (recommended) and click on Next



Step 3: Browse the RHEL ISO file and cick on Next



Step 4: Enter username and password.
Note: Username cannot be root since it is reserved for root user and will be created by default.



Step 5: Modify the name as you wish and click Next



Step 6: Allocate desired disk space (more than 5GB) and select any option as you wish and click on Next



Step 7: Now click on Finish. Done



Now your machine was set up. You just need to power on the machine and wait to complete the installation process.

Step 8: wait until completion of installtion, Once done, you will see login prompt.










Now you can click username and enter the password that you have set.

Or else, click on Other and enter username as "root"
and password (same password that you have set for the user).

Done !!!


😃

www.CodeNirvana.in

Popular Posts

Translate

Copyright © gskLinux | Linux Tutorials | Designed By | Gnanasekhar