AIX 6.1 Native SAN from VIO to LPAR- How to Remove

Posted in AIX, Tutorials/Whitepapers with tags on December 1, 2011 by triz

This example is removing the mapping from VIO to LPAR that is being decommissioned.

Access LPAR to determine the mapping information:

[root@ret4a139v:~] # lsvg
rootvg


From this output we see there is only one volume group called rootvg. Below we will list the logical volumes inside the rootvg volume group and see how they are mounted.
[root@ret4a139v:~] # lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 1 1 closed/syncd N/A
hd6 paging 128 128 1 open/syncd N/A
hd8 jfs2log 1 1 1 open/syncd N/A
hd4 jfs2 16 16 1 open/syncd /
hd2 jfs2 56 56 1 open/syncd /usr
hd9var jfs2 48 48 1 open/syncd /var
hd3 jfs2 32 32 1 open/syncd /tmp
hd1 jfs2 32 32 1 open/syncd /home
hd10opt jfs2 64 64 2 open/syncd /opt
hd11admin jfs2 1 1 1 open/syncd /admin
dump01 sysdump 32 32 1 open/syncd N/A
livedump jfs2 8 8 1 open/syncd /var/adm/ras/livedump
locallv jfs2 16 16 1 open/syncd /usr/local
rootlv jfs2 16 16 1 open/syncd /root
lv1msb01 jfs2 240 240 1 open/syncd /mksysb_dir
lv1esm01 jfs2 32 32 1 open/syncd /opt/esm
lv1tiv01 jfs2 48 48 1 open/syncd /opt/Tivoli
lv1oov01 jfs2 32 32 1 open/syncd /opt/openv
paging00 paging 128 128 1 open/syncd N/A

[root@ret4a139v:~] # lsfs
Name Nodename Mount Pt VFS Size Options Auto Accounting
/dev/hd4 -- / jfs2 2097152 -- yes no
/dev/hd1 -- /home jfs2 4194304 -- yes no
/dev/hd2 -- /usr jfs2 7340032 -- yes no
/dev/hd9var -- /var jfs2 6291456 -- yes no
/dev/hd3 -- /tmp jfs2 4194304 -- yes no
/dev/hd11admin -- /admin jfs2 131072 -- yes no
/proc -- /proc procfs -- -- yes no
/dev/hd10opt -- /opt jfs2 8388608 -- yes no
/dev/livedump -- /var/adm/ras/livedump jfs2 1048576 -- yes no
/dev/locallv -- /usr/local jfs2 2097152 -- yes no
/dev/rootlv -- /root jfs2 2097152 -- yes no
/dev/lv1msb01 -- /mksysb_dir jfs2 31457280 -- yes no
/dev/lv1esm01 -- /opt/esm jfs2 4194304 -- yes no
/dev/lv1tiv01 -- /opt/Tivoli jfs2 6291456 -- yes no
/dev/lv1oov01 -- /opt/openv jfs2 4194304 -- yes no

Now we can remove the mount points and logical volumes using rmfs command:
#for i in /opt/openv /opt/Tivoli /opt/esm /mksysb_dir /usr/local /root /var/adm/ras/livedump /opt /admin /tmp /var /usr /home; do rmfs -r $i; done

At this point we need to find out the vscsi slot number to identify the vhost on the VIO server. We will list the adapters then show the config for the vscsi on the LPAR. Then take the slot number and find the vhost on the VIO server on the same slot.
From the LPAR:
[root@ret4a139v:~] # lsdev -c adapter
ent0 Available Virtual I/O Ethernet Adapter (l-lan)
ent1 Available Virtual I/O Ethernet Adapter (l-lan)
fcs0 Available 00-00 4Gb FC PCI Express Adapter (df1000fe)
fcs1 Available 00-01 4Gb FC PCI Express Adapter (df1000fe)
fcs2 Available 02-00 4Gb FC PCI Express Adapter (df1000fe)
fcs3 Available 02-01 4Gb FC PCI Express Adapter (df1000fe)
fcs4 Available 05-00 4Gb FC PCI Express Adapter (df1000fe)
fcs5 Available 05-01 4Gb FC PCI Express Adapter (df1000fe)
fcs6 Available 01-00 4Gb FC PCI Express Adapter (df1000fe)
fcs7 Available 01-01 4Gb FC PCI Express Adapter (df1000fe)
fcs8 Available 04-00 4Gb FC PCI Express Adapter (df1000fe)
fcs9 Available 04-01 4Gb FC PCI Express Adapter (df1000fe)
fcs10 Available 03-00 4Gb FC PCI Express Adapter (df1000fe)
fcs11 Available 03-01 4Gb FC PCI Express Adapter (df1000fe)
vsa0 Available LPAR Virtual Serial Adapter
vscsi0 Available Virtual SCSI Client Adapter
vscsi1 Available Virtual SCSI Client Adapter

