Tuesday, October 4, 2011

AIX Notes

Flush AIX LDAP cache:
/usr/sbin/flush-secldapclntd

Linux:
Display failed login count:  faillog –u <userid>
Reset it: faillog –u <userid> -r


ftp access:
When trying to grant access to a ftp user on a server, in addition to adding them to /etc/passwd and associated, they usually need to be added to the /etc/ftpusers.allow file...

You will also need to ensure that the ftp.secure cron is not commented out and the machine is using NIS as the current version of that script is not ldap friendly.

sudo file:
/etc/sudoers
sudo  Entry Standard:
###UHGSUDO#usrnumber#expdate (mmddyy)
###UHGSUDO#usrnumber#admins last name#end
Enter 999999 as the date for a non-expiring entry.

AIX 64-bit conversion:

1. Check hardware is 64-bit:  bootinfo –y
2. What kernel am I running now?  bootinfo -K
3. Ensure 64-bit kernel filesets are loaded:  lslpp –l |grep bos.mp
4. Link the 64-bit kernel:  ln –s /usr/lib/boot/unix_64 /unix
  ln –s /usr/lib/boot/unix_64 /usr/lib/boot/unix
5. Update bootinfo:  bosboot –ad /dev/hdisk0
6. Reboot:  shutdown –Fr
7. Check kernel after reboot:  bootinfo -K

Determine system firmware level:
AIX: lscfg -vp | grep -p Platform

Memory and CPU count:
AIX:
* CPU:
lsdev –Cc processor
* Memory:
lsattr –El sys0 –a realmem
Both:
prtconf

Solaris:
CPU and Memory:
prtconf

HPUX:
print_manifest

Find largest objects in current dir:
du -k |sort -t -k1,1 -n -r |more
du -k | sort -n -r |more


rsync copying:
sync the current dir to remote machine, do not overwrite newer files:
rsync -auvzpe ssh . ngenprfuncu1:/remote/path

Migration rsyncs (assumes pw-less root ssh works):
Rsync –aczvW –e ssh –delete /path/ hostname:/remote/path/


AIX Maintenance Level:

Simple Check:
oslevel –r

New format including TL and SP (works on 5.3 TL3 and above):
oslevel -s

Complete Check:
instfix –i |grep ML

List Known Recommended MLs:
oslevel –rq

List Recommended filesets to upgrade to specific ML:
oslevel –rl 5200-01

instfix -icqk  4330-03_AIX_ML | grep ":-"

Is an APAR installed?
instfix –ik IY99999


Set disk parameters on LPAR's:
for D in `lspv | awk '{print $1}'`
do
    chdev -l $D -a reserve_policy=no_reserve -a algorithm=round_robin -a queue_depth=32 -P
done

Set disk parameters on VIO's:
for D in `lspv -free | awk '{print $1}'`
do
    chdev -dev $D -attr reserve_policy=no_reserve queue_depth=32
done

list all LDEV's on the frame from the VIO Server.
for D in `lspv | awk '{print $1}'`
do
    echo $D
    lsdev -dev $D -vpd |grep "(Z1)"
done

