Unix: HP-UX Command Summary

No comments


Here is the list of the some important commands for the HP-Ux Server System.
 
Bootup/Shutdown
Shutdown = shutdown -r 0

Shutdown and Halt = shutdown -h now

Shutdown to single user mode = shutdown 0

Reboot = reboot 0

Single user mode = init 1 -

Boots single user mode = hpux -is


Interupting the boot process:
• Configuration Menu
• Information Menu
• Service Menu
   GSP Mode
• From the console hit
Hit at the GSP console login (default is no password)
• Now low level commands can be entered
   o ps --> power status

 

To reboot to single user mode:
1. shutdown -r 0
2. hit during 10 sec window to interrupt reboot
3. enter:
4. interact with ipl? yes
5. hpux -is (i=init, s=single user)

 

To reboot manually to init 3 level
1. shutdown -r 0
2. during 10 sec window
3. bo
4. interact with ipl --> yes
5. hpux -is (i=init, s=single user mode)
6. mount -a
7. init 3
 



Startup/Shutdown Scripts
/sbin/init.d
/sbin/rc0.d These are all linked to actual scripts in /sbin/init.d
/sbin/rc1.d
/sbin/rc2.d scripts with k are kill scripts and scripts with s are start scritps.
/sbin/rc3.d
/sbin/rc4.d

/etc/rc.config.d --> Scripts
CIFS (Samba)
/opt/etc/samba/smb.conf
 


Device Management
HP-UX is a hardware path based operating system. When it boots up it does a hardware detection. It then compares the hardware that it detects with the hardware that is listed in /etc/ioconfig. If new hardware is detected, it is assigned the next available configuration information in the proper hardware path.

rmsf - remove special files
insf - install special files

insf -C disk -e <-- This command will re-install all of the device files for the class "disk" 


lsdev <-- Lists devices and drivers in the system ioscan <-- searches for all devices and displays their hardware path 

ioscan -fnC disk <-- searches for all devices of class (C) disk 

ioscan -fnH <-- searches for a LUN last 2 digits of hardware path in the LUN in octal (1/12/0/0.1.23) 

Disk Devices A disk device will have a name in the following format:   c#t#d# 
c# is the card number
t# is the target number
d# is the LUN - this is normally 0 unless RAID is being utilized

scsictl -a /dev/rdsk/c?t?d? <-- display control parameter information about the disk device

scsictl -a -m queue_depth=4 -m queue_depth /dev/rdsk/c?t?d? <-- sets the queue depth CD-ROM Devices

nohup /usr/sbin/pfs_mountd & - starts process nohup /usr/sbin/pfds & - starts process pfs_mount -o xlat=unix /dev/dsk/c0t1d0 /cdrom - mounts cdrom

Cdrom won't eject:
1. pfs_umount -c OR 2. kill -9 pfs_mountd and kill -9 mountd Cdrom won't mount using: pfs_mount -o xlat=unix /dev/dsk/c0t1d0 /cdrom

1. nohup /usr/sbin/pfs_mountd & 2. nohup /usr/sbin/pfsd

3. /usr/sbin/pfs_mount /cdrom <-- this uses mounting information in /etc/pfs_fstab 7400 Disk Array

armdsp -a va7400 <-- real time display of the disk array

armmgr -D va7400 HPA6189A00SG218H0024 armdiscover /opt/sanmgr/commandview/client/sbin --> Tells us the serial number
armhost -d
armhost -d 50060b000014e313 00SG218J0024
ioscan -fnc disk | more
cvui - creates luns 




Choose storage array Create LUN
Find last LUN 

Create with new lun number
View existing luns

Process to export disk configuration to a file:
• sam --> actions-->export
• volume group name --> mapfile name
Fibre Channel Devices

ioscan -fknC fc <-- Lists fibre channel adapters.

To identify the devices: ls -l /dev/fc* fcmsutil - utility for fibre channel operations fcmsutil /dev/



 

Procedure to run fcmsutil on a fibre channel:
ioscan -fnC disk|more --> Identify hw path of fibre channel adapter
ioscan -fnH 1/0/0/0 --> Identify device of fibre channel adapter
or ls /dev/fc* on older adapters (arbitrated loop)
fcmsutil /dev/fcms2 stat --> fcmsutil that shows status of fibre channel adapter
 


Logs
/etc/rc.log = Startup Log
/var/adm/sw/swagent.log  = Software package installation log
/var/adm/syslog/syslog.log  = System Error Log
/etc/shutdownlog = Shutdown Log
/var/tombstones/ts99 = Crash log

 

