P3BootingandShuttingdownpptx 2021 08-07-16!05!55

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Booting and Shutting

Down
Boot Loader
• For any operating system to boot on standard PC hardware, you need
what is called a boot loader
• the boot loader will reside in the Master Boot Record (MBR) of the
disk
• it knows how to get the operating system up and running
• Linux distributions have GRUB (the Grand Unified Bootloader) and
LILO (Linux Loader)
GRUB & LILO
• Booting  Boot Loader
• No user interaction
• First Software to run
• MBR
• GRUB (the Grand Unified Bootloader) and LILO (Linux Loader)
• GRUB Legacy ( Stable Version)
GRUB
• Stage 1
• Embedded in the MBR
• Stage 1
• Stage 2
• Intermediate ( Stage 1.5)
• Actual ( Stage 2)
• File system–specific
• x_stage_1_5 (e2fs, reiserfs, fat, jfs, minix, xfs )
• Stage 2 Actual Code , Boot Menu, GRUB Shell ( For other OS Location)
• stage2_eltorito(boot image for CD-ROM), nbgrub, pxegrub (network-type boot images )
• Bootstrap Protocol [BOOTP], Dynamic Host Configuration Protocol [DHCP], Preboot
Execution Environment [PXE], Etherboot /boot/grub
• “hd” means “hard disk”, “fd” means “floppy disk.”
• grub-install
• Installing GRUB:
• Backing Up the MBR:
• Creating a Boot/Rescue CD:
Installing GRUB from the GRUB Shell
• Launch GRUB’s shell by issuing the grub command. Type
• [root@fedora-serverA ~]# grub GNU
• GRUB version 0.97 (640K lower / 3072K upper memory)
• Set GRUB’s root device to the partition that contains the boot directory
on the local hard disk. Type
• grub> root (hd0,0)
• Filesystem type is ext2fs, partition type 0x83
• Make sure that the stage1 image can be found on the root device. Type
• grub> find /grub/stage1
• (hd0,0)
• Finally, install the GRUB boot loader directly on the MBR of the hard
disk. Type
• grub> setup (hd0)
• Checking if "/boot/grub/stage1" exists... no
• Checking if "/grub/stage1" exists... yes
• Checking if "/grub/stage2" exists... yes Checking if "/grub/e2fs_stage1_5"
exists... yes
• Running "embed /grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
• succeeded
• Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /
grub/grub.conf"... succeeded
• Done.
• Quit the GRUB shell. Type
• grub> quit
Adding new Kernel to GRUB
• cd /boot
• cp vmlinuz-2.6.25-14.fc9.i686 duplicate-kernel
• cp initrd-2.6.25-14.fc9.i686.img duplicate-initrd.img
• Create entry in GRUB file.
• title The Duplicate Kernel
color yellow/black
root (hd0,0)
kernel /duplicate-kernel ro root=UUID=7db5-4c27
initrd /duplicate-initrd.img

• title The change color entry


color yellow/black
LILO
• It allows you to boot multiple operating systems, provided each
system exists on its own partition
• Configuring LILO: A configuration file (/etc/lilo.conf) specifies which
partitions are bootable and, if a partition is Linux, which kernel to
load. When the /sbin/lilo program runs
• LILO is a two-stage boot loader.
• The first stage loads LILO itself into memory and prompts you for
booting instructions with the lilo: prompt or a colorized boot menu.
• second stage, LILO is booting the Linux operating system
• Bootstrapping
• Kernel Loading
• Kernel Execution
Init Process
• Init process  non-kernel process
• /etc/inittab  run level
• Initdefault (eg :- id:3:initdefault: )
RC Script
• Runlevel change script to manage services
• /etc/rc.d/rc ( eg /etc/rc.d/rc3.d)
• S for starting and k for killing
Adding RC Script
• Generate and save a script ( .sh extension)
• Make script executable ( chmod 755 filename)
• Move script to /usr/local/sbin/

Adding RC Script to Run-level


• Generate RC script
• Update permissions ( 755 filename)
• Move it to ( /etc/rc.d/init.d/)
• Update-rc –d
• Check service status ( service service-name status )
preceding startup script:
• Even though the first line of the script begins with “#!/bin/sh”, it should
be noted that /bin/sh is a symbolic link to /bin/bash. This is not the case
on other UNIX systems.
• The line “chkconfig: 35 99 01” is actually quite important to the chkconfig
utility that we want to use. The numbers “35” means that chkconfig
should create startup and stop entries for programs in runlevels 3 and 5
by default, i.e., entries will be created in the /etc/rc.d/rc3.d and
/etc/rc.d/rc5.d directories.
• The fields “99” and “01” mean that chkconfig should set the startup
priority of our program to be 99 and the stop priority to be 01, i.e., start
up late and end early.
• Save the text of the script into a file called carpald
• You next need to make the file executable. Type
• [root@fedora-serverA ~]# chmod 755 carpald
• Copy or move the script over to the directory where startup scripts are stored, i.e., the
/etc/rc.d/init.d/ directory. Type
• [root@fedora-serverA ~]# mv carpald /etc/rc.d/init.d/
• Now you need to tell chkconfig about the existence of this new start/stop script and what
we want it to do with it. Type
• [root@fedora-serverA ~]# chkconfig --add carpal
• Use the service command to find out the status of the carpald.sh program. Type
• [root@fedora-serverA ~]# service carpald status
• carpald is stopped
• Manually start the carpald program to make sure that it will indeed start up correctly upon
system startup. Type
• [root@fedora-serverA ~]# service carpald start
• Starting carpald:
• done
Netfilters
• Three userlevel interfaces (ipfwadm, ipchains, and iptables)
• IPTables & iptables-ipv6
• Netfilters
• network address translation (NAT), mangle, raw, and filter
• NAT for network address translation
• Mangle for marking packet ( Eg change in type of service Tos
change in MTU, TTL)
• RAW packet dealing at low level ( higher priority compared to
other table.
• Filter table for packet table

You might also like