[root@ret4a139v:~] # lscfg -l vscsi0
vscsi0 U9117.MMB.1010F9P-V9-C53-T1 Virtual SCSI Client Adapter
[root@ret4a139v:~] # lscfg -l vscsi1
vscsi1 U9117.MMB.1010F9P-V9-C54-T1 Virtual SCSI Client Adapter

As padmin on the VIO server:
padmin@retvio187a1:/home/padmin $ lsmap -all | grep -i c53
vhost16 U9117.MMB.1010F9P-V1-C53 0x00000009

Alternatively, we can also use the below command:
padmin@retvio187a1:/home/padmin $ lsdev -slots | grep -i c53
U9117.MMB.1010F9P-V1-C53 Virtual I/O Slot vhost16

padmin@retvio187a1:/home/padmin $ lsmap -vadapter vhost16
SVSA Physloc Client Partition ID
--------------- -------------------------------------------- ------------------
vhost16 U9117.MMB.1010F9P-V1-C53 0x00000009

VTD 4a139_r_pwr151
Status Available
LUN 0x8100000000000000
Backing device hdiskpower151
Physloc U78C0.001.DBJ3457-P2-C1-T2-L153

VTD 4a139_r_pwr152
Status Available
LUN 0x8200000000000000
Backing device hdiskpower152
Physloc U78C0.001.DBJ3457-P2-C1-T2-L154

VTD 4a139_r_pwr153
Status Available
LUN 0x8300000000000000
Backing device hdiskpower153
Physloc U78C0.001.DBJ3457-P2-C1-T2-L155

Now we can remove all virtual target devices associated with the given backing devices.
#for i in hdiskpower151 hdiskpower152 hdiskpower153;do rmvdev -f -vdev $i;done

Configure ITM6 (IBM Tivoli) not to create files in /tmp

Posted in AIX on November 29, 2011 by triz

This is very rough draft

My recommendation would be to stop the RTS installed agents, uninstall them, then configure the VIOS agent, and start it up.

Stop the agents as root:
/opt/Tivoli/ITM/bin/itmcmd agent -f stop all

Uninstall the agents as root:
/opt/Tivoli/ITM/bin/uninstall.sh
Follow the prompts, uninstall all components from this directory structure including the last prompt to uninstall /opt/Tivoli/IBM

Configure the VIOS agent as padmin:
From configuration doc:
Make sure keys from the VIO Servers to the HMC do not prompt for password.
ssh itmuser@hostname date
This should return a date value and not prompt for a SSH key handshake, if it does then the SSH keys need to be established with the HMC

IF the SSH handshake fails:
HMC
Create the itmuser user on the HMC. Ensure that the ‘AllSystemResources’ Managed Resource Role is checked as well as the ‘hmcviewer’ Task Role is selected.
VIO Server
Login and become root user
Create ssh keys .
mkdir –p /root/.ssh (if needed)
cd /root/.ssh
ssh-keygen –t rsa ( take the default prompts)
cat id_rsa/pub > authorized_keys
Copy the key from VIO Server to HMC. For Example,
keys=`cat authorized_keys`
ssh itmuser@hostname “mkauthkeys –add ‘$keys’”
or
cat authorized_keys and paste it the command below
ssh itmuser@hostname “mkauthkeys –add ‘
mkauthkeys –add ‘ssh-dss AAAAB3NzaC1kc3MAAACBAK7TPQ+iNAZbA/Rcz29lutHNRkDPylRC+HekzjXA7WIcxaX1OD4FIBZdGd3woNY0ItuYb9LJArxsarMxahUQEwK87L6uEV801Wq5NQdAWZ7OcPUxph14VLGNCtUILFqy+Y34skhULHkaE/c/tqQMmaI5nupuWiPYLiEWeDcmDPZvAAAAFQDWcdTtBqHjY+Yzm3mgXzR0jABQKwAAAIAZCdUu5KGMtjN3MS+BUfLGjgeQux6d29RC9Z88UWlF6D5oxXbDtrq3dBn7U0o0TENq80DBSBdkd7INLZxt49sQurl7oNjiNDC5v/32U/d6ePblS+tMUtSRI34so6HMsw0NpMw90x9/w7fjfmXBppMQTwNbiglLb7t2dA+3mDZUIAAAAIBlmYpJtViuGEWM15s1QNaHAHM9zi4+n0pJCQ6D9+3rf2l14MqYtiPjzXKNE5xddRWawUSMR8B0BWGpWX9eAtVU1WhZHmtUl9GIEwT80yAE8ZvgGgi6axioNb6w9QNvhz+rB7shavLnhuBl/QanTOwKQ8z9OnjsyG42sVlRS+CI+w== root@hostname.svr.us.coName.net’”
Test
ssh user@hostname “date”
Repeat for each VIO SERVER.

