Friday, January 30, 2009

AIX - Tips & Tricks

21. How to capture TCPIP packet information in IBM AIX ?

Here is a command to capture TCP/IP packet information between your server and another in IBM AIX:

Become root user, Find a temporary directory to capture the data (/tmp in this example) Run the iptrace command:

# iptrace -a -d host_destination -b /tmp/ip.out

iptrace will run in the background and results will be in /tmp/ip.out

To see the results of the trace:
# ipreport /tmp/ip.out more

Don't foregt to kill iptrace when you're done:
# ps -ef grep iptrace grep -v grep awk '{system("kill " $2)}'

Some other cool options of iptrace:
-d : specify destination IP address -s : specify origin IP address
-b : show 2-way traffic (as in "-s xxx -b" or "-d xxx -b")
-a : no ARP requests (less pollution in the trace)

To see all packets going in and out of server, unixserv, without ARP requests:

# iptrace -a -d unixserv -b /tmp/ip.out

iptrace and ipreport are in IBM AIX LPP ""


22. How to check if a system dump completed successfully on IBM AIX ?

To verify if a system dump completed successfully on an IBM AIX server:

# sysdumpdev –L
Device name: /dev/hd6
Major device number: 10
Minor device number: 1
Size: 124371456 bytes
Date/Time: Sun Sep 15 12:19:02 EDT 2002
Dump status: 0 ( 0 = Ok)
dump completed successfully
Failed to copy the dump from /dev/hd6 to /var/adm/ras


23. How to check two file systems simultaneously on different drives in IBM AIX ?

To check two file systems simultaneously on different drives in IBM AIX.The dfsck command permits you to interact with two fsck commands at once. To aid in this, the dfsck command displays the file system name with each message. When responding to a question from the dfsck command, prefix your response with a 1 or a 2 to indicate whether the answer refers to the first or second file system group.

# dfsck [ FlagList1 ] FileSystem1 [ FlagList2 ] FileSystem2

Example to check two filesystems:
# dfsck -p /dev/hd1 - -p /dev/hd7

Note: you can also specify the file system names found in the /etc/filesystems. Attention: Do not use the dfsck command to check the root file system.


24. How to make a disk flash in IBM AIX ?

For disk replacement, it is often useful to make the disk flash so that you know which disk to replace in IBM AIX:

# diag to continue
Select "Task Selection (Diagnostics, Advanced Diagnostics, Service Aids, etc.)"
Select "Hot Plug Task"Select "SCSI and SCSI RAID Hot Plug Manager"
Select "Identify a Device Attached to a SCSI Hot Swap Enclosure Device"
Select the slot you wish the disk to flash Replace the appropriate disk by checking which disk is flashing


25. How to determine which application created the OS core file in AIX ?

# /usr/sbin/lquerypv -h /path/to/core 6b0 64
The output of this command is neat, clean and easy to read.

Here is an example:

# lquerypv -h core 6b0 64
000006C0 00000000 000007D0 7FFFFFFF FFFFFFFF ................
000006D0 00120000 1312C9C0 00000000 00000017 ................
000006E0 6E657473 63617065 5F616978 34000000 netscape_aix4...
000006F0 00000000 00000000 00000000 00000000 ................
00000700 00000000 00000000 00000000 00000ADB ................
00000710 00000000 000008BF 00000000 00000A1E ................

The executable is located between the pipes on the right hand side of the output. In this case, the core was generated by Netscape.


26. How to find the system id number of an IBM AIX server ?

# lsattr -El sys0 -a systemid
# uname -u
# lscfg -vpgrep -p "System VPD:" grep -i Serial

Note: commands may not work on all IBM models


27. Tips on Memory Tuning :

Do not use the command vmtune in AIX 5L. From AIX 5L. vmo and ioo commands are introduced to tune memory and I/O.

Here is how we set various memory options now:

# vmo -p -o maxfree=128
# vmo -p -o minperm%=5
# vmo -p -o maxclient%=10
# vmo -p -o maxperm%=10
# vmo -p -o maxfree=632
# vmo -p -o minfree=600
# ioo -p -o maxpgahead=32

To see the results of the changes:
# vmo –L
# ioo –L

If you have a problem with slow telnet sessions:
# chdev -l sys0 -a maxpout='33' -a minpout='24'

To set AIO (asynchronous IO) options use smitty


28. If you reinstall an IBM AIX server and the mksysb used was for a server on another vlan, you can end up with 2 default routes. Lets see how to solve this issue
In order to see the default routes stored in the ODM:

# lsattr -El inet0 grep Route
route net,-hopcount,0,,0, Route True
route net,-hopcount,0,,0, Route True

To see the default routes you have in your routing table:
# netstat -rn grep default
default UGc 0 0 en0 - - =>
default UGc 0 0 en0 - -

To remove one of the default routes, use smitty and not a the route command otherwise you will end up with 2 default routes after a reboot.


29. EFix - How to manage ?

To list efix :
# emgr –l

To install an efix package:
# emgr -e efixPackage


30. Kernel Processes in AIX: An Overview

# ps -kl
# pstat -a (as root)

There are several kprocs, and they do a number of things. Often they have fixed priority and will run ahead of any user processes.

A couple are:
Kproc Kernel (wait) wait process
Kproc Kernel (lrud) Least Recently Used Daemon (mem mgmt)
Kproc Kernal (swapper) Memory/Process swapping ?
Kproc Kernel (kbiod) Kernel Block I/O daemon (disk I/O)?
kproc Kernel ( gil) 1032 Networking off-level stuff
Kproc Kernel (netm) Network memory allocator
Kproc Kernel (aump) Automounter

A kproc is a kernel process, started by the kernel on behalf of either another kernel process, or as a result of an application initiating a system call or call to a kernel service.
Wait - You will find that the "wait" kproc will have accumulated a lot of cpu time. This just means your system is idle a lot. When nothing else needs to run, the wait kproc is charged the time slice

GIL - "Global ISR List"
ISR->Interrupt Service Routines - multithreaded kproc runs at fixed pri of 37 Used to process various timers (tcp, streams, ....) and also used to pass packets from demux layer to IP layer for non-CDLI drivers.

ps -lk
The processes with nice value of -- are running with fixed priorities. Their nice values can not be changed. On my system that would processes such as swapper (pid=0, pri=16) and the wait kproc (pid=514, pri=127).

This will list out all the kprocs. Now do a pstat -a to find what they really are?
This will show you the real name of the kproc.

Aump kernel thread is left over after you stop the automounter daemon.
Yes. It goes away after reboot. However, there is an APAR for it: IY33240


No comments: