Sie sind auf Seite 1von 24

The Booting & Shutdown

Process
Booting Phases
• Boot strapping is the process a computer follows to load and
execute the bootable operating system.
• The boot process goes through the following phases:
Boot PROM phase.
Boot program phase.
Kernel Inialialization phase.
Init phase.
Boot PROM Phase
• After you turn on power to the system, the PROM displays
system identification information and runs self-test
diagnostics to verify the system’s hardware and memory.
• It then loads the primary boot program, called bootblk
Boot Program Phase
• The bootblk program finds and executes the secondary
boot program (called ufsboot) from the ufs file system and
loads it into memory.
• After the ufsboot program is loaded, it loads the kernel.
Kernel Initialization Phase
•The kernel initializes itself and begins loading modules, using
ufsboot to read the files.
•When the kernel has loaded enough modules to mount the root file
system, it unmaps the ufsboot program and continues, using its
own resources.
• The kernel starts the UNIX operating system, mounts the
necessary file systems, and runs /sbin/init to bring the system to the
“initdefault” state specified in /etc/inittab.
Init Phase
• The Kernel creates a user process and starts the /sbin/init process,
which starts other processes by reading the /etc/inittab file.
• The /sbin/init process starts the run control (rc) scripts, which
execute a series of other scripts. These scripts (/sbin/rc* check
mount file systems, start various processes, and perform system
maintenance tasks
Boot Command Options
# boot -(one of the following options)
-a An interactive boot
-r A reconfiguration boot
-s Boots into a single-user state
-v Boots in verbose mode
System Run States
Run state 0 Halt
Run state S,s Single User (without users)
Run state 1 Single User (with users)
Run state 2 Multi User (without NFS)
Run state 3 Multi User (with NFS)
Run state 4 N/A
Run state 5 Poweroff to SPARC
Run state 6 Reboot
Run State 0
• Stops system services and daemons.
• Terminates all running processes.
• Unmounts all file systems.
Run state S,s
• Single-user (system administrator) state.
• Only root is allowed to log in at the console, and any users logged
in are logged out when entering this run level.
• All file systems previously mounted remain mounted and
accessible.
• All services except the most basic OS services are shut down in an
orderly manner.
Run state 1
• Single-User (system administrator) state.
• All file systems are still available, and any logged-in users can
remain logged in.
• All services except the most basic OS services are shut down in
an orderly manner.
Run state 2
• Normal multiuser operation without NFS file systems shared.
• Sets the time zone variable.
• Mounts the /usr file system.
• Cleans up the /tmp and /var/tmp directories.
• Loads the network interfaces and starts processes.
• Starts the cron daemon.
• Cleans up the uucp tmp files.
• Starts the lp system.
• Starts the sendmail daemon
Run state 3
• Normal multiuser operation of a file server with NFS
systems shared.
• Completes all the tasks in run level 2.
• Starts the NFS system daemons.
Run state 4
• Alternative multiuser state (currently not used)
Run state 5
• Power-down state.
• Shuts down the system so that it is safe to turn off power to
the system.
• If possible, automatically turns off system power on
systems that support this feature.
Run state 6
• Reboots
INIT Phase
• The /sbin/init command generates processes to set up the system
based on the directories in /etc/inittab.
• The init process is the parent of all other processes.
• It examines the contents of the /etc/initab file.
id:runlevel:action:process
id A unique identifier
runlevel The run level
action How the process is to be run.
process The name of the command to execute
Inittab Action Fields

powerfail The system has received a powerfail signal


wait Waits for the command to be completed.
Respawn Restarts the command
System Shutdown
/usr/sbin/shutdown
/sbin/init
/usr/sbin/halt
/usr/sbin/reboot
/usr/sbin/poweroff
/usr/sbin/shutdown
• The shutdown command sends a warning message to all users
who are logged in, waits for 60 seconds (the default), and then
shuts down the system to single-user state.
shutdown -i<init-state> -g<grace-period> -y
i Brings the system to an init state different from the default
of S. The choices are 0,1,2,5, and 6.
-g Indicates a time (in seconds) before the system is
shut down. The default is 60 seconds.
-y Continues to shut down the system without
intervention; otherwise, you are prompted to
continue the shutdown process after 60 seconds.
/sbin/init
• Init command can be used to shutdown a single-user
system or to change its run level.

init <run level>


/usr/sbin/halt
• The halt command shuts down the system without any delay.
• It does not warn any other users on the system of the shutdown.
/usr/sbin/reboot
• Reboot command can be used to shut down a single-user system
and bring it into multiuser state.
• Reboot does not warn other users on the system of the shutdown.
/usr/sbin/poweroff
• The poweroff command is equivalent to the init 5 command

Das könnte Ihnen auch gefallen