AS PADMIN:

Run command with the values above
cfgsvc ITM_premium -attr RESTART_ON_REBOOT=TRUE managing_system=itmuser@HMC01.svr.us.coName.net hostname=ITM SERVER
example,
cfgsvc ITM_premium -attr RESTART_ON_REBOOT=TRUE managing_system=itmuser@HMC01.svr.us.coName.net hostname=host081v.svr.us.coName.net

Those steps will have the VIOS Premium agent configured.
Can be verified with ‘lssvc ITM_premium’

Start the VIOS Premium agent:
startsvc ITM_premium

Utility script to collect HBA information on AIX

Posted in AIX on November 29, 2011 by triz

This is Sunny’s script to gather HBA information from AIX servers as follows:
# 12/04/2009 – created script to display hba WWN
# 07/06/2011 – Added logic to print disk and scsi id
# 10/01/2011 – Added logic to check NPIV and tape device
#
hba-info.sh
#
#!/usr/bin/ksh
#
#Script to print HBA WWN
#
#
cleanup() {
[[ -z "$1" ]] && echo "command at line ${1}\n"
rm -f $TMPFILE $TMPTAPE
exit
}
#
# Main start here
#
export PATH="/usr/bin:/etc:/usr/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH:."
TMPFILE=/tmp/.hba-path.txt
TMPTAPE=/tmp/.tape.path.txt
trap 'cleanup $LINENO' QUIT EXIT INT
#
lspath > $TMPFILE
lsdev -Cc tape -F name,parent > $TMPTAPE
echo "Host Name, HBA, WWN, Location, Type, INIT_LINK, Attach, Dyntrk, fc_err_recov,SCSI ID,Usage,Slot"
#
lscfg -vl fcs*| perl -lane 'BEGIN { my @hbainfo; chomp($hostname=`hostname|cut -f1 -d. `) }
if(/^\s+(fcs\d+)\s+([^\s]+)(.*)$/){
$f=$1; $loc=$2; $adtype="REAL";
if ( $3 =~ /Virtual Fibre Channel/i ){ $adtype="NPIV";}
}
if(/Network/){
s/\s*Network Address\.+//; s/([\dA-F]{2})/$1:/g; s/:$//;
push( @hbainfo,sprintf("%s,%s,%s,%s,%s\n",$hostname,$f,$_,$loc,$adtype) );
}
END {
@shbainfo =sort { ($a =~ /(\d+)/)[0] ($b =~ /(\d+)/)[0] } @hbainfo;
foreach $h ( @shbainfo ) {
printf("%s", $h);
}
} ' | while read h
do
f=$( echo "$h" |perl -F',' -lapne '$_=$F[1]; s/fcs/fscsi/;' )
CARD=$( echo "$h" |cut -f2 -d,)
#
ATTACH=$(lsattr -El $f -a attach -F value)
DYNTRK=$(lsattr -El $f -a dyntrk -F value)
FCERRR=$(lsattr -El $f -a fc_err_recov -F value)
INIT_LINK=""
if ! $( echo "$h" |grep -qi "NPIV") ; then
INIT_LINK=$(lsattr -El $CARD -a init_link -F value)
fi
SCSI_ID=$(lsattr -El $f -a scsi_id -F value)

