Thursday, December 17, 2009

Startup and Shutdown of HP-UX

Here we are going to take a look at the boot sequence of HP-UX.

It is basically divided into 2 main parts,
a. Boot PROM Startup - Same like other systems
b. HP-UX Startup - Included ISL, SSL (hpux), kernel (/stand/vmunix), swapper, init and /etc/inittab

Here is the boot sequence given in steps ,

1. Power On the system or Reboot the System
2. Processor Dependent Code
     - PDC gets executed and it performs the initial self-test include processor, memory and also detects 
        peripherals attached to the system.
     - If auto boot is disabled, it displays a menu list, something like smsin aix, bios in your pc.
3. PDC initializes the console to display boot messages and any errors. Then it looks for the primary boot path.
Note: boot path is nothing but the hardware path to the bood disk
4. Initial System Loader from the boot dick gets loaded into the memory and executed by PDC
5. Secondary System Loader 'hpux' gets loaded into the memory by the ISL. "hpux" is stored in the boot sector of the boot disk.
6. SSL hpux loads the kernel "/stand/vmunix" into the memory and from here kernel takes over the control.
7. Kernel then loads the device drivers and starts the process "swapper"
8. Swapper process (PID = 0) then intiates a shell process to execute commands from /sbin/pre_init_rc
9. Finally kernel loads the system's first process called "init". Hence init pid is always 1.
10. The init process processes the /etc/inittab file and runs the startup scripts to start other daemons and processes based on the default run level set. This will take the system to the default run level and from now on users can login to the system.

Few Points:

Stable Storage:
Primary / alternate boot paths, console, autoboot mode, autosearch values are stored in the stable storage. This information is used by the PDC. To change any of these values, you can use "configure"  command.

Few PDC commands:

1. To boot in single-user mode for maintenance purpose :

> boot pri -is

Few ISL Commands:

1. To boot in single-user mode :
ISL > hpux -is

2. To boot from alternate kernel :
ISL > hpux /stand/vmunix.old

3. To boot in single-user mode using an alternate kernel :
ISL > hpux -is /stand/vmunix.old

4. To display the version of hpux utility :
ISL > hpux -v

5. To display the files in the /stand directory (mostly used to find the alternate kernel file name) :
ISL > hpux ll /stand


Contents of Boot Area:

Boot disk contains a boot area and a root partition plus swap space and other file systems.
Boot area contains the below stuff :

a. An LIF volume header that indentifies the LIF volume
b. A file containing a HP-UX volume name
c. A directory that contains a list of files contained in this area
d. Initial System Loader (ISL)
e. A secondary System Loader (hpux)
f. A file named AUTO - Contains the hpux utility name and any arguments to be passed onto hpux.

To list the contents of the boot area:

# lifls -l /dev/dsk/c0t0d0

where cotod0 is the boot disk ie., controller 0, target 0, disk 0

Few Boot list commands :

1. To view the current primary, alternate bootpaths, autoboot and autosearch :

# setboot

2. What is the command to install files in the LIF area :

# mkboot

3. What is the command to delete files in the LIF area :

# rmboot

Available Run Levels:

0 - Terminates all the processes by going to the lower run levels and finally shuts down the system

s - Single User Mode. Only one physical console can be used. Only the root file system is mounted. Only the processes (daemons) those having keyword sysinit in the /etc/inittab are started and any other daemon started by the kernel.

S - It is functionally same as ‘s’ with the exception that the current terminal will be considered as console (virtual).

1 - It is above run level ‘s’. The system is dedicated to one user but all the file systems are mounted, with a process known as ‘syncer’ running.

2 - Multiuser run level with no NFS

3 - Functionally same as “2”, with Network daemons, NFS, Web-base administration, graphical presentation managers running.

4 - Currently not available. You can customize this as per your environment.

5 - Currently not available. You can customize this as per your environment.

6 - Currently not available. You can customize this as per your environment.

You can use 'init' command to change the run level.
For Ex., to goto run level 3 from single-user mode
# init 3

Few Commands:

1. To display the current run level :

# who -r

2. To immediately shutdown a system with no interactive response :

# shutdown -h -y 0

Note: You can use "reboot" command if you're running in a single user mode. It normally kills all the daemons instead of gracefull terminating them. So its not recommended in multi-user mode.

3. To shutdown a system with no interative response after 60 seconds :

# shutdown -h -y 60

4. To shutdown a system immediately and to reboot :

# shutdown -r -y 0

5. How to view the shutdown and reboot times for the system :

# cat /etc/shutdown.log

6. How to allow an user called joe from a remote machine (workstation1) to shutdown the system server1 :

Just add the below lines to /etc/shuwdown.allow

workstation joe

For Ex., # echo "workstation joe" >> /etc/shutdown.allow

7. To shutdown a server to a single user mode :
# shutdown


Last but not least, you must obtain approval from the business before shutting down a server. If not, just get ready to face the music.

3 comments: