Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Booting & shut down,

Descriptive information about Booting & Shut Down of in LINUX Operating System

Related Books

Free with a 30 day trial from Scribd

See all
  • Be the first to comment

Booting & shut down,

  1. 1. Booting and Shut Down of Operating System Prepared By Prof.Bhushan Pawar MESCOE,Pune(Wadia Campus) 1Prof.Bhushan Pawar
  2. 2. Bootstrapping Standard term for starting up a computer. During bootstrapping, the kernel is loaded into memory and begins to execute. When a computer is turned on, it first executes boot code that is stored in ROM. The kernel probes the system’s hardware and then spawns the system’s init process, which is always process number 1. 2Prof.Bhushan Pawar
  3. 3. Recovery boot to a shell  In normal operation, systems boot themselves independently and are then accessed remotely by administrators.  If a disk crashes, administrators need a recovery tool.  Then instead of shooting for full system operation, UNIX systems can boot just run a shell on the system console known as booting to single-user mode, recovery mode, or maintenance mode.  Single-user mode does not allow network operation we need physical access to the system console to use it. 3Prof.Bhushan Pawar
  4. 4. Recovery boot to a shell (Contin…) On most systems, you request a boot to single- user mode by passing an argument to the kernel at boot time. If the system is already up and running, you can bring it down to single- user mode with the shutdown or telinit command. 4Prof.Bhushan Pawar
  5. 5. Steps in the boot process • consists of 6 distinct phases – Reading of the boot loader from the master boot record – Loading and initialization of the kernel – Device detection and configuration – Creation of kernel processes – Administrator intervention (single-user mode only) – Execution of system startup scripts 5Prof.Bhushan Pawar
  6. 6. Kernel initialization • First bootstrapping task is to get kernel into memory so that it can be executed. • The pathname of the kernel /boot/vmlinuz • System ROM loads a small boot program into memory from disk. This program is called as boot loader. 6Prof.Bhushan Pawar
  7. 7. Creation of kernel processes Kernel process created through the normal system fork mechanism init is always pid 1. Most UNIX systems have sched as process 0. 7Prof.Bhushan Pawar
  8. 8. Operator intervention (recovery mode only) • If the system is to be brought in recovery mode, a command-line flag passed by the kernel. • During a single-user boot on same systems, you are prompted to enter the root password. If you enter the right password, the system spawns a root shell. • You can execute commands in same way as when logged in on a fully booted system. 8Prof.Bhushan Pawar
  9. 9. Booting PC • When a machine boots, it begins by executing code stored in ROMs. • The initial boot code is generally called a BIOS (Basic Input/Output System) • Actually, a PC has several levels of BIOS: one for the machine itself, one for the video card, one for the SCSI card if the system has one, and sometimes components for other peripherals such as network cards. 9Prof.Bhushan Pawar
  10. 10. Booting PC (Continue…) • Built-in BIOS knows about some of the devices that live on the motherboard. E.g. IDE(integrated development environment), SATA Controller, network interfaces. • The BIOS normally lets you select which devices you want the system to try to boot from. You can usually specify an ordered list of preferences such as “Try to boot from a DVD, then a USB drive, then the hard disk.” Network booting with PXE(Preboot eXecution Environment) is also a common option. 10Prof.Bhushan Pawar
  11. 11. Booting PC (Continue…) • Once the BIOS has figured device to boot from it tries to read the first block of the device. This 512-byte segment is known as the master boot record or MBR. The MBR contains a program that tells the computer from which partition to load a secondary boot program, the “boot loader.” 11Prof.Bhushan Pawar
  12. 12. Booting PC (Continue…) • The default MBR contains a simple program that tells the computer to get its boot loader from the first partition on the disk. • Once the MBR has chosen a partition to boot from, it tries to load the boot loader specific to that partition. This loader is then responsible for loading the kernel. 12Prof.Bhushan Pawar
  13. 13. GRUB: GRAND UNIFIED BOOT LOADER • GRUB, developed by the GNU project • It is the default boot loader for UNIX & LINUX systems with Intel Processors. • GRUB’s job is to choose a kernel from a previously assembled list and to load that kernel with options specified by the administrator. 13Prof.Bhushan Pawar
  14. 14. 14 GRUB Loader Prof.Bhushan Pawar
  15. 15. GRUB Loader (Continue..) • By default, GRUB reads its default boot configuration from /boot/grub/menu.lst or /boot/grub/grub.conf • GRUB allows dynamic changes at each system boot. • The menu.lst and grub.conf files are slightly different but have a similar syntax. Red Hat systems use grub.conf, and Solaris, SUSE, and Ubuntu still use menu.lst 15Prof.Bhushan Pawar
  16. 16. GRUB Loader (Continue..) • To enter command-line mode, type c from the GRUB boot screen. GRUB command-line options Command Meaning reboot Reboots the system find Finds files on all mountable partitions root Specifies the root device (a partition) kernel Loads a kernel from the root device help Gets interactive help for a command boot Boots the system from the specified kernel image 16Prof.Bhushan Pawar
  17. 17. BOOTING TO SINGLE-USER MODE • The beginnings of the boot process are system dependent. Systems with non-Intel processors have custom boot loader software. • Single-user mode with GRUB – don’t need to use the command line. – boot options should be easily modifiable and decided on the ‘a’ key as the appropriate tool. – At the GRUB splash screen, highlight the desired kernel and press ‘a’ to append to the boot options. 17Prof.Bhushan Pawar
  18. 18. Single-user mode with GRUB (Continue..) • To boot into single-user mode, add the single (or -s on Solaris) flag to the end of the existing kernel options. • E.g grub append> ro root=LABEL=/ rhgb quiet single 18Prof.Bhushan Pawar
  19. 19. Single-user mode with GRUB (Continue..) • rhgb = redhat graphical boot - This is a GUI mode booting screen with most of the information hidden while the user sees a rotating activity icon spining and brief information as to what the computer is doing. quiet = hides the majority of boot messages before rhgb starts. These are supposed to make the common user more comfortable. They get alarmed about seeing the kernel and initializing messages, so they hide them for their comfort. 19Prof.Bhushan Pawar
  20. 20. Single-user mode on SPARC (scalable processor architecture) • To interrupt the boot procedure and enter the OpenBoot PROM on Sun hardware, press the L1 and ‘a’ keys simultaneously. L1 is sometimes labeled STOP on modern Sun keyboards. • Type boot -s to boot to single-user mode. 20Prof.Bhushan Pawar
  21. 21. WORKING WITH STARTUP SCRIPTS • After exiting from single-user mode init executes the system startup scripts & that are interpreted by sh or bash. • Systems use approach in which scripts are numbered and executed. • Scripts are kept in /etc/init.d, and links to them are made in the directories /etc/rc0.d, /etc/rc1.d 21Prof.Bhushan Pawar
  22. 22. WORKING WITH STARTUP SCRIPTS (Continue…) • Tasks that are often performed in the startup scripts Setting the name of the computer Setting the time zone Checking the disks with fsck (i.e file system check) Mounting the system’s disks Removing old files from the /tmp directory Configuring network interfaces Starting up daemons and network services Prof.Bhushan Pawar 22
  23. 23. Rebooting & Shutting Down • On consumer-oriented operating systems, rebooting the operating system is an appropriate first course of treatment for many problems. • Whenever we modify a startup script or make significant system changes, we should reboot just to make sure that the system comes up successfully. Prof.Bhushan Pawar 23
  24. 24. shutdown: the proper way to halt the system • It is the safest, most considerate, and most thorough command to initiate a halt or reboot or to return the system to single-user mode. • You can ask shutdown to wait awhile before shutting down the system. During the waiting period, shutdown sends messages to logged-in users at progressively shorter intervals, warning them of the impending downtime. • Most versions of shutdown, specify whether the machine should halt, go to single-user mode, or reboot. (Path is /sbin/shutdown) Prof.Bhushan Pawar 24
  25. 25. halt and reboot: simpler ways to shut down • The halt command performs the essential duties required to shut the system down. It is called by shutdown -h but can also be used by itself. • Halt logs the shutdown, kills nonessential processes, executes the sync system call (called by and equivalent to the sync command), waits for file system writes to complete, and then halts the kernel. • halt -n prevents the sync call. Prof.Bhushan Pawar 25
  26. 26. halt and reboot: simpler ways to shut down (Continue…) • reboot is almost identical to halt, but it causes the machine to reboot instead of halting. • Reboot is called by shutdown -r. Prof.Bhushan Pawar 26