Login Environment
/etc/profile - main profile for all users
/etc/profile.env

export TMPDIR=/tmpsort
export TEMPDIR=/tmpsort

source a profile: ". ./profile"

 

Changing prompt
export PS1=$(hostname):'$PWD # '

This gives a prompt that has the hostname followed by the current directory, ending in the # (useful for root logins).

Networking
netstat -a = ports 

netstat -i = interfaces
netstat -r = routing table
netstat -rv = routing table and subnet mask
lanscan = provides hardware information about the nics in the server lanadmin =  menu driven interface to administer lan nics
lanadmin -x 0 = bypass menu and show lan driver specific options for nic with id 0
lanadmin -X 100FD 0 = bypass menu and set nic at id 0 to 100 MBS

Full Duplex ioscan -fnkC lan - shows ioscan information for device type "lan" lanscan -i|awk '{print $1}'|xargs -i ifconfig {} -> does an ifconfig on all defined interfaces on that server

 

Changing the IP Address and Subnet mask
set_parms ip_address
Then supply ip address and subnet mask when prompted. This process will require a reboot.
 


Changing the Default Gateway
• cd rc.config.d
• vi netconf


 

Network Time Protocol (NTP)
ntpq -p = lists ntp peers and their time sync status
ntpq -p = lists time sync status with that server (slightly different detail than ntpq -p)

/etc/ntp.conf = configuration file
Changes to the configuration require ntp daemon (xntpd) be stopped and restarted (restart is not recognized):
• /sbin/init.d/xntpd stop
• /sbin/init.d/xntpd start

 

Printing
Command Description
cancel deletes print jobs from queue
hppi jet admin
ls -d -o file prints a file
lpadmin
lpsched -v
lpstat lists jobs in queue. -s -t
pr .profile | lp -n3 prints
pr -o10 -l64 -F -h


| lp prints using margins of 10, page length of 64, header on each page

/etc/lp

/usr/lib/lp
/var/adm/lp
/var/spool/lp

/etc/lp/interface - interface scripts

/var/sam/lp/lpinfo

 
Migrating the printer configuration from one server to another server using SAM:
On the source server:
• SAM --> Printers & Plotters --> LP Spooler --> Save/Restore
 




Spooler Configuration
Actions --> Save Spooler Configuration
This saves the information in the directory /var/sam/lp 



Save this directory using tar: "tar -cvf /tmp/lp.tar /var/sam/lp" 



Copy this tar file to the destination server

 
On the destination server
Extract this file: "tar -xvf lp.tar"
SAM --> Printers & Plotters --> LP Spooler --> Save/Restor Spooler Configuration
Actions --> Restore Spooler Configuration


 
Performance Monitoring
top
j moves forward pages in the display
k moves backwared pages in the display
glance (if installed)

sar -q
sar -u
sar -d

vmstat
vminfo

 
Process Management

inetd -c Causes inet to reload /etc/inetd.conf
inetd -l starts logging in /var/adm/syslog/syslog.log
ps -ef | grep PROD list all processes, but only show those processes that have "PROD" in them
/sbin/init.d/

No comments :

Post a Comment

HP-UX UNIX Backup and Recover Data to Tape Device Using fbackup Command

No comments

Backup data using fbackup command

Backup your /data directory to /dev/rmt/0m by typing
# fbackup -i /data -I index.data -f /dev/rmt/0m

Where,
-i /data : Backup /data directory. There is no limit on how many times the -i option can be specified i.e. -i /data -i /home -i /path/to/something

-I index.data : index.data specifies the name of the on-line index file to be generated. It consists of one line for each file backed up during the session. Each line contains the file size, the volume number on which that file resides, and the file name. If the -I option is omitted, no index file is generated.


-f /dev/rmt/0m : Specify tape device name

-e /tmp : Exclude /tmp from backup

-g /var/adm/fbackupfiles/hporabox11.backup.list.txt : File that contains a list of files / dirs to be included / excluded from the tape backup

-u : Update the database of past backups so that it contains the backup level, the time of the beginning and end of the session, and the graph file used for this fbackup session. Only use this if you are using -g /path/to/file option.


Using the normal tape location to do a full backup, insert a new tape and enter:

# fbackup -f /dev/rmt/0m -i -v

Using the normal tape location to do a full backup but exclude /tmp and /cdrom /nfs directories, insert a new tape and enter:

# fbackup -f /dev/rmt/0m -i / -e /tmp -e /cdrom -e /nfs -v

