Wednesday, 17 December 2014

Linux

Linux
------
Linux serial Number--#dmidecode -t system
Linux Cluster -- #rpm -q redhat-config-cluster
Linux os level -- #uname -a and cat /etc/*-release
----------------------------------------------------------------------------------------------------------------------------------------------------
user
---------------------
useradd -g primary_group -G group1,group2,... -d /home/user_name -m -s shell user_name----syntax

useradd -g olympus -G wheel -d /home/lmarc -m -s /usr/bin/ksh lmarc ---to create user

chfn lmarc --- for change the gecos

chage -E "2013-11-05" lmarc  ------to set account expiry

useradd -c 'Chandran Kuselan' -g wheel ckuselan
---------------------------------------------------------------------------------------------------------------------------------------------------
Password reset for hp unix server.

First set the password using password command
passwd vijay
then type the below command for to promt the user to reset the password
passwd -f vijay
----------------------------------------------------------------------------------------------------------------------------------------------------
Disk scanning on linux

echo " - - - " >
 /sys/class/scsi_host/host0/scan
echo 1 >
 /sys/class/scsi_host/host0/scan

[root@dmnp23cis1 scsi_host]# ls -l
total 0
drwxr-xr-x 2 root root 0 Jul  9 03:41 host0
drwxr-xr-x 2 root root 0 Jul  9 03:41 host1
drwxr-xr-x 2 root root 0 Aug 22 23:36 host2
drwxr-xr-x 2 root root 0 Aug 22 23:36 host3
drwxr-xr-x 2 root root 0 Aug 22 23:36 host4
drwxr-xr-x 2 root root 0 Aug 22 23:36 host5
drwxr-xr-x 2 root root 0 Jul  9 03:41 host6
drwxr-xr-x 2 root root 0 Jul  9 03:41 host7
------------------------------------------------------------------------------------------------------------------------------------------------
Service or daemon on Linux
---------------------------
To check the daemon service on linux
/etc/init.d/<daemon name> start | restart | stop | status
chkconfig -- will  show more details per runlevel abt the daemons
chkconfig | grep vsftpd --> will show you whether vsftps configured for auto  start on any runlevel.
runlevel -- to know the current run level
chkconfig --level 3 vsftpd on   ----> whenever system reboot happen vsftpd will autoon on the runlevel 3.
chkconfig --level 35 vsftpd on   ----> whenever system reboot happen vsftpd will autoon on the runlevel 3 and 5.
cd /etc/rc.d/rc3.d --> Inside of this folder we have the vsftpd file.
chkconfig --del vsftpd  --> vsftpd service removed from the startup.If you check inside of /etc/rc.d/rc3.d vsftpd wont be there
ntsysv -- Through this Command we can chekc and uncheck enabling the service.

----------------------------------------------------------------------------------------------------------------------------------------------------
To set or verify the ulimit values on Linux:
a.Log in as the root user.
b.Edit the /etc/security/limits.conf file and specify the following values:
admin_user_ID soft nofile 32768
admin_user_ID hard nofile 65536
admin_user_ID soft fsize unlimited
admin_user_ID hard fsize unlimited
admin_user_ID soft data unlimited
admin_user_ID hard data unlimited
admin_user_ID soft stack unlimited
admin_user_ID hard stack unlimited
admin_user_ID soft rss unlimited
admin_user_ID hard rss unlimited
admin_user_ID soft core unlimited
admin_user_ID soft core unlimited

----------------------------------------------------------------------------------------------------------------------------------------------------
"defunct" processes
--------------------
A "defunct" processes is also known as a "zombie" processes. A Zombie process is referred as dead process which is receding on your system though its completed executing. In one shot we can say its a dead processes which is still in RAM. This process will be in your process table and consuming your memory. Having more defunct process will consume your memory which intern slows your system. We have to kill the defunct process in order to free RAM and make system stable.
Why defunct process are created?
Ans : When ever a process ends all the memory used by that process are cleared and assigned to new process but due to programming errors/bugs some processes are still left in process table. These are created when there is no proper communication between parent process and child process.
Some FAQ?
1. How to find a defunct process?
And : Grep defunct value in ps -ef output
#ps -ef | grep defunct
2. How can I kill a defunct process?
And : Just use kill command
#kill defunct-pid
3. Still not able to kill?
Ans : Then use kill -9 to force kill that process
#kill -9 defunct-pid
4. Still have an issue in killing it?
Ans : Then try to kill its parent id and then defunct.
#kill parent-id-of-defunct-pid
Then
#kill -9 parent-id-of-defunct-pid
5. Still having defunct?
Ans : If you still find defunct process eating up RAM then last and final solution is to reboot your machine(This is not preferred on production boxes).
6.What is orphan process?
Ans : An orphan process is said to be a process which runs though parent process is terminated, these process do not know what to do and when to terminate.
7. What is difference between orphan and defunct processes?
Ans : A defunct process is a dead process where there is no execution happening where as orphan process is a live process which is still in execution state but don't have parent process
I am having a system which daily creates defunct process, I cannot sit and kill these process on daily basis.
How to get rid of this problem?
Ans : Just write a shell script to grep defunct process and kill them by putting this script in corntab.
----------------------------------------------------------------------------------------------------------------------------------------------------
How to find wwn in Redhat Linux?

a.    Below is the simple command to find WWN on Redhat servers.

systool -c fc_host –v

# systool -c fc_host -v | grep "port_name"
    port_name           = "0x5001438001347fdc"
    port_name           = "0x5001438001347fde"
    port_name           = "0x50014380013471f0"
    port_name           = "0x50014380013471f2"
#

b.    Below is the simple steps to find WWN in Linux.

Step 1:  cd /sys/class/fc_host
Step 2:  cd to the host# directory.
Step 3: cat node_name

Useful command to find to list the FC Adapter

lspci | grep -i Fibre


c.    To find WWN on linux with Emulex:
If you find difficult to find WWN on linux with Emulex HBA use below hbacmd to list the HBAs. This only available if hbanyware installed.

cd /usr/sbin/hbanyware
[root@tilak_phy01 hbanyware]# ./hbacmd ListHBAs

Manageable HBA List
Port WWN   : 11:00:00:00:d9:58:bf:92
Node WWN   : 10:00:00:00:b9:58:ba:92
Fabric Name: 20:3f:01:04:51:a1:71:00
Flags      : 1100a980
Host Name  : tilak_phy01
Mfg        : Emulex Corporation
----------------------------------------------------------------------------------------------------------------------------------------------------
Disk scanning on linux

echo " - - - " >
 /sys/class/scsi_host/host0/scan
echo 1 >
 /sys/class/scsi_host/host0/scan

[root@dmnp23cis1 scsi_host]# ls -l
total 0
drwxr-xr-x 2 root root 0 Jul  9 03:41 host0
drwxr-xr-x 2 root root 0 Jul  9 03:41 host1
drwxr-xr-x 2 root root 0 Aug 22 23:36 host2
drwxr-xr-x 2 root root 0 Aug 22 23:36 host3
drwxr-xr-x 2 root root 0 Aug 22 23:36 host4
drwxr-xr-x 2 root root 0 Aug 22 23:36 host5
drwxr-xr-x 2 root root 0 Jul  9 03:41 host6
drwxr-xr-x 2 root root 0 Jul  9 03:41 host7
----------------------------------------------------------------------------------------------------------------------------------------------------
Filesystem increase Linux
--------------------
[root@compdb1rx ~]# df -m /u02
Filesystem           1M-blocks      Used Available                       Use%    Mounted on
/dev/mapper/vg_datavg-lv_u02           35278     33470     17   100%    /u02

[root@compdb1rx ~]#  lvextend -L +10G /dev/mapper/vg_datavg-lv_u02
  Extending logical volume lv_u02 to 45.00 GiB
  Logical volume lv_u02 successfully resized
[root@compdb1rx ~]# resize2fs /dev/mapper/vg_datavg-lv_u02
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_datavg-lv_u02 is mounted on /u02; on-line resizing required
old desc_blocks = 3, new_desc_blocks = 3
Performing an on-line resize of /dev/mapper/vg_datavg-lv_u02 to 11796480 (4k) blocks.
The filesystem on /dev/mapper/vg_datavg-lv_u02 is now 11796480 blocks long.

[root@compdb1rx ~]# df -m /u02
Filesystem           1M-blocks      Used Available                     Use%    Mounted on
/dev/mapper/vg_datavg-lv_u02   45357     33474      9580   78%  /u02

