Friday, 29 July 2011

AIX Commands


---> Command to convert the expire date/ password created dates in /etc/security/passwd
grep -p <user id > /etc/security/passwd
id=<id name>
last modified=1311246800<you have to paste this latest value in the below command. it will show when the id is modified.

perl -e 'print scalar localtime(<paste the date value>);'

 --->To  capture the Lun ID in AIX

odmget CuAt|grep -p <disk no> |grep -p unique|grep value|cut -c20-62|head -1

---> To capture the disk lun no. and all in VIO servers
for i in <disk names>
do
echo "$i : `lspv|grep -w $i|awk '{print $2}'` : `lscfg -vpl $i|grep -i serial|sed 's/^.*\.//'` : `lsattr -EHl $i|grep -i unique|awk '{print $2}'`"
done
=================LVM==========================================

=== To create a filesystem with inline log

crfs -v jfs2 -d <lvname> -a logname=INLINE -m <MOUNT POINT>  -Ay -t yes

===if you need to find out when an LV was created try the following as root=======

# getlvcb -AT <LV_name>







migratelp - example on what and how its done
Example One
Move an PP from one disk to another disk, ie correct part of the LV mirroring as
some copies (PP's) are on the same disk.
# lslv -m stewtestlv                                           
stewtestlv:/stewmp                                                
LP    PP1  PV1               PP2  PV2               PP3  PV3      
0001  0201 hdisk1            0241 hdisk1                          
0002  0129 hdisk0            0242 hdisk1                          
0003  0130 hdisk0            0243 hdisk1                          
# migratelp stewtestlv/1 hdisk0                                  
migratelp: Mirror copy 1 of logical partition 1 of logical volume 
        stewtestlv migrated to physical partition 128 of hdisk0.  
# lslv -m stewtestlv                                              
stewtestlv:/stewmp                                                
LP    PP1  PV1               PP2  PV2               PP3  PV3      
0001  0128 hdisk0            0241 hdisk1                          
0002  0129 hdisk0            0242 hdisk1                          
0003  0130 hdisk0            0243 hdisk1 
Example TWO
Move a PP from one part of a disk to another. Generally used to free up PP No 1 on
a disk prior to migrating the disks VG to a large VG.
hdisk1:1        hd9var:13:2         
hdisk1:2        hd9var:14:2
hdisk1:3        hd9var:15:2
hdisk1:4        hd2:1:1   
hdisk1:5        hd2:2:1   
hdisk1:6        hd2:3:1
# lslv -m hd9var
hd9var:/var                                                  
LP    PP1  PV1               PP2  PV2               PP3  PV3 
0001  0169 hdisk0            0062 hdisk1                     
0002  0170 hdisk0            0063 hdisk1                     
0003  0171 hdisk0            0064 hdisk1                     
0004  0172 hdisk0            0065 hdisk1                     
0005  0173 hdisk0            0066 hdisk1                     
0006  0210 hdisk0            0067 hdisk1                     
0007  0211 hdisk0            0068 hdisk1                     
0008  0212 hdisk0            0069 hdisk1                     
0009  0213 hdisk0            0070 hdisk1                     
0010  0214 hdisk0            0071 hdisk1                     
0011  0223 hdisk0            0072 hdisk1                     
0012  0303 hdisk0            0163 hdisk1                     
0013  0304 hdisk0            0001 hdisk1                     
0014  0305 hdisk0            0002 hdisk1                     
# migratelp hd9var/13/2 hdisk1/201
migratelp: Mirror copy 2 of logical partition 13 of logical volume
        hd9var migrated to physical partition 201 of hdisk1.      
# lslv -m hd9var
/hd9var:/var                                                 
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0169 hdisk0            0062 hdisk1                    
0002  0170 hdisk0            0063 hdisk1                    
0003  0171 hdisk0            0064 hdisk1                    
0004  0172 hdisk0            0065 hdisk1                    
0005  0173 hdisk0            0066 hdisk1                    
0006  0210 hdisk0            0067 hdisk1                    
0007  0211 hdisk0            0068 hdisk1                    
0008  0212 hdisk0            0069 hdisk1                    
0009  0213 hdisk0            0070 hdisk1                    
0010  0214 hdisk0            0071 hdisk1                    
0011  0223 hdisk0            0072 hdisk1                    
0012  0303 hdisk0            0163 hdisk1                    
0013  0304 hdisk0            0201 hdisk1                    
0014  0305 hdisk0            0002 hdisk1   
#lspv -M hdisk1
hdisk1:1                  
hdisk1:2        hd9var:14:2
hdisk1:3        hd9var:15:2
hdisk1:4        hd2:1:1   
hdisk1:5        hd2:2:1   
hdisk1:6        hd2:3:1

 
====Is diskx formatted for LVM/Oracle/x ?

Theres an easy and safe way to tell if a disk has data on it, and to make a guess at what it is... just dd | od the disk.

# dd if=/dev/hdisk10 count=10 | od -a
0000000  nul stx soh soh nul nul nul nul nul nul nul stx   y   S  bs   -
0000020  nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000040    O   R   C   L   D   I   S   K nul nul nul nul nul nul nul nul
0000060  nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000100   lf dle nul nul nul stx soh etx   D   A   T   A   D   G   _   0
0000120    0   0   2 nul nul nul nul nul nul nul nul nul nul nul nul nul
0000140  nul nul nul nul nul nul nul nul   D   A   T   A   D   G nul nul
0000160  nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000200  nul nul nul nul nul nul nul nul   D   A   T   A   D   G   _   0
0000220    0   0   2 nul nul nul nul nul nul nul nul nul nul nul nul nul
0000240  nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
*
0000300  nul nul nul nul nul nul nul nul soh   v   J   p   .   w   L nul
0000320  soh   v   X   v   P   B   $ nul stx nul dle nul nul dle nul nul
0000340  nul soh   < nul nul etx   h nul nul nul nul eot nul nul nul soh
0000360  nul nul nul stx nul nul nul nul nul nul nul nul nul nul nul nul
0000400   lf dle nul nul soh   v   &   j  si  us   T nul nul nul nul nul
0000420  nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
*
0010000  nul stx stx soh nul nul nul soh nul nul nul stx nul   m   D   y
0010020  nul dc1   F enq nul nul nul nul nul nul nul nul nul nul nul nul
0010040  nul nul nul nul nul   ~ nul   ~ soh   @ nul soh soh   @ nul soh
0010060  soh   @ nul soh soh   @ nul soh soh   @ nul soh soh   @ nul soh
*
0012000

 




========LPAR LEVEL INFO================== 
lsrsrc IBM.ManagementServer
lpartstat will show how the lpar is allocated with cpu and memory
smtctl will give the no. of bind processors allocated .
smtctl [-m off | on [ -w boot | now] ]


======Monitoring===============================================================================
svmon -Pt15 | perl -e 'while(<>){print if($.==2||$&&&!$s++);$.=0 if(/^-+$/)}'


No comments:

Post a Comment