Sunday, December 11, 2011

Useful tips in AIX

ls -l /home | sort -rn        This displays files and directoris inside /home as per their size, larger file on top.

ls -l /home/* sort -rn        This displays files and also the subdirectories in the /home/ directories as per their size, larger one on top.

Note:  If /home dir. contains more than one dir. then it first shows all the directiory name and then the files inside the directories as per the directory order. The order is symlink, Directory name, file name.

du /home | sort -rn          This also displays the subdirectories inside /home as per their size but not files.

du -m /home/test/smit.log     This shows the size of the smit.log in MB. 
-g=GB, -k=KB, without flag=shows in Block size.


ls -lrt | grep 'Jan 10' | awk '{print$9}' > namefile          This is used to get only the file names dated Jan 2010 in a namefile

rm `cat namefile`           To delete filenames mentioned in the namefile created by the above command. 


To execute a command in a loop, i.e. in a certain intervals, put the small script in the shell

while i=
do
df -g /backup
sleep 3
done

in the above example this will show the size of /backup filesystem in each 3 seconds interval.


stty erase ^?       To use backspace button to clear previous letters.

set -o vi      To see previous executed commands using vi style
i.e. esc+ j=up, h=down, l=go right, g=go left, /string= search the command from history, 

How to disable telnet in AIX

#vi /etc/inetd.conf

comment out telnet from this file (#telnet ... ... .. )

save it and

#refresh -s inetd

Then telnet session will be disabled in that server from now.

Short forms related to IBM AIX


IBM         International Business Machines 

AIX        Advanced Interactive eXecutive (Advanced IBM uniX)

POWER   Performance Optimized With Enhanced RISC

RISC       Reduced Instruction Set Computing

CISC      Complex Instruction Set Computing

SCSI      Small computer Simple Interface

PCI       Peripheral Component Interconnect

ISA       Industry Standard Architecture

MCA     Micro Channel Architectural

CHRP    Common Hardware Reference Platform

SMP      Symmetric Multi Processor

PSSP     Parallel System Support Programs

LPAR    Logical PARtition 

HACMP  High Availability Cluster Multi Processing

RSCT   Really Scalable ( RS6000) Cluster Technology

P2SC   POWER2 Super Chips

RAS     Releability Availability Serviceability

SMP    Symmetric Multi Processing

NUMA   Non-Uniform Memory Access

MPP     Massively Parallel Processing

CMP    Chip Multi Processing

CAD   Computer Aided Design

CWS   Controll Work Station

ISB    Intermediate Switch Boards

SDR    System Data Depository

PVM   Parallel Virtual Machine

MPI   Message Passing Interface

HPF   High Performance FORTRAN 

HMC     Hardware Management Console

ASM     Advanced System Management

NIM      Network Installation Manager

LPP      Licenced program Product

BOS     Base Operating System

APAR    Authorized program Analysis Report

SMS     System Management Services

SRC     System Resource Controller 

JFS       Journaled File System

JFS2     Enhanced Journaled File System

CDRFS   CD-ROM File System

UDFS     Universal Disk Format Specification

CIFS      Common Internet File System

NFS      Network File System

NBPI     Number of Bytes Per Inode 

WSM    Web based System management

RMC     Resource Monitoring and Controll

DAT     Digital Audio tape

QIC     Quarter Inch Catridge

DLT     Digital Linear Tape

LTO     Linear tape Operation

TAR     Tape ARchive

CPIO   CoPy Input to Output 

DD      Device to Device

TCTL   Tape  ConTroL 

DCE    Distributed Computing Environment 

CDE    Common Desktop Environment

PPA    parallel Port Adapter

TCP/IP     Transmission Control Protocol / Internet protocol

DARPA    Department of Advanced Research Projects Agency

IAB      Internet Architecture Board

RFC     Request For Comments

LAN     Local Area Network

WAN    Wide Area Network

NIS     Network Infornation Services

DNS    Domain Name Service

DHCP   Dynamic Host Configuration Protocol

NCS     Network Computing System

ICMP    Internet Control Message Protocol

PING    Packet InterNet Gropher

ODM     Object Data Manager

SWVPD   SoftWare Vital Product Data

SRC    System Resource Controller

SMIT  System Management Interface Tool

PUN   Physical Unit Number

LUN   Logical Unit Number

LVM   Logical Volume Manager 

VGDA    Volume Group Descriptor Area

VGSA     Volume Group Status Area

LVCB    Logical Volume Control Block

LVDD  Logical Volume Device Driver

PDT    Performance Diagnostic Tool

SSH    Secured SHell

RSH    Restricted SHell 

EA       Extended Attributes

ACL     Access Controll List

TCB    Trusted Computing Base

SAK    Secure Authentication Key

SAN    Storage Area Network

NAS    Network Area Storage (by NFS)

Fix a corrupted BLV in AIX

Recreate BOOT LOGICAL VOLUME (BLV) in AIX
If a Boot Logical volume (BLV) is corrupted, a machine will not boot.
(Eg:bad block in a disk might cause a corrupted BLV)

To fix this situation, You must boot your machine in maintenance mode, from a CD or Tape. If a NIM has been setup for a machine, you can also boot the machine from a NIM master in maintenance mode.

The bootlists are set using the bootlist command or through the SystemManagement Services Progam (SMS). pressing F1 will go to SMS Mode.

then change the bootlist for service(maintenance) mode as 1st device to CD ROM.

#bootlist -m service cd0 hdisk0 hdisk1

then start maintenance mode for system recovery,

Access rootvg,

access this volum group to start a shell,

then recreate BLV using bosboot command.

#bosboot -ad /dev/hdisk0

it's important that you do a proper shutdown, All changes need to be written from memory to disk.

#shutdown -Fr

Imp: bosboot command requires that boot logical volume hd5 exists. If you wan create a BLV ( may be it had been deleted by mistake ), do the following,

1. boot your machine in maintenance mode,
2. Create a new hd5 logical volume, one PP size, must be in rootvg,specifyboot as logical volume type,

#mklv -y hd5 -t boot rootvg 1

3. Then run bosboot command as described.


If you have an HMC, then at the time of booting select boot as SMS in theproperties of that partition.

Link Aggregation ( Network Bonding ) in AIX

Link aggregation means you can give one IP address to two network cards and connect to two different switches for redundancy purpose. In this only one network card will be active in one time, and when it got failed the other network card goes active and let us continue our work.

It is better to use through SMIT.

#smit 

then goto

Devices > Communication > EtherChannel / IEEE 802.3ad Link Aggregation > Add An EtherChannel / Link Aggregation 

here select the network card that you want to use, ie active.

Eg: select ent0

IMP : then select Mode as 8023ad 

then select backup adapter for redundancy.(press F4 to show N/W adapters.)

Eg: ent1

press enter.

now ent0 and ent1 got bonded.

then automatically a virtual adapter will be created named ent2.

then put IP address and all to this virtual adapter.

#smit

Communications Applications and Services > TCP/IP > Minimum Configuration & Startup 

here select ent2 ( new bonded virtual adapter )

put IP Address and all,

give start now option.

Now you are successfully completed Link aggregation and check whether it works or not by removing the 2nd cable to the network card and check ping, then put the 2nd cable and remove 1st cable. 2 - 3 drops normally occurs in my experience.

Configure NTP on AIX

configure NTP Server on AIX

1.Verify that you have a suitable NTP server.

#lssrc -ls xntpd

Note : sys peer should show a valid server or 127.127.1.0
If the server is "insane", you should need to correct it by adding a server line into /etc/ntp.conf and restarting xntpd.

Following these steps

#vi /etc/ntp.conf

Add server :

server 127.127.0.1

Double check that "broadcastclient" is commented.

#stopsrc -s xntpd
#startsrc -s xntpd


Note : If the server runs databases, use the -x flag to prevent the clock from changing in a negative direction. Enter the following:

#startsrc -s xntpd -a "-x"

2.Enter

#lssrc -ls xntpd

to verify that the server is synched. This process can take upto 12 minutes.
configure NTP Client on AIX

1. Verify that you have a server suitable for synchronization, Enter:

#ntpdate -d ip.address.of.server

The offset must be less than 1000 seconds for xntpd to synch. If the offset is greater than 1000 seconds, change the time manually on the client and run ntpdate -d again.

If you get the message ," no server suitable for synchronization found", verifyxntpd is running on the server (see above )and that no firewalls are blocking port 123.

2. Specify your xntpd server in /etc/ntop.conf, Enter

#vi /etc/ntp.conf

comment "broadcastclient" line and add

server ip.address.of.server prefer

leave the driftfile and tracefile at their defaults.

3. start the xntpd daemon,

#startsrc -s xntpd

( use the -x flag if it is appropriate in your environment.)

4. Uncomment xntpd from /etc/rc.tcpip so it will start on reboot.

#vi /etc/rc.tcpip

Unconmment the following line

start /usr/sbin/xntpd "$src-running"

If using the -x flag, add "-x" to the end oof the line. you must include the qoutes around "-x"

5. verify that the client is synched.

#lssrsc -ls xntpd

Note: sys peer should display the IP Adress or name of your xntpd server.This process may take 12 minutes

NIM related Commands in AIX

lsnim     To list the nim resources

lsnim -l  dcmds     To list the detailed info about the object dcmds


lsnim -O dcmds     To list the operation dcmds object can support


lsnim -c resources dcmds   To list the resources allocated to the machine dcmds


nimclient    The client version of nim command (User can obtain same results of nim in server ) 

nimconfig -a pif_name=en0 -a netname=net1    To initialise the NIM master with network name net1

nimconfig -r    To rebuild /etc/niminfo file which contains the variables for NIM

nim -o define  -t  lpp_source  -a  source=/dev/cd0  -a  server=master  -a  location=/export/lpp_source/lpp_source1   lpp_source1   
  To define  lpp_source1 image in /export/lpp_source/lpp_source directory from source cd0

nim -o define -t mksysb -a server=master  -a location=/resources/mksysb.image mksysb1    To define mksysb resource mksysb1, from source /resources/mksysb.image on master 


nim -o remove inst_resource    To remove the resource inst_resource 

nim -o check lpp_source1   To check the status of  lpp_source lpp_source1


nim -o allocate -a spot=spot1 -a lpp_source=lpp_source1 node1   To allocate the resources spot1 and lpp_source1 to the client node1


nim -o bos_inst node1   To initialise NIM for the BOS installation on node1 with the allocated resources

nim  -o dkls_init dcmds  To initialize the machine dcmds as diskless operation 

nim -o dtls_init dcmds   To initialize the machine dcmds for dataless operation 

nim -o cust dcmds    To initialize the machine dcmds for customize operation 

nim -o diag dcmds    To initialize the machine dcmds for diag operation 

nim -o maint dcmds    To initialize the machine dcmds for maintenance operation 

nim -o define -t standalone -a platform=rspc -a if1="net1 dcmds xxxxx" -a cable_type1=bnc dcmds    To define the machine dcmds as standalone with platform as rspc and network as net1 with cable type bnc and mac address xxxxx 

nim -o unconfig master    To unconfigure nim master 

nim -o allocate -a spot=spot1 dcmds  To allocate the resource spot1 from machine dcmds 

nim -o deallocate -a spot=spot1 dcmds   To de allocate the resource spot1 from machine dcmds

nim -o remove dcmds   To remove machine dcmds after removing all resources associated to it


nim -o reboot dcmds   To reboot ther client dcmds


nim -o define -t lpp_source -a location=/software/lpp1 -a server=master -a source=/dev/cd0 lpp1    To define lppsource lpp1 on master at /software/lpp1 directory from source device /dev/cd0

Useful HACMP Commands

clstart -m -s -b -i -l           To start cluster daemons (m-clstrmgr, s-clsmuxpd, b-broadcast message, -i-clinfo, -l cllockd)

clstop -f -N           To force shutdown cluster immediately without releasing resources


clstop -g -N            To do graceful shutdown immediately with no takeover


clstop -gr -N            To do graceful shutdown immediately with takeover 


cldare  -t                To sync the cluster toplogy 

cldare -t -f            To do the mock sync of topology

cldare -r                To sync the cluster resources


cldare -r -f            To do the mock sync of resources
 

clverify                cluster verification utility

cllscf                To list clustur topology information

cllsclstr                To list the name and security level of the cluster


cllsnode                To list the info about the cluster nodes


cllsnode -i node1            To list info about node1


cllsdisk -g shrg            To list the PVID of the shared hard disk for resource group shrg


cllsnw                To list all cluster networks
 

cllsnw -n ether1            To list the details of network ether1

cllsif                To list the details by network adapter


cllsif -n node1_service        To list the details of network adapter node1_service


cllsvg                To list the shared vgs which can be accessed by all nodes


cllsvg -g sh1            To list the shared vgs in resource group sh1


cllslv                 To list the shared lvs 


cllslv -g sh1            To list the shared lvs in the resource group sh1


cllsdisk -g sh1            To list the PVID of disks in  the resource group sh1


cllsfs                To list the shared  file systems 


cllsfs -g sh1            To list the shared file systems in the resource group sh1


cllsnim                Show info about all network modules


cllsnim -n ether            Show info about ether network module


cllsparam -n node1        To list the runtime parameters for the node node1


cllsserv                To list all the application servers


claddclstr -i 3 -n dcm         To add a cluster definition with name dcm and id 3


claddnode             To add an adapter


claddnim            To add network interface module


claddgrp -g sh1 -r cascading -n n1 n2       To create resource group sh1 with nodes n1,n2 in cascade


claddserv -s ser1 -b /usr/start -e /usr/stop       Creates an application server ser1 with startscript as /usr/start and stop script as /usr/stop


clchclstr -i 2 -n dcmds          To change cluster definitions name to dcmds and id to 2
clchclstr -s enhanced        To change the clustur security to enhanced

clchnode            To change the adapter parameters

clchgrp                To change the resource group name or node relationship


clchparam            To change the run time parameters (like verbose logging)


clchserv                To change the name of app. server or change the start/end scripts


clrmclstr                To remove the cluster definition

clrmgrp -g sh1            To delete the resource group sh1 and related resources


clrmnim    ether            To remove the network interface module ether


clrmnode -n node1        To remove the node node1


clrmnode -a node1_svc        To remove the adapter named node1_svc


clrmres -g sh1            To remove all resources from resource group sh1


clrmserv  app1            To remove the application server app1


clrmserv ALL            To remove all applicaion servers


clgetactivenodes -n node1        To list the nodes with active cluster manager processes from cluster manager on node node1


clgetaddr node1            returns a pingable address from node node1


clgetgrp -g sh1            To list the info about resource group sh1


clgetgrp -g sh1 -f nodes        To list the participating nodes in the resource group sh1


clgetif                To list interface name/interface device name/netmask associated with a specified ip label / ip address of a specific node


clgetip sh1            To get the ip label associated to the resource group

clgetnet 193.9.200.2  255.255.255.0     To list the network for ip 193.9.200.2, netmask 255.255.255.0

clgetvg -l nodelv            To list the VG of LV nodelv


cllistlogs            To list the logs


clnodename -a node5           To add node5 to the cluster


clnodename -o node5 -n node3       To change the cluster node name node5 to node3


clshowres            Lists resources defined for all resource group


clfindres                To find the resource group within a cluster


xclconfig             X utility for cluster configuration


xhacmpm            X utility for hacmp management


xclstat                X utility for cluster status


HACMP LOGS
=========

/tmp/hacmp.out        Detailed event script output logged in 7 day rolling history


/var/adm/cluster.log      High level view of cluster events (No clean up on this file)


/usr/sbin/cluster/history/cluster.mmdd    Day by day view of cluster events. (one file / day of month)


/tmp/cm.log        Clstrmgr messages


/tmp/cspoc.log           Output from C-SPOC commands (similar to smit.log)


/tmp/emuhacmp.out    Output from event emulation


rdist  -b -f  /etc/disfile1       To distribute the files in disfile1 to all nodes in disfile1 in binary mode

Sample entry for disfile1
 
            HOSTS = ( root@node1 root@node3 )
            FILES = ( /etc/passwd /etc/security/passwd)
            ${FILES} -> ${HOSTS}
 

/usr/es/sbin/cluster/utility/*   (All commands)