SLOT=$(lsdev -Cl $CARD|perl -lane 'print $F[2]')
CHILD="None"
DISKS=$(cat $TMPFILE |perl -slane 'BEGIN{$x=0;}if(/Enabled\s+.*$f$/){$x++;}END{print $x;}' -- -f=$f)
TAPE=$(cat $TMPTAPE |perl -slane 'BEGIN{$x=0;}if(/rmt\d+,$f$/){$x++;}END{print $x;}' -- -f=$f)
[ $DISKS -gt 0 ] && CHILD="DISK:$DISKS"
[ $TAPE -gt 0 ] && CHILD="TAPE:$TAPE"

echo "$h,$INIT_LINK,$ATTACH,$DYNTRK,$FCERRR,$SCSI_ID,$CHILD,$SLOT"
done

rm -f $TMPFILE $TMPTAPE
exit 0

AIX 6 Gather System Information

Posted in AIX with tags , , on October 27, 2011 by triz

This is another dump of useful AIX commands for system information gathering.  I’m working from a console window, so my ability to paste command output is null.

The below commands are run from the VIO as user padmin:
1. List the virtual SCSI disk mapping.
$lsmap -all
$lspv

2. List the virtual Ethernet and shared Ethernet adapter configuration.
$lsmap -all -net

3. List the ctl_chan and ha_mode attributes of SEA.
$lsdev -dev ent3 -attr

4. Check the priority and status of SEA.
$entstat -all ent3 | grep -i priority

The below commands are run from the AIX lpar:
1. List the virtual Ethernet adapter(veth).
{sys084_partition1} / # lsdev -c adapter
ent0 Available Virtual I/O Ethernet Adapter (l-lan)
vsa0 Available LPAR Virtual Serial Adapter
vscsi0 Available Virtual SCSI Client Adapter

2. Find out the veth adapter slot.
{sys084_partition1} / # lscfg -pl ent0
ent0 U8204.E8A.65BF831-V21-C11-T1 Virtual I/O Ethernet Adapter (l-lan)

PLATFORM SPECIFIC

Name: l-lan
Node: l-lan@3000000b
Device Type: network
Physical Location: U8204.E8A.65BF831-V21-C11-T1

3. Determine the operating system and maintenance levels.
{sys084_partition1} / # oslevel -s
6100-02-02-0849

4. Verify that hdisk$ has multiple paths. In my case I don’t.
{sys084_partition1} / # lspath -l hdisk0
Enabled hdisk0 vscsi0

The below commands is run on the HMC:
1. Determine HMC’s version.
hscroot@sys11hmc:~> lshmc -V

Backup Check

Posted in Uncategorized on May 31, 2011 by triz

I think this backup script can be cleaned up… maybe with Perl.

#!/usr/bin/ksh
NETBACKUP_FILE="/usr/openv/netbackup/bin/version"
STATUS="NOT INSTALLED"
VERSION=","

if [ -f $NETBACKUP_FILE ] ; then
VERSION=$(perl -lane 'print $F[-1] if $F[-1] =~ m/\d+/' $NETBACKUP_FILE)
STATUS="NETBACKUP-INSTALLED"
C=$(netstat -an | perl -lane 'BEGIN{$c=0;}if(/tcp.*\.13782\s.*LISTEN/){$c++;}END{ print "$c";}')
[ $C -gt 0 ] && STATUS="NETBACKUP-RUNNING"
echo "NETBACKUP_STATUS: $STATUS"
echo "NETBACKUP_VERSION: $VERSION"
fi
C=$( ps -fed |perl -lane 'BEGIN{$c=0;}if(m#\s/usr/bin/dsmcad\b#){$c++;}END{print $c;}' )
if [ $C -gt 0 ] ; then
[ "$STATUS" == "NOT INSTALLED" ] && STATUS=""
STATUS="TSM-RUNNING"
VERSION=$(lslpp -cL tivoli.tsm.StorageAgent.rte|perl -F':' -lane 'print $F[2] if $F[0] =~ m/tivoli.tsm.StorageAgent.rte/')
echo "TSM_STATUS: $STATUS"
echo "TSM_VERSION: $VERSION"
fi

#echo "$STATUS,$VERSION"

AIX Enabling nmon data collection

Posted in Uncategorized with tags on May 31, 2011 by triz

1. Create directory structure for new script process.
[ -d /opt/nmon/bin ] || mkdir -m 755 -p /opt/nmon/bin
2. Copy code to new PATH /opt/nmon/bin/nmon-collect.sh
#!/usr/bin/ksh
#
# Script to collect NMON Data colletion on AIX server
#
# Add this script in cron like this.
#
# 1 0 * * * /opt/nmon/bin/nmon-collect.sh > /opt/nmon/log/nmon-collect.log 2>&1
#
#

PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin:/opt/boksm/bin:/opt/freeware/bin:
export PATH
WORK_DIR=/opt/nmon
DATA_DIR=$WORK_DIR/data/nmon
LOG_DIR="${WORK_DIR}/log"
export DATA_DIR WORK_DIR LOG_DIR
umask 0022

# Make sure data and log direcotry exists, otherwise create one
[ -d "$WORK_DIR" ] || mkdir -m 755 $WORK_DIR
[ -d "$DATA_DIR" ] || mkdir -m 755 -p $DATA_DIR
[ -d "$LOG_DIR" ] || mkdir -m 755 $LOG_DIR

# Create a daily NMON file - sampling once every 1 minute for 24 hours
#
nmon -fdT -s60 -c1440 -m${DATA_DIR}

#
# Compress NMON files older than 7 days
#
find $DATA_DIR -xdev -name "*.nmon" -mtime +7 -type f -print |xargs -L 1 -I {} -t gzip --best {}

#
# Delete NMON files older than 181 days
#
find $DATA_DIR -xdev -name "*.nmon.gz" -mtime +181 -type f |xargs -L 1 -I {} -t rm {}

exit 0

Crontab Entries for mksysb AIX

Posted in Uncategorized on May 17, 2011 by triz

I have assigned list of servers to each of you. Please check your assigned servers running mksysb weekly job. Check and give me the status. If job is not running we can create ECM to add this job.

1. Check and see VIO file set installed on the server.
a. lslpp -L |grep ios.cli.rt

2. Check for mksysb backup job, you can use suexec command to check this, no need to go thru breakglass.

E.g:
a.
$/opt/boksm/bin/suexec /usr/bin/cat /var/spool/cron/crontabs/root |grep MKSYSB.sh
01 01 * * 0 /usr/local/bin/MKSYSB.sh > /opt/mksysb_dir/MKSYSB.log 2>&1 <- we should see this line

b. If you see the above line looks at the log file for backup status
/opt/boksm/bin/suexec /usr/bin/cat /opt/mksysb_dir/MKSYSB.log |more

c. check /mksyb_dir or /opt/mksysb_dir for mksysb backup file.

$/opt/boksm/bin/suexec /usr/bin/ls -ltr /opt/mksysb_dir
total 15971920
drwxr-xr-x 2 root system 256 Sep 5 2008 lost+found
drwxr-xr-x 3 root system 256 Dec 22 2008 DB2_connect
-rw-r—– 1 root system 8177612800 Jan 23 01:10 ret7a312.mksysb
-rw-r—– 1 root system 1684 Jan 23 01:10 MKSYSB.log

Quick Tivoli ITM Trouble Steps

Posted in Uncategorized on May 17, 2011 by triz

1) make sure the old endpoint is decomm from EQ
2) stop lcfd process (/opt/Tivoli/lcf/dat/1/lcfd.sh stop)
3) edit /opt/Tivoli/lcf/dat/1/last.cfg
make sure lcs.machine= ie lcs.machine=dfwldwaprd1.fi.bear.com
lcs.machine_unique_id=
add lcs.login_interfaces=+9494 ie lcs.login_interfaces=169.81.178.8+9494 (use EQ/View GW to Zone Mapping to get the appreciate gateway)

4) remove /opt/Tivoli/lcf/dat/1/lcf.dat
5) rm -r cache (optional)
6) restart lcfd (/opt/Tivoli/lcf/dat/1/lcfd.sh start)

a) #cd /opt/Tivoli/ITM/bin
b) #./cinfo -r

Find Database

Posted in AIX, Linux with tags on March 30, 2011 by triz

I’m starting a database of situations and examples of when I need to use the find command.

Solaris:
Finding Large Directories
du -kod /var|sort -n | tail -10
Finding Large Files
find / -size +200000 -type f -ls | sort -k 7,7 -n

AIX:
find / -xdev -type f -size +2G -print | xargs -t --no-run-if-empt rm -f

Sweetest Since Sliced Bread

Posted in Linux with tags on March 10, 2011 by triz

Folks,

This is a good link to help translate commands between the different UNIX languages we support.

http://bhami.com/rosetta.html

Follow

Get every new post delivered to your Inbox.