For RHEL4 and requires different command to extend the file system.  Please see below command what I ran.
----------------
[root@csclabdb01 ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/sdbi2 VG00 lvm2 a-   84.09G 8.31G

[root@csclabdb01 ~]# lvextend -L +1G /dev/VG00/lvol2
  Extending logical volume lvol2 to 4.50 GB
  Logical volume lvol2 successfully resized

[root@csclabdb01 ~]# ext2online   /usr
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
[root@csclabdb01 ~]# df -h /usr
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VG00-lvol2
                      4.5G  2.4G  1.9G  55% /usr

----------------------------------------------------------------------------------------------------------------------------------------------------
Cluser on Linux
----------------
Lets have everyone see this so they know what to do when they run to similar issue.
Seems like this a 3 node redhat cluster. look below please . first you need to make sure the file system you are trying to extend is part of the cluster or not part of the cluster.
Here the path to redhat cluster configuration,  /etc/cluster/cluster.conf.  in this case you are trying to extend the /ora_backup file system
Do a  “grep  /ora_backup   /etc/cluster/cluster.conf “ if you don’t find it then the file system is not part of the cluster.  from looking thru the cluster.conf , it seems /svr_home is the only file system which is clustered. And this file system /svr_home is a gfs type file system..

  so /ora_backup you are trying to extend  is a stand alone file system on csclab01 server ( not clustered ) .  also there is no Linux multipathing on these servers. This cluster is running EMC powetpath.
Please make sure Storage folk are presenting this lun ( 50 gig ) just to csclab01 server ( this is not a cluster lun ). After the LUN is provisioned/presented to csclab01 server, do the steps below:
here the steps you need to do:
1-      # fdisk   -l |grep sd   >/tmp/fdisk.out.before
2-      # ls –al  /sys/class/fc_host    ( to see your HBAs )
3-      # echo 1 >/sys/class/fc_host/host5/issue_lip  ( to probe the first HBA to discover the new lun )
4-      # echo 1 >/sys/class/fc_host/host6/issue_lip  ( to probe the second HBA to discover the new lun )
5-       # fdisk   -l |grep sd   >/tmp/fdisk.out.after   ( now you can compare the disk.out.before and after to see the new luns OS sees )
6-      At this point OS see it but powerpath don’t know anything about the new disk, so you have the powerpath to discover the new lun
7-      # powermt display  dev=all  >/tmp/powermt.out.before
8-      # powermt config  ( to discover the new lun via powerpath )
9-      # powermt display  dev=all  >/tmp/powermt.out.after
10-  # vi  /tmp/powermt.out.after     ( and look for new powerpath lun. Look for the disk that you discover in fdisk and cross-reference that to emcpower<?>
11-  # pvcreate   /dev/emcpower<?>
12-  # pvs  ( you should be able to see it in your list and not being part of any VG )

[root@csclab01 host5]# pvs
  PV             VG   Fmt  Attr PSize   PFree
  /dev/emcpowera VG12 lvm2 a-    60.00G 1020.00M
  /dev/emcpowerb VG01 lvm2 a-   120.00G       0
  /dev/emcpowerc VG11 lvm2 a-    30.00G 1020.00M
  /dev/emcpowere VG01 lvm2 a-   100.00G 1016.00M
  /dev/emcpowerf      lvm2 a-    50.00G   50.00G
dev/sda2      VG00 lvm2 a-    66.41G   17.53G

13-   # vgextend   /dev/<vgname>     /dev/emcpower<?>
14-  # Now you should be able to extdend you file system

15-  # lvextend  -L +50G   /dev/<vgname>/<lv_name

16-  # resie2fs   /dev/<vgname>/<lv_name


[root@csclab01 cluster]# clustat
Cluster Status for hlab_cluster @ Tue Dec 16 01:49:39 2014
Member Status: Quorate

Member Name                                                     ID   Status
------ ----                                                     ---- ------
csclab01-int                                                        1 Online, Local, rgmanager
csclab02-int                                                        2 Online, rgmanager
csclab03-int                                                        3 Online, rgmanager

Service Name                                             Owner (Last)                                             State
------- ----                                             ----- ------                                             -----
service:hlab_gfs_svc                                     csclab03-int                                             started
service:hlab_prod                                        csclab01-int                                             started
service:hlab_test                                        csclab01-int                                             started
service:hlab_upgrade                                     (none)                                                   disabled
-------------------------------------------------------------------------------------------------------------------------------------------------------

AIX General

IBM General
-----------
1.Go to http://www.ibm.com. Click the Products tab, then click Systems > Power Systems (AIX, IBM i, Linux) in the context menu and explore this page. This page contains information about the current POWER processor-based models. A large number of links, useful documents, and detailed information are available. Depending on your interest, click the different links and explore the information that is available.
2.Go to http://www.ibm.com. Click the Support and downloads tab, follow the context menu, click Support by products, and then go to Servers & Systems. This will take you to the Support for IBM Systems page. From the Select product or service type for support list, select Power. Select a Power System model from the Hardware drop-down list, and click Go. Explore the page, follow the different links in the Configuration, Documentation, Diagnostic, and Problem resolution menus.
3.Use the following web address to access the IBM Systems Information Center: http://publib.boulder.ibm.com/eserver. This page is the entry point for hardware as well as software information. Click the IBM Systems Hardware Information Center link.
4.Go to the AIX Information Center. Use the following URL:
http://publib.boulder.ibm.com/eserver
Click AIX Information Center link and, if the next page provides choices, select the AIX 7.1 link.
When you are at the resulting IBM Systems Information Center page, select AIX PDFs. This topic contains links to PDF versions of the AIX documentation.
5.Go to the Power Systems Software website and see what is available: http://www.ibm.com/systems/power/software. Click the PowerVM - Virtualization without limits link. Navigate the page and the different tabs.
6.Find Linux information for POWER6 and POWER7 processor-based servers by visiting this site: http://www.ibm.com/systems/power/software/linux
----------------------------------------------------------------------------------------------------------------------------------------------------
Run level for the system is always read from /etc/inittab
----------------------------------------------------------
Syntax:
<ID>:<Run Level>:<Action>:<Command>
Run level is used for maintenance purpose.
In AIX, there are 10 run levels from 0 to 9.
0 and 1 is reserved run levels.
2 is default run level.
3 to 9 is user defined run level.
Eg:
Oracle:2/3/6/8:<once>/<wait>/<respawn>:startsrc –s oracle
Explanation:
Oracle is the ID,
2/3/6/8 is the run level for this particular process,
Once, wait, respawn is the action taken on this particular process where once means the process will run and stop, wait means will wait for the process to complete (if error occurs will stop, system needs to be rebooted then) & respawn means if the process does not exists, it will start it.
Startsrc –s oracled is the command given to start the subsystem oracle daemon.
To modify records of the /etc/inittab file, commands used are:
Mkitab : will add new record (entry) in /etc/inittab
To add an entry in /etc/inittab file,
# mkitab <rule>
For eg:
# mkitab “cdrom : 2 : respawn : startsrc –d cdromd”
Chitab : will change the existing records in /etc/inittab
To change an entry in /etc/inittab file,
# chitab <rule>
For eg:
# chitab “cdrom : 3 : respawn : startsrc –s cdromd”
Rmitab : will remove the records from /etc/inittab
To change an entry in /etc/inittab file,
# rmitab <rule>
For eg:
# rmitab “cdrom : 3 : respawn : startsrc –s cdromd”
Lsitab : will list the records available in /etc/inittab
To list entries in /etc/inittab file,
# lsitab <rule>
For eg:
# lsitab “cdrom : 3 : respawn : startsrc –s cdromd”
Here’s a question, check whether the records listed by lsitab command is same as # cat /etc/inittab?
To identify current run level, command used is:
# cat /etc/init.state
OR
# who –r
----------------------------------------------------------------------------------------------------------------------------------------------------
Boot and console messages can be used to identify and fix problems. These messages are automatically stored on disk by AIX. To view the stored messages, use the alog command.
-------------------------
For example,
To List the defined log types in AIX
alog -L                  # alog -L boot bosinst nim console cfg dumpsymp  To View the boot log in AIX  alog -o -t boot  
To View the console log in AIX    alog -o -t console    
To find out the properties of boot log file in AIX
# alog -L -t boot file:size:verbosity /var/adm/ras/bootlog:131072:1
----------------------------------------------------------------------------------------------------------------------------------------------------
To View failed Login
---------------------
who -aH /etc/security/failedlogin | pg

To clear the password policy
----------------------------
#pwdadm -f NOCHECK vjayapal
----------------------------------------------------------------------------------------------------------------------------------------------------
To view large fie size through find command
------------------------------------------
find . -type f -size +1000000 -exec ls -al {} \;

Removing old files
------------------
find /prod/postoffice -type f -mtime +120 -name "*.retr" -depth -xdev -exec rm -ef {} \;

Run it as root

In the cron tab
---------------
03 17 * * 6 find /prod/postoffice -type f -mtime +120 -name "*.retr" -depth -xdev -exec rm -ef {} \\; >/stats/retr_cleanup.log 2>&1

To find the which process consuming more cpu.
----------------------------------------------
ps aux | head -1; ps aux | sort -rn +2 | head -20


To find the large file in the directory on aix
du -a /tmp | sort -n -r | head -n 10
find /tmp -size +2000 -exec ls -s {} \; | sort -nr | more
find /tmp -xdev -size +2048 -ls
find /tmp -xdev -mtime 0 -ls
----------------------------------------------------------------------------------------------------------------------------------------------------
Net Backup stop and start

/usr/openv/netbackup/bin/goodies/netbackup stop

/usr/openv/netbackup/bin/goodies/netbackup start

To check backup process running ?

cd /usr/openv/netbackup/bin

./bpps -a  -- > it is show you whether running or not.

Another method

>ps -ef | grep -i bpcd
     hbo 23986252 4849818 0 12:35:25 - 0:00 /usr/openv/netbackup/bin/bpcd
    root 55705830 39977140 0 12:36:07 pts/305 0:00 grep -i bpcd

/etc/rc.client.netbackup start

kill -9 `bpps -a | grep root | awk '{ print $2 }'`

To check any backup currently running

ps -ef | grep -i bpbkar
----------------------------------------------------------------------------------------------------------------------------------------------------
To Know the SP level in HACMP
------------------------------
>  /usr/es/sbin/cluster/cspoc/cli_on_cluster -S halevel -s
rdcp01epica1: 7.1.1 SP6
rdcp01epica2: 7.1.1 SP5
root@rdcp01epica2 in /

Cluster freezing
------------------
Smitty cl_admin

select HACMP Resource Group and Application Management
select Suspend/Resume Application Monitoring
select Suspend Application Monitoring
select the Application server you want to suspend or freez.

It will disable the application monitoring and avoid the failover. Once you
are done with your oracle patching, you have to follow the same steps to
unfreez the application server.

Cluster filesystem increase.
----------------------------
root@chicondb1 in /usr/es/sbin/cluster/cspoc
> ./cli_chfs -a size=+100G /u01/app/oracle/data01
root@chicondb1 in /usr/es/sbin/cluster/cspoc

----------------------------------------------------------------------------------------------------------------------------------------------------
defunct process
---------------
Kill the defunct process in aix.
ps -ef|grep defunct|awk '{print $2}'|xargs -n 1 kill -9
ps -ef | grep "<defunct>" | grep -v grep | awk '{print $2}' | xargs kill -9

----------------------------------------------------------------------------------------------------------------------------------------------------
Fix the unixadm issue.(ssh password less authentication)
-----------------------------------------------------------
In destination server already unixadm account prsents ,then just reset the password for unixadm in the destination server and set the password is permanent.now try ssh.
If account is not there in destination server do the following
1.create the unixadm account in the destination server.
2.create a directory name as called as .ssh and inside of it create the file name called as authorized_keys
3.just copy the id_rsa.pub file(from /home/unixadm/.ssh/) and paste it in the destination server in the place of /home/unixadm/.ssh/
4.now give the command like this cat id_rsa.pub >> authorized_keys
5.Now remove the id_rsa.pub in the destination server.
Now checkit out from nim server it will works.
----------------------------------------------------------------------------------------------------------------------------------------------------
Nagios Administration

1.http://dmns04nag1.nitc.catholichealth.net/nagiosql/
Use the unixadm1 and unixadm123 the another user name password will be asked
user name : admin
Password :W1shB0ne

another account veena and the password is temp@123

2.Click supervision under that hosts will be there.By searching the hosts u can find out specific one.
Then select the specific host and through right side icons you can modify service and delete the hosts and copy the same to hosts like that.
copying is for safety purpose.

3.After all the changes done, go to tools under that click nagios control click the do it button one by one.

Write monitoing data --> after pressed do it.It should provide you completed.If you are facing any error you should not click next doit button.This is suitable for all the buttons.
Write additional data -- Doit
Check configuration files--Doit
Restart Nagios -- DOit
----------------------------------------------------------------------------------------------------------------------------------------------------
To check gpfs filesystems.
root@chiconapp1 in /
> mmlsnsd -m

 Disk name    NSD volume ID      Device         Node name                Remarks      
---------------------------------------------------------------------------------------
 lawsond1     0AFABCC64AB38CC1   /dev/hdiskpower6 chicongpfs01            
 lawsond2     0AFABCC64AB38CC2   /dev/hdiskpower34 chicongpfs01            
 lawsond3     0AFABCC64AB38CC3   /dev/hdiskpower7 chicongpfs01            
 lawsonm1     0AFABCC64AB38CC4   /dev/hdiskpower35 chicongpfs01            
 lawsonm2     0AFABCC64AB3E028   /dev/hdiskpower58 chicongpfs01            
----------------------------------------------------------------------------------------------------------------------------------------------------
Reduce filesystem in aix
-------------------------
 > du -sm paranoid.log
84.11   paranoid.log
root@nitcife07 in /tmp
 > cp -p paranoid.log paranoid.log.bkp
root@nitcife07 in /tmp
 > cat paranoid.log | grep "/2009" | wc -l
  410361
root@nitcife07 in /tmp
 > tail +410361 paranoid.log.bkp > paranoid.log
root@nitcife07 in /tmp
 > du -sm 410361
du: 410361: A file or directory in the path name does not exist.
root@nitcife07 in /tmp
 > du -sm paranoid.log
48.32   paranoid.log
root@nitcife07 in /tmp
 > cd /var/adm/syslog/proftpd
root@nitcife07 in /var/adm/syslog/proftpd
 > ls -la
----------------------------------------------------------------------------------------------------------------------------------------------------
package installation through command line
1.inside of the folder just create the toc file using inutoc command the run the below command.it will install
install_all_updates -d . -Y
rdcp28kcisa1: root:/# instfix -ik IV37279
    All filesets for IV37279 were found.
----------------------------------------------------------------------------------------------------------------------------------------------------
Nerworker backup tool start and stop service.
---------------------------------------------
To stop  networker services: nsr_shutdown
If it is not stopping nsr_shutdown -f
To start  networker services: /etc/rc.nsr
---------------------------------------------------------------------------------------------------------------------------------------------------
Device commands
----------------
lsattr -El ovpass0
lsattr -El fscsi3
lsdev -C -s fcp
lslpp -l | grep array
lslpp -l | grep -i fcp
lsdev -Cc tape
lsdev | grep -i VERITAS
lsdev -l ovpass0
lsdev -l ovpass0 -F parent
lsdev -l fscsi3 -F parent
fcstat -e fcs3
---------------------------------------------------------------------------------------------------------------------------------------------------
Changing the time zone on aix

root@10.250.134.124(/)$date
Tue Sep 16 12:44:33 PDT 2014
root@10.250.134.124(/)$grep -i tz /etc/environment
TZ=US/Pacific
root@10.250.134.124(/)$smit chtz_date
now select the americal/denver
root@10.250.134.124(/)$date
Tue Sep 16 12:44:33 PDT 2014
root@10.250.134.124(/)$grep -i tz /etc/environment
TZ=America/Denver
root@10.250.134.124(/)$export TZ=America/Denver
root@10.250.134.124(/)$date
Tue Sep 16 13:45:39 MDT 2014
root@10.250.134.124(/)$
----------------------------------------------------------------------------------------------------------------------------------------------------
To know the disk is not used by oracle
--------------------------------------
# extendvg -f oravg  hdiskpower2
0516-1339 extendvg: Physical volume contains some 3rd party volume group.
0516-1397 extendvg: The physical volume hdisk20, will not be added to the volume group.
0516-792 extendvg: Unable to extend volume group.

Disks are showing used by the ASM.
----------------------------------
ORCLDISK means it is an ASM disk
DATA_000 is the ASM disk group name

> lquerypv -h /dev/hdiskpower2
00000000   00820101 00000000 80000000 FC40785C  |.............@x\|
00000010   00000000 00000000 00000000 00000000  |................|
00000020   4F52434C 4449534B 00000000 00000000  |ORCLDISK........|
00000030   00000000 00000000 00000000 00000000  |................|
00000040   0B200000 00000103 44415441 5F303030  |. ......DATA_000|
00000050   30000000 00000000 00000000 00000000  |0...............|
00000060   00000000 00000000 44415441 00000000  |........DATA....|
00000070   00000000 00000000 00000000 00000000  |................|
00000080   00000000 00000000 44415441 5F303030  |........DATA_000|
00000090   30000000 00000000 00000000 00000000  |0...............|
000000A0   00000000 00000000 00000000 00000000  |................|
000000B0   00000000 00000000 00000000 00000000  |................|
000000C0   00000000 00000000 01F724AE 26BF6C00  |..........$.&.l.|
000000D0   01F724AE 31464800 02001000 00100000  |..$.1FH.........|
000000E0   0001BC80 00020000 00000003 00000001  |................|
000000F0   00000002 00000002 00000000 00000000  |................|
root@dmnt17hiea1 in /

Oracle RAC cluster
------------------
No need to set the pvid and vg, just shared disks

> /u01/app/11.2.0/grid/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    dmnp21i1a1
ora.FRA.dg     ora....up.type ONLINE    ONLINE    dmnp21i1a1
ora....ER.lsnr ora....er.type ONLINE    ONLINE    dmnp21i1a1
ora....N1.lsnr ora....er.type ONLINE    ONLINE    dmnp22i1b1
ora....N2.lsnr ora....er.type ONLINE    ONLINE    dmnp22i1b1
ora....N3.lsnr ora....er.type ONLINE    ONLINE    dmnp22i1b1
ora.asm        ora.asm.type   ONLINE    ONLINE    dmnp21i1a1
ora.cvu        ora.cvu.type   ONLINE    ONLINE    dmnp21i1a1
ora....SM1.asm application    ONLINE    ONLINE    dmnp21i1a1
ora....A1.lsnr application    ONLINE    ONLINE    dmnp21i1a1
ora....1a1.gsd application    OFFLINE   OFFLINE
ora....1a1.ons application    ONLINE    OFFLINE
ora....1a1.vip ora....t1.type ONLINE    ONLINE    dmnp21i1a1
ora....SM2.asm application    ONLINE    ONLINE    dmnp22i1b1
ora....B1.lsnr application    ONLINE    ONLINE    dmnp22i1b1
ora....1b1.gsd application    OFFLINE   OFFLINE
ora....1b1.ons application    ONLINE    ONLINE    dmnp22i1b1
ora....1b1.vip ora....t1.type ONLINE    ONLINE    dmnp22i1b1
ora.empiprd.db ora....se.type ONLINE    ONLINE    dmnp21i1a1
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE
ora....network ora....rk.type ONLINE    ONLINE    dmnp21i1a1
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    dmnp21i1a1
ora.ons        ora.ons.type   ONLINE    ONLINE    dmnp22i1b1
ora....ry.acfs ora....fs.type ONLINE    ONLINE    dmnp21i1a1
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    dmnp22i1b1
ora.scan2.vip  ora....ip.type ONLINE    ONLINE    dmnp22i1b1
ora.scan3.vip  ora....ip.type ONLINE    ONLINE    dmnp22i1b1
root@dmnp22i1b1 in /usr/es/sbin/cluster

---------------------------------------------------------------------------------------------------------------------------------------------------
NTP
---
How to verify your ntp (Network Time Protocol) setup is working properly in Linux or UNIX Server?
# ntpq -c peers
remote              refid                st t when poll reach delay offset disp
==============================================================
*time1.domain.. time-a.nist.gov 1  u 38   64   377   1.16 -13.351 29.63
If you see a star (*) in the name of the time server, your time is being synchronised properly.
The third column, st is the stratum.
•       If it is The lower the number, the closer you are to the time source.
•       If the Stratum 16 means you are not synchronized.
Command Usage:  ntpq -c peers
To synchronize the time manually,
# ntpdate -u <NTP_SERVER>
----------------------------------------------------------------------------------------------------------------------------------------------------
on aix
--------
lsslot -c pci
lscfg | grep disk
# lspath -Ht -l hdisk0
status name parent path_id
Enabled hdisk0 vscsi0 0
Enabled hdisk0 vscsi1 1
# chpath -l hdisk0 -p vscsi0 -a priority=2
path Changed
----------------------------------------------------------------------------------------------------------------------------------------------------
Ulimit change on aix
---------------------
ulimit -a < user id >
ulimit -aS <user id >
ulimit -aH <user id >
chuser nofiles=32768 nofiles_hard=65536 admin_user_ID
chuser fsize=-1 fsize_hard=-1 admin_user_ID
chuser data=-1 data_hard=-1 admin_user_ID
chuser stack=-1 stack_hard=-1 admin_user_ID
chuser rss=-1 rss_hard=-1 admin_user_ID
chuser core=-1 core_hard=-1 admin_user_ID
----------------------------------------------------------------------------------------------------------------------------------------------------
System dump
------------
A system dump is a snapshot of operating system state at the time of crash or a manually initiated dump.When a manually initiated or unexpected
system halt occurs the system dump facility automatically copies selected areas of kernel data to the primary(or secondary) dump device .
These areas include kernel memory as well as other areas registered in a stucture called the master dump table by kernel modules or kernel extensions.

It provides a mechanism to capture suffient information abt the AIX kernel to expert analysis.Once the preserved image is written to disk,
the system will be booted and returned to production.The dump is then typically submitted to IBM for analysis.

Types of dump
-------------
1.Traditional
2.Firmware assisted
3.Live dump facility

Traditional dump
----------------
AIX generates dump prior to halt .

Firmware assisted(From power6 or AIX 6.1 onwards)
-----------------
POWER firmware generates dump in parallel with AIX halt process.(full memory dump)

Live dump facility
------------------
Called by livedumpstart & dumpctrl

Selective dump of registered components without need for a system restart.

livedumpstart
-------------
If the individual compoents is having problem(such as hung),a livedumpstart command may be run to dump the needed diagnosic info.

dumpctrl
--------
The management of live dump(such as enabling a component or controlling the dump directory)is handled with the dumpctrl command.

-The raw dump can be formatted into readable output through the kdb command.
-sysdumpdev command

systemdump in an LPAR environment
---------------------------------
In an LPAR env, a dump can be initiated from the HMC.
888 - crass progress code of dump(HMC will not flash this code)

Primary dump device.
--------------------
If an AIX kernel crash occurs , kernel data is written to the primary dump deice, which is by default /dev/hd6, the primary paging device.

After the kernel crash, AIX may need to be rebooted.If the auto start system attribute is set to TRUE, the system will automatically reboot after a crash.

During the next reboot, the dump is copied into the dump directory.The default location is /var/adm/ras.The dump file name is vmcore.x where x indcates the number of the dump.

#sysdumpdev -l
#sysdumpdev -p /dev/sysdumpnull --> Deactivate primary dump.
#sysdumpdev -P -s  /dev/rmt0 --> Change secondary dump device(permanent)
#sysdumpdev -L  --> Displays the information abt the last dump(including the date and dump status).To need extra detail enter the below command
#sysdumpstart -p  --> to get extra info from the above command.

Dump status
-----------
0  = 0c0 -- dump completed
-1 = 0c8 -- no primary dump device
-2 = 0c4 -- partial dump
-3 = 0c5 -- dump failed to start

Two types of dump
-----------------
Primary  and secondary dump

Primary dump
------------
Usually used when you wish to save the dump data.

Secondary dump
--------------
An alternate dump device , often used to discard dump data ( using /dev/sysdumpnull)

dumpinfo
--------
Do not mirror the dump lv.Mirrorvg command will not mirror a dumplv in the rootvg unless it is the paging space.
System dumps are usually recorded in the error log with the DUMP_STATUS label.
The servers more than 4GB of real memory will have dedicatted dump device created at the installation time.
lg_dumplv is the default name of the dump device logical volume.

Creating dump device
--------------------

#mklv -y /dev/ded_dumplv -t sysdump rootvg 64
#sysdumpdev -P -p /dev/ded_dumplv
#sysdumpdev -l
#sysdumpdev -e --> Estimated dump size.
#sysdumpdev -C --> Turn on dump compression.
#sysdumpdev -c --> Turn off compression.
#sysdumpdev -K --> To make always allow dump as TRUE
#sysdumpdev -k --> To make always allow dump as FALSE
In AIX 6.1 and the later, dumps are always compressed.
/var filesystem will have dump info

Dumpcheck utility
-----------------
/usr/lib/ras/dumpcheck
#/usr/lib/ras/dumpcheck -p
#crontab -l ; grep dumpcheck
0 15 * * * /usr/lib/ras/dumpcheck > /dev/null 2>&1
#/usr/lib/ras/dumpcheck -t "0 14 * * *" --> to add the entry in crontab if already does not exists.

sysdumpstart command
--------------------
A system dump may be automatically created by the system.If we want we can do it by sysdumpstart command
smitty sysdumpstart

Specifying automatic reboot
---------------------------
#chdev -l sys0 -a autorestart=true
or
#smit chgsys

Dump restart
-------------
Before
dmnp32test1> sysdumpdev -L
0453-019 No previous dumps recorded.
Scanning device /dev/lg_dumplv for existing dump.
root@dmnp32test1 in /

While selecting restart for the lpar select dump then reboot it.
After dump reboot system will show like below.
root@dmnp32test1(/)#sysdumpdev -L
Device name:         /dev/lg_dumplv
Major device number: 10
Minor device number: 11
Size:                189527552 bytes
Uncompressed Size:   969789042 bytes
Date/Time:           Thu Dec 11 11:21:56 2014
Dump status:         0
Type of dump:        traditional
dump completed successfully
root@dmnp32test1(/)#
After this we have to take snap and provide to IBM for the analysis.
----------------------------------------------------------------------------------------------------------------------------------------------------
To verify the mksysb file
-------------------------
> lsmksysb -l -f csclaw9mig_mksysb
VOLUME GROUP:           rootvg
BACKUP DATE/TIME:       Mon Nov 24 04:17:06 EST 2014
UNAME INFO:             AIX csclaw9mig 1 6 00F6E8BD4C00
BACKUP OSLEVEL:         6.1.6.15
MAINTENANCE LEVEL:      6100-06
BACKUP SIZE (MB):       52736
SHRINK SIZE (MB):       29918
VG DATA ONLY:           no

rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       1       1    closed/syncd  N/A
hd6                 paging     64      64      1    open/syncd    N/A
hd8                 jfs2log    1       1       1    open/syncd    N/A
hd4                 jfs2       8       8       1    open/syncd    /
hd2                 jfs2       16      16      1    open/syncd    /usr
hd9var              jfs2       8       8       1    open/syncd    /var
hd3                 jfs2       8       8       1    open/syncd    /tmp
hd1                 jfs2       16      16      1    open/syncd    /home
hd10opt             jfs2       40      40      1    open/syncd    /opt
hd11admin           jfs2       4       4       1    open/syncd    /admin
fwdump              jfs2       8       8       1    open/syncd    /var/adm/ras/platform
dr                  jfs2       92      92      1    closed/syncd  /dr
livedump            jfs2       4       4       1    open/syncd    /var/adm/ras/livedump
fslv00              jfs2       4       4       1    open/syncd    /roothome
dumplv1             sysdump    16      16      1    open/syncd    N/A
dumplv2             sysdump    16      16      1    open/syncd    N/A
root@dmns03nim1 in /nim/mksysb/dmnp32test1/dmnp32test1/csclaw9mig
 >

Restoring specific frile from mksysb
-------------------------------------
specific file from the mksysb backup can be restored using the restorevgfiles command. In the following example the file will be restored to the current directory (/tmp/restore). Using the -d flag a alternative restore location can be specified.

                                 Path to the mksysb image file
                                 |
(/tmp/restore) # restorevgfiles -f /export2/P2_1202_TL7.mk ./root/j1
                                                             |
                                                             The file to be extracted from the mksysb image.
New volume on /export2/P2_1202_TL7.mk:
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Tue Feb 21 18:09:12 GMT+01:00 2012
Files are backed up by name.
The user is root.
x            6 ./root/j1
The total size is 6 bytes.
The number of restored files is 1.
==================================================================
(/tmp/restore) # ls -la */*
-rw-r--r--    1 root     system            6 Feb 17 11:16 root/j1

----------------------------------------------------------------------------------------------------------------------------------------------------
Multibos note
--------------
Note : - Remember doing the Mutibos os updates always applied to the standby lvs.After took the mutibos just reboot the server to the bos_lvs and
install the updates to the original lvs(hd5,hd4,hd2,hd9var.hd10opt).After the update installation we can wake up the standby using the multibos -S
and then type the oslevel -s.Once if it is success reboot the server to teh original lv.

Notr :- multibos only for the os upgrade not for the migration.
Multibos boot device check
--------------------------
root@dmnp32test1(/)#bootinfo -v
bos_hd5
From here you have apply the os update files.So updates will reflect to the orininal lv.

----------------------------------------------------------------------------------------------------------------------------------------------------
To Check the specific package is available in the lpp_source or spot.Here we are checking for the alt_clone fileset.
#nim -o showres 'AIX61_TL6_Full_spot' | grep "bos.alt_disk_install.rte"
 bos.alt_disk_install.rte 6.1.6.0 C F Alternate Disk Installation
If you do not see the Alternate Disk Installation fileset you will need to install it manually into your spot from the lpp_source. To do this run the following:
nim -o cust -a lpp_source=AIX61_TL6_Full_lpp -a filesets=bos.alt_disk_install AIX61_TL6_Full_spot
----------------------------------------------------------------------------------------------------------------------------------------------------
Network
-------
Resolve umserv01 to ip address (from /etc/hosts file):
#host umserv01

To change the host name to umserv01:
#hostname umserv01

To the status of ethernet device en0:
#entstat en0

To list the detailed status of device en0:
#entstat -d en0

To list all net configurable attributes and their values:
#no -a

To change umserv01wall parameter to its default value:
#no -d umserv01wall

To make the machine as router in tcpip networks:
#no -o ipforwarding=1

To trace the route to umserv01:
#traceroute umserv01

To tcp ping to the machine umserv01:
#ping umserv01

To show the status of all network interfaces:
#ifconfig -a

To show the status of en0:
#ifconfig en0

Turns on network card en0:
#ifconfig en0 up

Turns off network card en0:
#ifconfig en0 down

Removes en0 card from the network interface list:
#ifconfig en0 detach

Configure en0 starts immediately:
Temporarily:# ifconfig en0 inet 192.168.100.9 netmask 255.255.255.0 up
Permanently:# chdev -l en0 -a netaddr=192.168.100.10 -a netmask=0xffffff00
Create alias ip address for en0:

Temporarily:# ifconfig en0 alias 192.168.100.10 netmask 255.255.255.0
Permanently:# chdev -l en0 -a alias4=192.168.100.10,255.255.255.0
Remove a permanently added alias:

# chdev -l en0 -a delalias4=192.168.100.10,255.255.255.0
Via SMIT:

# smitty tcpip -> further Configuration -> Network Interfaces -> Network Interface Selection -> Configure Aliases
To make 192.168.100.1 as default gateway for entire network:

Temporarily:#route add 0 192.168.100.1
Permanently:#chdev -l inet0 -a route=0,192.168.100.1
To make 200.7 as gateway for 300.0 network:
#route add 192.100.300.0 192.100.200.7

To clear the gateway table:
#route -f

To change the host name to umserv01 permanently:
#chdev -l inet0 -a hostname=umserv01

To set the MTU to 1500 on en69:
#chdev -l en69 -a mtu=1500

To show the state of all sockets:
#netstat -a

To show the network buffers cache:
#netstat -c

To show the net drops of packets:
#netstat -D

To display interface statistics:
#netstat -i

To show the routing table:
#netstat -r

To show routing table (ip will be given instead of host names)
#netstat -rn

To show the statistics of the protocols
#netstat -s

To show the statistics of respective protocols
#netstat -s -p < tcp/udp/ipv6>
----------------------------------------------------------------------------------------------------------------------------------------------------
How to check the etherchannel works good ?
# entstat -d en7 | grep -i sync
                Synchronization: IN_SYNC
                Synchronization: IN_SYNC
                Synchronization: IN_SYNC
                Synchronization: IN_SYNC
# entstat -d en7 | grep -i agg
Device Type: IEEE 802.3ad Link Aggregation
Statistics for every adapter in the IEEE 802.3ad Link Aggregation:
IEEE 802.3ad Link Aggregation Statistics:
Aggregation status: Aggregated
Receive TCP Segment Aggregation: Enabled
        TCP Packets Aggregated into Large Packets: 2968288
        TCP Payload Bytes Aggregated into Large Packets: 4158020008
        TCP Segment Aggregation Large Packets Created: 1367426
        TCP Segment Aggregation Average Packets Aggregated: 2
        TCP Segment Aggregation Maximum Packets Aggregated: 15
                Aggregation: Aggregatable
                Aggregation: Aggregatable
Receive TCP Segment Aggregation: Enabled
        TCP Packets Aggregated into Large Packets: 1465534
        TCP Payload Bytes Aggregated into Large Packets: 2129560180
        TCP Segment Aggregation Large Packets Created: 116145
        TCP Segment Aggregation Average Packets Aggregated: 12
        TCP Segment Aggregation Maximum Packets Aggregated: 17
                Aggregation: Aggregatable
                Aggregation: Aggregatable
#
----------------------------------------------------------------------------------------------------------------------------------------------------

Howto configure AIX syslogd (/etc/syslog.conf)
----------------------------
The following steps will guide you trough configuring syslog on an AIX system.
 This info is valid for AIX 4.3.3, AIX 5.1, AIX 5.2 and AIX 5.3.

By default, an AIX system will not do syslog'ging. For a strange reason, the default install on an AIX install will not place entry's in /etc/syslog.conf, leaving a totl userless syslogd.

Even more, comparing the syslogd on AIX to another Unix, (ex: Linux), you will notice that <facility>.* doesn't work. So make sure that your priority level is never *.

Comming from a Linux world, you most probably want the following config:


mail.debug      /var/log/mail
user.debug      /var/log/user
kern.debug      /var/log/kern
syslog.debug    /var/log/syslog
daemon.debug    /var/log/daemon
auth.debug      /var/log/secure
local2.debug    /var/log/sudo


As AIX standard has no logrotate daemon running, you want to adapt syslogd todo the rotating on his own, an example would be:
mail.debug   /var/log/mail  rotate size 100k files 4 # 4 files, 100kB each
user.debug   /var/log/user  rotate files 12 time 1m # 12 files, monthly rotate
kern.debug   /var/log/kern  rotate files 12 time 1m compress # 12 files, monthly rotate, compress
...


When adaptions are made to /etc/syslog.conf, make sure to restart syslogd.
[root@sys /] refresh -s syslogd
0513-095 The request for subsystem refresh was completed successfully.
[root@sys /]
In the dmns03nim1 server inside of syslog.conf
------------------------
*.info          @10.250.160.57

mail.info       /var/adm/syslog/mail.log rotate size 5m compress archive /stats/syslog/archive
daemon.debug    /var/adm/syslog/daemon.log rotate size 5m compress archive /stats/syslog/archive
auth.info       /var/adm/syslog/security.log rotate size 5m compress archive /stats/syslog/archive
local2.debug    /var/adm/syslog/sudo.log rotate size 5m compress archive /stats/syslog/archive
local6.debug    /var/adm/syslog/ldap/ldap.log rotate size 100m compress
*.info;mail.none,daemon.none,auth.none,local2.none,local4.none  /var/adm/syslog/syslog.log rotate size 5m compress archive /stats/syslog/archive

# ASO log configuration
aso.notice /var/log/aso/aso.log rotate size 1m files 8 compress
aso.info /var/log/aso/aso_process.log rotate size 1m files 8 compress
aso.debug /var/log/aso/aso_debug.log rotate size 32m files 8 compress

auth.info               @10.250.160.57
----------------------------------------------------------------------------------------------------------------------------------------------------
AIX temperature sensors

By executing the command /usr/lpp/diagnostics/bin/uesensor, you can, on supported platform, get the fan speeds and temperature of your system:

[root@sys /] /usr/lpp/diagnostics/bin/uesensor -a
3 0 11 31 P1
9001 0 11 2100 F1
9001 1 11 2760 F2
9001 2 11 1890 F3
9001 3 11 1890 F4
9002 0 11 5129 P1
9002 1 11 3129 P1
9002 2 11 5129 P1
9002 3 11 12077 P1
9004 0 11 3 P3-V1
9004 1 11 3 P3-V2
9004 2 11 3 P3-V3

[root@sys /]

----------------------------------------------------------------------------------------------------------------------------------------------------
How to change hostname on AIX, “Cleanly”
Changing the hostname at a Windows Server will require a reboot. However, changing a hostname on a Unix/Linux server do not require a reboot! But, it is not so straightforward to change the hostname of a server online. This is because you will need to change a couple of things, like the entry in ODM, nodename and current hostname.
oldhostname:/:>chdev -l inet0 -a hostname=newhostname
inet0 changed
oldhostname:/:>uname -S newhostname => Change the network name of this machine.
oldhostname:/:>hostname newhostname => Sets the name of the current host system.
newhostname
oldhostname:/:>su -
newhostname:/:>exit
----------------------------------------------------------------------------------------------------------------------------------------------------
Difference between sudo su and sudo su -
sudo su --> if you do it will call the present user profile and run the root commands.so it will not have all the rights.
sudo su - --> if you do it will call the root user profile so ow you have full rights as a real root account.
----------------------------------------------------------------------------------------------------------------------------------------------------
Find the child devices for the particular device.
lsdev -Cc adapter | grep fcs0
fcs0    Available 08-00    4Gb FC PCI Express Adapter (df1000fe)
lsdev -C | grep -i 08-00
----------------------------------------------------------------------------------------------------------------------------------------------------

VIO COMMANDS


Vio Server Commands
--------------------
$ lsvg -pv rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 319 11 00..00..00..00..11
hdisk1 active 319 27 00..00..00..00..27

$ lsdev -dev hdisk0 -vpd
  hdisk0           U787B.001.DNW025F-P1-C5-T1-W500507630E0009E2-L4010400000000000  MPIO Other FC SCSI Disk Drive
$ ioslevel
2.1.0.0
$ lsmap -all
SVSA            Physloc                                      Client Partition ID
--------------- -------------------------------------------- ------------------
vhost0          U9113.550.10BE8DD-V1-C11                     0x00000003

VTD                   lpar1vg0
Status                Available
LUN                   0x8100000000000000
Backing device        lpar1_rootvg
Physloc

$ lstcpip

Name Mtu Network Address ZoneID Ipkts Ierrs Opkts Oerrs Coll
en2 1500 link#2        a6.24.d0.0.10.3 27642 0 8402 0 0
en2 1500 9.3.131 zlab081 27642 0 8402 0 0
lo0 16896 link#1 1197 0 1201 0 0
lo0 16896 127 localhost 1197 0 1201 0 0
lo0 16896 ::1 0 1197 0 1201 0 0

Cronjob for Virtual I/O Server with Fix Pack 8
-----------------------------------------------

The cron function was introduced to the padmin shell in VIOS 1.3 (fix pack 8). However, many commands fail when run from cron, even though they work when run from the CLI. Failing commands include mount <NFS directory> and backupios.
This is because /home/padmin/.profile is an important part of the CLI, changing the path and aliasing many commands. cron does not read a user's .profile, and so the commands fail. This is working as designed.
To enable cron to run commands in the same way as the CLI, the command should start with
/usr/ios/cli/ioscli
For example:
/usr/ios/cli/ioscli mount nimserver:/export /mnt          
/usr/ios/cli/ioscli backupios -file /mnt/vios_backup -mksysb
-----------------------------------------------
lsmap -vadapter vhost21
lstcpip -routtable
entstat -all <SEA adapter> | more

$ lsdev -dev hdisk3 -attr | grep lun_id
lun_id 0x3000000000000 Logical Unit Number ID False

$ lsdev -virtual | grep SCSI
vhost0 Available Virtual SCSI Server Adapter
»Here is example of the lsmap command output.
$ lsmap -all
SVSA Physloc Client Partition ID
--------------- -------------------------------------------- ------------------
vhost0 U8233.E8B.1084AER-V1-C12 0x00000000
VTD NO VIRTUAL TARGET DEVICE FOUND
»Note the virtual adapter slot number that

lsdev -type adapter

name status description
ent0 Available 2-Port 10/100/1000 Base-TX PCI-Express Adapter (14104003)
ent1 Available 2-Port 10/100/1000 Base-TX PCI-Express Adapter (14104003)
ent2 Available Virtual I/O Ethernet Adapter (l-lan)
fcs0 Available 8Gb PCI Express Dual Port FC Adapter (df1000f114108a03)
fcs1 Available 8Gb PCI Express Dual Port FC Adapter (df1000f114108a03)
pager0 Available Pager Kernel Extension
vasi0 Available Virtual Asynchronous Services Interface (VASI)
vbsd0 Available Virtual Block Storage Device (VBSD)
vhost0 Available Virtual SCSI Server Adapter
vsa0 Available LPAR Virtual Serial Adapter


lsdev -virtual | grep -i ethernet
ent2 Available Virtual I/O Ethernet Adapter (l-lan)

$ lsdev -dev ent0 -attr media_speed
»Here is example output for this command:
value
Auto_Negotiation
»Here is an example for changing the media speed for adapter ent0. DO NOT ACTUALLY CHANGE THE ATTRIBUTE UNLESS IT IS NECESSARY:
$ chdev -dev ent0 -attr media_speed=100_Full_Duplex


The following example creates an SEA that maps the physical Ethernet adapter ent0 to the virtual Ethernet adapter ent2, using ent2 as the default adapter and 1 as the default VLAN ID. The IP configuration from the interface en0 is migrated to the interface en3 of the generated SEA.
$ mkvdev -sea ent0 -vadapter ent2 -default ent2 -defaultid 1 -migrate -auto
en0 changed
ent3 Available
en3
et3
en3 changed
inet0 changed


$ lsdev -type disk
name status description
hdisk0 Available MPIO Other FC SCSI Disk Drive
hdisk1 Available MPIO Other FC SCSI Disk Drive
hdisk2 Available MPIO Other FC SCSI Disk Drive
hdisk3 Available MPIO Other FC SCSI Disk Drive
hdisk4 Available MPIO Other FC SCSI Disk Drive


$ mkvdev -vdev hdisk2 -vadapter vhost0 -dev lpar2_vtd
lpar2_vtd Available

$ lsdev -virtual | grep Shared
ent3 Available Shared Ethernet Adapter

In your virtual I/O server partition's console session, use the rmtcpip -interface <interface name> command to remove the virtual I/O server TCP/IP configuration. Specify the interface name of your SEA.
Student Exercises with hints
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
6-6 Power Virtualization I © Copyright IBM Corp. 2009, 2013
»Run the command:
$ rmtcpip -interface en3
Parameters to be reset:
Host name: No
Name server: No
Effective immediately: Yes
Routing: No
Answer y to Are you sure?
__ 5.In your Virtual I/O Server partition's console session, use the rmdev command to remove the existing SEA, and its associated interface devices. Use the SEA adapter name you wrote down in Step 3.
»If the SEA device is ent3, then run the following command sequence:
$ rmdev -dev ent3
$ rmdev -dev en3
$ rmdev -dev et3



$ entstat -all ent2 | grep VLAN
Invalid VLAN ID Packets: 0
Port VLAN ID: 10
VLAN Tag IDs: None
$ entstat -all ent3 | grep VLAN
Invalid VLAN ID Packets: 0
Port VLAN ID: 19
VLAN Tag IDs: None
__ 11.Use the entstat -all entX | grep Switch command to check that both virtual Ethernet adapters are using the default virtual switch ID ETHERNET0. If not, do not proceed. Check your VIO server profile configuration.
»Here is an example command and its output, which shows ent2 and ent3 using the switch ID ETHERNET0.
$ entstat -all ent2 | grep Switch
Switch ID: ETHERNET0
$ entstat -all ent3 | grep Switch
Switch ID: ETHERNET0

Run the following command to see the VLAN ID of the virtual Ethernet adapter on your client partition. Here is an example with VLAN 30 on lpar3:
$ entstat -d ent0 | grep "Port VLAN ID"
Port VLAN ID: 30

$ mkvdev -sea ent0 -vadapter ent2 -default ent2 -defaultid 30
-attr ctl_chan=ent3 ha_mode=auto


$ lstcpip -adapters
Ethernet adapters:
ent0 Available 00-00 2-Port 10/100/1000 Base-TX PCI-Express Adapter (14104003)
ent1 Available 00-01 2-Port 10/100/1000 Base-TX PCI-Express Adapter (14104003)
ent2 Available Virtual I/O Ethernet Adapter (l-lan)
ent3 Available Virtual I/O Ethernet Adapter (l-lan)
ent4 Available Shared Ethernet Adapter
»Alternatively, the lsdev | grep ent command could have been used to get this information.



$ lsmap -all -net
SVEA Physloc
------ --------------------------------------------
ent2 U8233.E8B.1084AER-V1-C11-T1
SEA ent4
Backing device ent0
Status Available
Physloc U5877.001.RCH8623-P1-C4-T1
SVEA Physloc
------ --------------------------------------------
ent3 U8233.E8B.1084AER-V1-C13-T1
SEA NO SHARED ETHERNET ADAPTER FOUND

•The state of the SEA adapter (primary or backup).
»Example command and output if your VIO is primary:
$ entstat -all ent4 | grep "^ *State"
State: PRIMARY
»Example command and output if your VIO is backup:
$ entstat -all ent4 | grep "^ *State"
State: BACKUP
Student Exercises with hints
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
6-14 Power Virtualization I © Copyright IBM Corp. 2009, 2013
•The trunk adapter priority value and whether the adapter is active.
»Example command and output if your VIO is Primary.
$ entstat -all ent4 | grep Priority
Priority:1
Priority:1 Active: True
»Example command and output if your VIO is Backup:
$ entstat -all ent4 | grep Priority
Priority:2
Priority:2 Active: False
•The control channel adapter name and its PVID.
»Example command and output:
$ entstat -all ent4 | grep "Control Channel"
Control Channel PVID: 19
Control Channel Adapter: ent3
»Some more SEA attributes can be seen using the lsdev command. You should see the following information if you run the lsdev -dev ent4 -attr command:
$ lsdev -dev ent4 -attr
$ lsdev -dev ent4 -attr
attribute value description user_settable
accounting disabled Enable per-client accounting of network statistics True
ctl_chan ent3 Control Channel adapter for SEA failover True
gvrp no Enable GARP VLAN Registration Protocol (GVRP) True
ha_mode auto High Availability Mode True
jumbo_frames no Enable Gigabit Ethernet Jumbo Frames True
large_receive no Enable receive TCP segment aggregation True
largesend 0 Enable Hardware Transmit TCP Resegmentation True
netaddr 0 Address to ping True
pvid 10 PVID to use for the SEA device True
pvid_adapter ent2 Default virtual adapter to use for non-VLAN-tagged packets True
qos_mode disabled N/A True
real_adapter ent0 Physical adapter associated with the SEA True
thread 1 Thread mode enabled (1) or disabled (0) True
virt_adapters ent2 List of virtual adapters associated with the SEA (comma separated) True


$ errlog -ls
--------------------------------------------------
LABEL: SEAHA_PRIMARY
IDENTIFIER: E136EAFA
Date/Time: Tue Jan 8 05:05:43 CET 2013
Sequence Number: 63
Machine Id: 00F015B34C00
Node Id: sys464_vios1
Class: H
Type: INFO
WPAR: Global
Resource Name: ent4
Resource Class: adapter
Resource Type: sea
Location:
Description
BECOME PRIMARY
Probable Causes
BECOME PRIMARY
Failure Causes
BECOME PRIMARY
Recommended Actions
BECOME PRIMARY
Detail Data
Become the Primary SEA
Student Exercises with hints
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
6-16 Power Virtualization I © Copyright IBM Corp. 2009, 2013
»You should see an entry in the error log similar to the following when you issue the errlog command on the secondary VIO server:
$ errlog -ls
---------------------------------------------------
LABEL: SEAHA_BACKUP
IDENTIFIER: 40D97644
Date/Time: Tue Jan 8 05:24:08 CET 2013
Sequence Number: 70
Machine Id: 00F015B34C00
Node Id: sys464_vios2
Class: H
Type: INFO
WPAR: Global
Resource Name: ent4
Resource Class: adapter
Resource Type: sea
Location:
Description
BECOME BACKUP
Probable Causes
BECOME BACKUP
Failure Causes
BECOME BACKUP
Recommended Actions
BECOME BACKUP
Detail Data
Become the Backup SEA


$ chdev -dev ent4 -attr ha_mode=standby
ent4 changed


$ cfgdev
$ lsdev -virtual | grep ^en
ent2 Available Virtual I/O Ethernet Adapter (l-lan)
ent3 Available Virtual I/O Ethernet Adapter (l-lan)
ent5 Available Virtual I/O Ethernet Adapter (l-lan)
ent4 Available Shared Ethernet Adapter

$ cfgdev
$ lsdev -virtual | grep vhost
vhost0 Available Virtual SCSI Server Adapter
vhost1 Available Virtual SCSI Server Adapter

lsmap -vadapter vhost0
SVSA Physloc Client Partition ID
--------------- -------------------------------------------- ------------------
vhost0 U8233.E8B.1084AER-V1-C12 0x00000015
VTD lpar1_vtd
Status Available
LUN 0x8100000000000000
Backing device hdisk1
Physloc U5877.001.RCH8623-P1-C6-T1-W500507680140B855-L1000000000000

$ lsdev -dev hdisk1 -attr | grep reserve_policy
reserve_policy single_path Reserve Policy True
$ chdev -dev hdisk1 -attr reserve_policy=no_reserve
hdisk1 changed


$ shutdown -force

$ chpath -l hdisk0 -p vscsi1 -a priority=2
Path changed


$ lsdev -dev vfchost*
name status description
vfchost0 Available Virtual FC Server Adapter


$ lsmap -all -npiv
Name Physloc ClntID ClntName ClntOS
------------- ---------------------------------- ------ -------------- ------
vfchost0 U8233.E8B.1084AER-V1-C21 21
Status:NOT_LOGGED_IN
FC name: FC loc code:
Ports logged in:0
Flags:1<NOT_MAPPED,NOT_CONNECTED>
VFC client name: VFC client DRC:

$ lsdev -dev fcs*
name status description
fcs0 Available 8Gb PCI Express Dual Port FC Adapter (df1000f114108a03)
fcs1 Available 8Gb PCI Express Dual Port FC Adapter (df1000f114108a03)

Run the lsnports command to list the ports that are capable of N_Port ID virtualization (NPIV). Verify the fabric attribute is set to 1. This means the adapter and the SAN switch are NPIV ready.
»Example command and output:
$ lsnports
name physloc fabric tports aports swwpns awwpns
fcs0 U5877.001.RCH8623-P1-C6-T1 1 64 64 2048 2036
__ c.Run the vfcmap command to map your virtual Fibre Channel server adapter to the physical Fibre Channel adapter port fcs0.
»Here is an example, using the vfchost0 virtual adapter:
$ vfcmap -vadapter vfchost0 -fcp fcs0
vfchost0 changed


$ lsmap -all -npiv
Name Physloc ClntID ClntName ClntOS
------------- ---------------------------------- ------ -------------- ------
vfchost0 U8233.E8B.1084AER-V1-C21 21 sys464_lpar1 AIX
Status:LOGGED_IN
FC name:fcs0 FC loc code:U5877.001.RCH8623-P1-C6-T1
Ports logged in:1
Flags:a<LOGGED_IN,STRIP_MERGE>
VFC client name:fcs0 VFC client DRC:U8233.E8B.1084AER-V21-C21-T1




on aix
# chdev -l hdisk0 -a hcheck_interval=6 -P
# lspath -Ht -l hdisk0
status name parent path_id
Enabled hdisk0 vscsi0 0
Enabled hdisk0 vscsi1 1
# lspath -AHE -l hdisk0 -p vscsi0
attribute value description user_settable
priority 1 Priority True
# lspath -AHE -l hdisk0 -p vscsi1
attribute value description user_settable
priority 1 Priority True
»The output shows there are two paths available to hdisk0

# lspath -Ht
status name parent path_id
Enabled hdisk0 vscsi0 0
Enabled hdisk0 vscsi1 1

# lspath -Ht -l hdisk0
status name parent path_id
Enabled hdisk0 vscsi0 0
Enabled hdisk0 vscsi1 1
# chpath -l hdisk0 -p vscsi0 -a priority=2
path Changed
----------------------------------------------------------------------------------------------------------------------------------------------------
To get the lun numbers for the IBM XIV disks
---------------------------------------------
cd /opt/xiv
then run the below command
# xiv_devlist
It will provide us the lun number as well as the disk size.
----------------------------------------------------------------------------------------------------------------------------------------------------
o find the vio server from vio client.
kdb then enter
if vscsi type "cvai vscsi1" and enter
if vfcs type " vfcs fcs2"
----------------------------------------------------------------------------------------------------------------------------------------------------

Sunday, 22 July 2012

SVMON

To print out global statistics, use the -G flag. In this example, we will repeat it
five timesat two-second intervals.

# svmon -G -i 2 5
       m e m o r y            i n  u s e            p i n        p g  s p a c e
  size inuse  free   pin   work  pers  clnt   work  pers  clnt     size   inuse
 16384 16250   134  2006  10675  2939  2636   2006     0     0    40960   12674
 16384 16254   130  2006  10679  2939  2636   2006     0     0    40960   12676
 16384 16254   130  2006  10679  2939  2636   2006     0     0    40960   12676
 16384 16254   130  2006  10679  2939  2636   2006     0     0    40960   12676
 16384 16254   130  2006  10679  2939  2636   2006     0     0    40960   12676

The columns on the resulting svmon report are described as follows:

memory
     Statistics describing the use of real memory, shown in 4 K pages.
     size
         Total size of memory in 4 K pages.
     inuse
         Number of pages in RAM that are in use by a process plus the number of
         persistent pages that belonged to a terminated process and are still resident
         in RAM. This value is the total size of memory minus the number of pages
         on the free list.
     free
         Number of pages on the free list.
     pin
         Number of pages pinned in RAM (a pinned page is a page that is always
         resident in RAM and cannot be paged out).
in use
     Detailed statistics on the subset of real memory in use, shown in 4 K frames.
    work
         Number of working pages in RAM.
     pers
         Number of persistent pages in RAM.
     clnt
         Number of client pages in RAM (client page is a remote file page).
pin
     Detailed statistics on the subset of real memory containing pinned pages, shown in
     4 K frames.
     work
         Number of working pages pinned in RAM.
     pers
         Number of persistent pages pinned in RAM.
     clnt
         Number of client pages pinned in RAM.
pg space
     Statistics describing the use of paging space, shown in 4 K pages. This data is
     reported only if the -r flag is not used. The value reported starting with operating
     system version 4.3.2 is the actual number of paging-space pages used (which
     indicates that these pages were paged out to the paging space). This differs from
     the vmstat command in that vmstat's avm column which shows the virtual
     memory accessed but not necessarily paged out.
     size
         Total size of paging space in 4 K pages.
     inuse
         Total number of allocated pages.

In our example, there are 16384 pages of total size of memory. Multiply this number
by 4096 to see the total real memory size (64 MB). While 16250 pages are in use,
there are 134 pages on the free list and 2006 pages are pinned in RAM. Of the total
pages in use, there are 10675 working pages in RAM, 2939 persistent pages in RAM,
and 2636 client pages in RAM. The sum of these three parts is equal to the inuse
column of the memory part. The pin part divides the pinned memory size into working,
 persistent and client categories. The sum of them is equal to the pin column of the
memory part.There are 40960 pages (160 MB) of total paging space, and 12676
pages are in use. The inuse column of memory is usually greater than the inuse
column of pg spage because memory for file pages is not freed when a program
completes, while paging-space allocation is.
=====================
Memory bottlenecks

      The following section describes memory bottleneck solutions with the
      following commands: vmstat, svmon, ps.

      1.vmstat

      Run the following command:

      vmstat 1

      NOTE: System may slow down when pi and po are consistently non-zero.
      pi number of pages per second paged in from paging space
      po number of pages per second paged out to paging space

      When processes on the system require more pages of memory than are
      available in RAM, working pages may be paged out to paging space and then
      paged in when they are needed again. Accessing a page from paging space
      is considerably slower than accessing a page directly from RAM. For this
      reason, constant paging activity can cause system performance degradation.

      NOTE: Memory is over-committed when the fr:sr ratio is high.
      fr number of pages that must be freed to replenish the free list or to
      accommodate an active process sr number of pages that must be examined
      in order to free fr number of pages

      An fr:sr ratio of 1:4 means for every one page freed, four pages must be
      examined. It is difficult to determine a memory constraint based on this ratio
      alone and what constitutes a high ratio is workload/application dependent.

      NOTE: Memory is over-committed to the point of thrashing when
      po*SYS>fr.

      The system considers itself to be thrashing when po*SYS > fr where SYS is a
      system parameter viewed with the schedtune command. The default value is 0
      if a system has 128MB or more. Otherwise,the default is 6. Thrashing occurs
      when the system spends more time paging than performing work. When this
      occurs, selected processes may be suspended temporarily, and the system
      may be noticeably slower.

      2.svmon

      As root run the following command:
      # svmon -Pau 10 | more

      Sample Output:

      Pid Command Inuse Pin Pgspace
      13794 dtwm 1603 1 449
      Pid: 13794
      Command: dtwm
      Segid Type Description Inuse Pin Pgspace Address Range
      b23 pers /dev/hd2:24849 2 0 0 0..1
      14a5 pers /dev/hd2:24842 0 0 0 0..2
      6179 work lib data 131 0 98 0..891
      280a work shared library 1101 0 10 0..65535
      181 work private 287 1 341 0..310:65277..65535
      57d5 pers code,/dev/hd2:61722 82 0 0 0..135

      This command lists the top ten memory using processes and gives a report
      about each one. In each process report, look where Type = work and
      Description = private. Check how many 4K (4096 byte) pages are used under
      the Pgspace column. This is the minimum number of working pages this
      segment is using in all of virtual memory. A Pgspace number that grows, but
      never decreases, may indicate a memory leak. Memory leaks occur when an
      application fails to deallocate memory.

      341 * 4096 = 1,396,736 or 1.4MB of virtual memory
      3. ps

      Run the following command:
      ps gv | head -n 1; ps gv | egrep -v "RSS" | sort +6b -7 -n -r
      size
      amount of memory in KB allocated from page space for the memory segment
      of Type = work and Description = private for the process as would be
      indicated by svmon.

      RSS
      amount of memory, in KB, currently in use (in RAM) for the memory segment
      of Type = work and Description = private plus the memory segment(s) of Type
      = pers and Description = code for the process as would be indicated by
      svmon.

      trs
      amount of memory, in KB, currently in use (in RAM) for the memory
      segment(s) of Type = pers and Description = code for the process as would
      be indicated by svmon.

      %mem
      RSS value divided by the total amount of system RAM in KB multiplied by
      100.

 * Source Article from : Internet

Friday, 20 July 2012

AIX Listening Port to PID / Process mapping -- Using TCP Sockets

To map Listening Port to PID / Process can be done by two major ways.
  1. Using the port number
  2. Using the TCP Sockets.
Check the Port status using netstat command. It shows the TCP Control block on the first column(Highlighted).
# netstat -Aan | grep 9090
72d70a10 tcp4       0      0  *.9090             *.*                LISTEN

Easiest method is to use the port number as input to the lsof command

# lsof -i :9090
lsof: WARNING: compiled for AIX version 5.2.0.0; this is 5.3.0.0.
COMMAND   PID USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
inetd   10368 root   16u  IPv4 0x72d70a10      0t0  TCP *:wsmserver (LISTEN)
Socket-to-PID mapping can also be used with TCP Control Block as input to the rmsock command. rmsock wont delete or kill any application, as the command name suggests. It will check for the owner of the TCP Control Block, if the owner exists. It will just print the information.
# rmsock 0x72d70a10 tcpcb
The socket 0x72d70808 is being held by proccess 10368 (inetd).




KDB(Kernel Debugger) can also be used to make that Socket-to-PID mapping. As you can see from the below output use the sockinfo command. At the extreme end of the command, you can see the HEX number of the PID. In our example "02880" is that number. We can easily convert the HEX to DEC PID with the help of bc command.
# kdb
(0)> sockinfo 0x72d70a10 tcpcb
---- TCPCB ----(@ 72D70A10)----
    seg_next...............@72D70A10 seg_prev...............@72D70A10
    t_softerror... 00000000 t_state....... 00000001 (LISTEN)
    t_timer....... 00000000 (TCPT_REXMT)
.......
.......
TRUNCATED OUTPUT HERE FOR READABILITY
.......
.......
    accept........... FFFFFFFF frcatime 00000000
    isnoflgs 00000000 ()
    rcvlen........... 00000000 frcaback.........@00000000
    frcassoc.........@00000000 frcabckt......... 00000000
    iodone.. 00000000          iodonefl 00000000 ()
    ioarg............@00000000 refcnt........... 00000001
    trclev........... 0001

proc/fd:  40/16
proc/fd: fd: 16
              SLOT NAME     STATE    PID  PPID  PGRP   UID  ADSPACE  CL #THS
pvproc+005000   40*inetd    ACTIVE 02880 0236A 02880 00000 000182E3   0 0001

(0)> quit

# echo "ibase=16; 02880" | bc
10368

# ps -ef | grep 10368
    root 10368  9066   0 08:18:45      -  0:00 /usr/sbin/inetd


When root password was last updated in Aix server

This is cumbersome to know when root password was lasted updated in Aix system especially at times of audit. Calculating the days/time as per the info in /etc/security/password which is really a madness. Here is the solution of how to check when root password was last updated.

1) Check lastupdate in /etc/security/passwd    or pwdadm -q root
root:
        lastupdate = 1316984479
 
2) Then run this command
perl -le 'print scalar localtime 1316984479'

Mon Sep 26 02:31:19 2011
 
That's it!

* Source Article from : Internet