You can also create a text file that contains a list of all files and directories to be included or excluded from the backup. For example, backup full file system but exclude /tmp, /cdrom and /nfs, enet:

# cd /var/adm/fbackupfiles
# vi hporabox11.backup.list.txt

Append following list
i /
e /tmp
e /nfs
e /cdrom

Save and close the file.

To backup enter,
# fbackup -f /dev/rmt/0m -g /var/adm/fbackupfiles/hporabox11.backup.list.txt -v

No comments :

Post a Comment

Technically Exporting And Importing Disks Across HP-UX System

No comments

How to export and import disks across the HP-UX server system is one of the major requirement ?

The solution to this problem is very simple. Follow these steps to perform this operation:



Open the console by serial cable or management ip.


Step 1 - Check the volume group by typing the command after the prompt-
                   bash#  vgdisplay 
                   bash#  /dev/vgdata 

              * bash# is the prompt on the console

            

Step2 - Make the volume group unavailable
               bash# vgchange -a n /dev/vgdata

Step 3 - Export the the disk while creating a logical volume map file.
              bash# vgexport -v -m data_map vgdata

Step 4 - Disconnect the drives and move to new system.

Step 5 - Move the data_map file to the new system.

Step 6 -  On the new system recreate the volume group directory
               bash# mkdir /dev/vgdata
               bash# mknod /dev/vgdata/group c 64 0x02000

Step 7 - Import the disks to the new system
                bash# vgimport -v -m data_map /dev/vgdata /dev/dsk/c2t1d0 /dev/dsk/c2t2d0

Step 8 -Enable the new volume group
              bash# vgchange -a y /dev/vgdata


Thats it..........your done........hopefully

No comments :

Post a Comment

Unable To Login Via Root Or Console In HP-Unix

No comments
The following post is regarding the most common problem faced while using
HP-UX system.



 

Problem : 
Audit file has no space 0% left ! Unable to Login through root and also unable to login through console.



Error : current audit file size is 613959 kilobytes!!!
          an attempt to switch to the backup file failed.
          Must specify a backup file now !
          audit file has 0% free space left !

Note: This is most common Error while working on HP-UX.


Solution – Here is the tested solution

Step -1 Login HP-UX in single user mode.
1. shutdown -r 0
2. hit during 10 sec window to interrupt reboot
3. enter:
4. interact with ipl? yes
5. hpux -is (i=init, s=single user)


Step -2 Mount the all filesystem in singleusermode via command
               #mountall

Step -3 Check the root file system.
                # bdf /

Step -4 Audit data written into a logfile in your root filesystem (usually into /.secure/etc)

            Go to ./secure/etc Directory

            # cd ./secure/etc

Step -5 Delete the audfile1 and audfile2

           # cd ./secure/etc
          # rm –rf audfile1
          # rm –rf audfile2


Step -6 Reboot the server and boot in normal mode.

Now you should be able to login the root through console.

No comments :

Post a Comment

Booting HP-UX UNIX In Single User Mode

No comments
Lets see how can we boot HP Unix System from the single user mode.Follow the instructions:

  • Interrupt the boot process when prompted by pressing [ESCAPE] key. 
 You will see message as follows:
Selecting a system to boot. To stop selection process, press and hold the ESCAPE key...
 OR
Autoboot from primary boot path enabled.


  • Override the above screen , press any key within 10 seconds.
  •  Type boot pri isl at the prompt:
  • Now you will be in boot pri ISL prompt(boot pri ISL>). Type the command-
           hpux -is /stand/vmunix OR hpux -is

In the above example, the -i option is used to make the system come up in run-level s, for single user mode of operation. /stand/vmunix is optional but some time required. Usually, 'hpux -is' is more than enough to boot into single user mode.

No comments :

Post a Comment

HP-UX UNIX Backup and Recover Data to Tape Device

No comments

HP-UX Tape device names
First device will have name such as /dev/rmt/0m, /dev/rmt/1m and so on.
1. Raw magnetic tape interface - /dev/rmt/*
2. Default tape interface - /dev/rmt/0mnb

HP-UX Tape - mt ~ manipulating program
mt command winds the tape in the requested direction (forward or backward), stopping after the specified count EOF marks or records are passed.



If count is not specified, one is assumed. Each EOF mark counts as one record. When winding backwards, the tape always stops at the BOT marker, regardless of the number remaining in count.

For example, Rewind the tape associated with the device file /dev/rmt/0mnb:
# mt -f /dev/rmt/0mnb rew

No comments :

Post a Comment