Which lpar am I on?
uname –L
output (the number before the name is the lpar #):
1 apsp0020

Which HMC controls this lpar?
lsrsrc IBM.ManagementServer


LPAR command-line info tools:
lpartstat: view partition config
lparstat –h 10 – View managed server level cpu usage
mpstat: monitor activity
topas –L: show topas LPAR view
oem_setup_env: enter root mode on lpar/vio


Creating snap and sending to IBM for analysis:
If a dump was done, check its viability:
sysdumpdev –L

Find a filesystem with enough space for the dump and make a temp dir there, then run:
snap –gfkDN –c –d /destination/directory

Rename the snap.pax.Z to this format:  <PMR#>.<BRANCH>.pax.Z
For example, for PMR 88040, Branch 379:  88040.379.pax.Z

FTP the file to testcase.software.ibm.com into directory /aix/toibm.

For hardware: testcase.boulder.ibm.com into directory /toibm/hw

SFTP to IBM:

sftp anonymous@sftp.ecurep.ibm.com

and then just cd into the hw toibm etc... directories as you would have for FTP

NIM Servers:
Show resources in a nim object:
nim –o showres lpp_source_53_03

Reset a client:
nim -F -o reset <hostname>

Deallocate a resource:
nim -o deallocate -a spot=[nim name of spot] <hostname>

Deallocate all resources from a host:
nim -o dellocate -a subclass=all <hostname>

Add packages to an lpp_source:
nim -o update -a packages=all -a source=/export/lpp_source/holding/53_12SP2_test lpp_source53_12sp2

Clean up duplicate packages in an lpp_source:
nim -o lppmgr -a lppmgr_flags="-bu -x -r -e" lpp_source53_12sp2

Check lpp_source after manually adding files to dir:
nim –o check lpp_source53_12sp2

Build a spot from an lpp_source:
nim -o define -t spot -a server=master -a location=/export/spot/spot61_06sp2_VSP -a source=lpp_source61_06sp2_VSP spot61_06sp2_VSP

Build a spot from a mksysb
nim -o define -t spot -a source=[mksysb] -a server=master -a location=/export/nim/spot [spot_name]

Remove a fileset from an lpp_source:
nim -o update -a packages="devices.fcp.disk.HP.xparray.mpio.rte" -a rm_images=yes lpp_source61_06sp2_VSP

List packages in SPOT:
nim -o lslpp spot61_06sp2_VSP


alt_disk_install a new ML on AIX:

1. Install alt_disk_install filesets if necessary:
a. lslpp –l |grep alt
b. scp hermes:/tools/Alt-disk-inst/AIX5.2/bos.alt_disk_install  /tmp
c. cd /tmp
d. smitty install
2. Remove dump device on mirror disk if necessary (make note of name and size):
a. sysdumpdev –l
b. sysdumpdev –s /dev/sysdumpnull
c. rmlv –f ‘lg_dumplv1’
3. Unmirror rootvg and remove hdisk (using hdisk1 in this example)
a. unmirrorvg rootvg hdisk1
b. chpv –c hdisk1
c. bootlist –m normal hdisk0
d. check to ensure no LVs on hdisk1:  lspv –l hdisk1
e. reducevg rootvg hdisk1
f. verify hdisk1 is not assigned to a VG: lspv
4. Create cloned rootvg:
a. alt_disk_install –CB hdisk1
5. Boot to cloned disk:
a. bootlist –m normal hdisk1
b. shutdown –Fr
6. Install Updates (Consult update docs for steps.)
7. Cleanup old_rootvg:
a. alt_disk_install –X old_rootvg
b. extendvg –f rootvg hdisk0
c. chvg –Qn rootvg
d. mirrorvg rootvg hdisk0
e. bosboot –ad /dev/hdisk0
f. bosboot –ad /dev/hdisk1
g. bootlist –m normal –o hdisk0 hdisk1
8. Recreate Secondary dump device:
a. recreate lv with same name and size
b. sysdumpdev –s /dev/lg_dumplv1
9. Reboot to verify bootlist and mirror.

alt_disk_install migration logs location:
On the NIM server: /var/adm/ras/alt_mig

Clean-up failed NIM alt_disk_install:
On the nim server: nimadm –C –c cometapp01 –s spot53_03

Setup NIM to boot lpar into maintenance mode:
nim -o maint_boot -a spot=<SPOT> <node name>

Show verbose boot info from maintenance SMS mode:
From platform open firmware prompt:
boot -s verbose

Setting session timeout:
AIX:
export TMOUT=0

Sun:
TMOUT=0


Using lsof to check TCP ports:
List all ports and sessions:
lsof –i

Check specific port:
lsof –i TCP:21

If lsof is not available:
1. netstat -Aan | grep <port number>
- This shows if the specified <port number> is being used. The hex number in the first column is the address of protocol control block (PCB)

2. rmsock <addr of PCB> tcpcb
- This shows the process who is holding the socket. Note that this command must be run as root.

Viewing alog files:
alog –f alogfilename –o |more


Delete VG and everything under it:
reducevg -df toolsvg hdisk1


Useful uses for the ps command:
Check what processes are using % of real memory (see %MEM column):
ps aux | head -1 ; ps aux | sort -rn +3 | head

Check what how much virtual memory a process is using (see SZ column):
ps –ealf

Top 20 memory process:
ps -eo pid,vsz,args |head -n 1;ps -eo pid,vsz,args |sort -r -k 2,2|head -20

View process tree:
ps -L 909382 –lf

View process priority:
ps –elk

View thread priority:
ps -ekmo THREAD  (-p <pid>)

Unkillable process:
ps –L <pid> -l
kill -36 <pid>  will kill parent process.

Using svmon to check a process for memory leaks:
Check the output of this command:
If no iterations number is specified, svmon runs until interrupted.

svmon –P <pid> -t 1 -i <delay> <iterations>

Should also check trace for more malloc than free:
    Trace pid 458770:
    trace -a -A 458770 -o /tmp/trace.raw; sleep 60; trcstop

    Generate Trace Report:
    trcrpt -o /tmp/trace.txt /tmp/trace.raw

Display output of svmon top 10 paging space consumers:

svmon -P -g -t 10 | perl -lne 'print if /^\s+Pid|N|Y|^-/'


Check rpc communications with remote host:
rpcinfo -p ngenprapu1

Fix hdisk that is listed as “missing” or “removed”:
If the same disk was disconnected and now reattached, you can try:
chpv –v a hdisk1

Hitachi HDLM useful commands:
View path info:
/usr/DynamicLinkManager/bin/dlnkmgr view -path

View drive info (what hdisks go to what dlmfdrvXX):
/usr/DynamicLinkManager/bin/dlnkmgr view –drv

Reconcile what LUN goes with which dlmfdrvXX:
/usr/DynamicLinkManager/bin/dlnkmgr view -path  | grep HITACHI  | awk '{ print $6"  "$13}' | sort -u > /tmp/san_info.out

Offline an HBA:
/usr/DynamicLinkManager/bin/dlnkmgr offline -hba 08.11 (reverse of the AIX card loc)

Offline a path:
/usr/DynamicLinkManager/bin/dlnkmgr offline –pathid 8 (not sure where to find this)

Clear HDLM Reserve:
To view possible reserves:
dlmpr –k

To clear reserves:
dlmpr –c hdisk3

Change HDLM to 64-bit:
1- Stop the dlm processes (stopsrc –s DLMManager)

2- Remove all devices

# rmdev -dl fcs0 -R
# rmdev -dl dlmfdrv
# rmdev -dl dlmadrv

3- Apply the change in dlm (5 = AIX 5.2 64 bits)

# dlmchenv -v 5

4- Restart the dlm processes

5- Recreate the devices

# cfgmgr

Notes: here are the valid options for the -v flag (OSmode) for the dlmchenv command:

AIX4.3 = 1
AIX5.1 32bit mode = 2
AIX5.1 64bit mode = 3
AIX5.2 32bit mode = 4
AIX5.2 64bit mode = 5
AIX5.3 64bit mode = 7

Select a column in Putty:
Ctrl-shift-alt-mouse


Query PVs and LVs:
Query PV for PVID:
lquerypv –h /dev/hdisk2 80 10

Query PV for Oracle ASM info:
lquerypv –h /dev/hdisk2
Look for orcldisk in column location 20.

Query VG for LV info:
lqueryvg -p dlmfdrv66 –L

Show all PVID list in VGDA:
lqueryvg -p dlmfdrv66 –P

Show the VGID on the disk:
lqueryvg -p dlmfdrv66 –v

Query VG info on PV:
lqueryvg -Atp hdisk2

Read VGDA:
readvgda hdisk2

Determine if ODM and VGDA are in sync:
getlvodm -u <vg>

Correct issues if the Volume Group member disks are out of sync with the ODM:
redefinevg -d hdisk(x) hdlmvg

Unlock VG if the message 0516-366 lsvg: Volume group <vg> is locked  is ever seen:
putlvodm -K `gtlvodm -v <vg>`

Get PV size:
bootinfo -s hdisk(x)

findlvm checks the basic ODM classes relevant to the LVM for a particular string.
Syntax: findlvm <string>

#!/usr/bin/ksh
for class in CuAt CuDv CuDep CuDvDr PdAt PdDv
do
odmget $class | grep -ip $1
done

Check LVM entries log:
alog -t lvmcfg -o > /tmp/lvm_config.out
also note /tmp/lvmt.log has info


Fix screen size in putty:
resize


Initiating a core dump from the FSP on a p570:
1. Increment to 2
2. <enter>
3. <enter> again to move to the second operator.
4. Increment the second operator to M for manual (it will start as N).
5. <enter>
6. Increment to 22.
7. <enter>
8. Increment to 22 again.
9. <enter>
10. Once the dump is complete, the system will boot.  Since the FSP is set to manual, the system will come up in maintenance mode.  Repeat steps 1 thru 4 again, changing the M to N and then either power cycle the box or enter single-user mode and reboot the box (run ‘sync’ and then ‘reboot’).

Paging space calculation:
PS = 512 + ((RAM – 256) * 1.25)
If real memory is greater than 4GB, then ps=real mem.


Get WWN and scan HBA from Open Firmware Prompt:
Boot the server into SMS.
Select Open Firmware Prompt.
Enter 'ioinfo' and the ok prompt.
Select "FCINFO"
Select the HBA that your boot LUN is assigned to (ONLY ONE at this point)
Select "List Attached FC Devices"


The following is an example of re-creating boot logical volume (BLV)

1. Boot your machine in maintenance mode (from CD, tape, or NIM).

2. Create a new hd5 logical volume: one physical partition in size, must be in rootvg. Specify boot as logical volume type. if needed, remove hd5 using
# rmlv -f hd5
# chpv -c /dev/hdiskxx (boot disk)
# mkboot -cd /dev/hdiskxx (boot disk)
# mklv -y hd5 -t boot -a e rootvg 1 hdiskxx (boot disk)

3. Run the bosboot command as described below.
# bosboot -ad /dev/hdisk0
# sync
# savebase

4. Shutdown -Fr.

Filesystem Creation on AIX
Creating a Concatinated volume
mklv -y data3 -t jfs2 dbvg 1599 hdisk6
crfs -v jfs2 -d data3 -m /oracle/data3 -A yes -p rw -a logname=INLINE

Creating a striped volume set.
How to create a jfs2 filesystem
1. Create volume group
        mkvg -q -y dbvg -s 128 -f -B hdisk0 hdisk1 hdisk...
           *** Use 128k partition size

2. Create logical volume
        mklv -y data1 -t jfs2 -S 128K dbvg 350 hdisk0 hdisk1 hdisk...

3. Create jfs2 log
        mklv -y loglv01 -t jfs2log dbvg 1 hdisk14
        logform -V jfs2 /dev/logv01

4. Create filesystem
        crfs -v jfs2 -d data1 -m /oracle/data1 -A yes -p rw -a logname=INLINE

chfs -a check=true /oracle/data1


Extend stripe set to more disks
extendlv -u 10 data1 10 10G hdisk9 hdisk10 hdisk11 hdisk12 hdisk13
extendlv -u 10 data2 10 10G hdisk9 hdisk10 hdisk11 hdisk12 hdisk13
extendlv -u 10 backup 10 10G hdisk9 hdisk10 hdisk11 hdisk12 hdisk13


Migrate LV or striped LV to a new set of disks - Without interuption
1. mklvcopy -k data2 2 hdisk9 hdisk10 hdisk11 hdisk12 hdisk13 <- new location
   --> wait for this to complete
2. lslv data2 and verify copies=2 and mirror is in-sync
3. lslv -l data2 <- should show the LV on old and new set of disks
4. rmlvcopy data2 1 hdisk1 hdisk2 hdisk3 hdisk4 hdisk5 <- removes LV from
   original disks.
   -->wait for this to complete
5. lslv -l data2 <- verify that LV is only on the new disks

Alt_Disk_Install
Manually Running alt_disk_install
alt_disk_install -B -C -P all hdisk9

Manually Running alt_disk_install Patch Process
alt_disk_install -B -C -P all -b update_all -l /mnt/maint_packs/6100-05 hdisk(x)

ODM and NIM
Backup the ODM
tar -cvf /tmp/odmbackup.tar ./etc/objrepos ./usr/lib/objrepos

Look for nim objects in the ODM and remove them...
odmget nim_attr | grep vios-2-1-2-FP22-spot
odmget -q value=vios-2-1-2-FP22-spot nim_attr
odmdelete -q value=vios-2-1-2-FP22-spot -o nim_attr

No comments:

Post a Comment