Change the Failure Groups on a GPFS disk

./mmchdisk icash change -d "gpfs13nsd::::10"
./mmdf icash

disk                disk size  failure holds    holds             free KB             free KB
name                    in KB    group metadata data       in full blocks        in fragments
--------------- ------------- -------- -------- ----- ------------------- -------------------
gpfs13nsd           104857600       -1 yes      yes         9514496 ( 9%)         82304 ( 0%)
gpfs12nsd           104857600       -1 yes      yes         9519616 ( 9%)         79368 ( 0%)
gpfs14nsd           104857600       -1 yes      yes         9346304 ( 9%)         72480 ( 0%)
gpfs15nsd           104857600       -1 yes      yes         9345536 ( 9%)         71344 ( 0%)

‘PRNG is not seeded’ message at aix 6.1 from ssh

/home/coffee1> ssh coffee2
PRNG is not seeded

Apparently ssh needs access to /dev/random and /dev/urandom


# cd /dev
# ls -l | grep random
crw-------    1 root     system       35,  0 May 04 10:43 random
crw-------    1 root     system       35,  1 May 04 10:43 urandom
# chmod 644 random
# chmod 644 urandom
# ls -l | grep random
crw-r--r--    1 root     system       35,  0 May 04 10:43 random
crw-r--r--    1 root     system       35,  1 May 04 10:43 urandom

Clear Scsi reverse on Hitachi disks

dlmpr – utility for clearing Hitachi SAN HDLM persistent reservation
Description

The persistent reservation of a logical unit (LU) may not be canceled due to some reason when multiple hosts share a volume group rather than making up a cluster configuration using HACMP. In this case, this utility clears the Reservation Key to cancel the persistent reservation.

# /usr/DynamicLinkManager/bin/dlmpr {{-k | -c} [hdiskn] | -h}

where:

-k: specify this parameter to display the Reservation Key. The utility displays an asterisk (*) for a Reservation Key of another host. If the Reservation Key is not set, [0x0000000000000000] is displayed.

-Regist Key: the registered Keys are displayed.

-Key Count: the number of registered Keys is displayed.

-c: specify this parameter to clear the Reservation Key.

hdiskn: specify the physical volume (hdiskn) for which you want to display the Reservation Key. You can specify more than one volume. Note: If you do not specify this parameter, the utility displays the Reservation Keys for all the physical volumes.

-a: when multiple physical volumes (hdiskn) are specified, even if an error occurs during processing, the processing continues for all physical volumes.

-h: displays the format of the utility for clearing HDLM persistent reservation.

Note: [0x????????????????] appears for Reservation Key if the destination storage subsystem does not support the persistent reservation or if a hardware error occurs.

Example to execute the dlmpr utility to display the Reservation Keys for hdisk1, hdisk2, hdisk3, hdisk4, hdisk5, and hdisk6:

# /usr/DynamicLinkManager/bin/dlmpr -k hdisk1 hdisk2 hdisk3 hdisk4 hdisk5 hdisk6

self Reservation Key : [0xaaaaaaaaaaaaaaaa]
hdisk1 Reservation Key : [0xaaaaaaaaaaaaaaaa]
Regist Key : [0xaaaaaaaaaaaaaaaa], Key Count : 1
hdisk2 Reservation Key : [0xbbbbbbbbbbbbbbbb]*
Regist Key : [0xaaaaaaaaaaaaaaaa], Key Count : 2
Regist Key : [0xbbbbbbbbbbbbbbbb], Key Count : 2
hdisk3 Reservation Key : [0xbbbbbbbbbbbbbbbb]*
Regist Key : [0xbbbbbbbbbbbbbbbb], Key Count : 4
hdisk4 Reservation Key : [0xaaaaaaaaaaaaaaaa]
Regist Key : [0xaaaaaaaaaaaaaaaa], Key Count : 4
hdisk5 Reservation Key : [0x0000000000000000]
hdisk6 Reservation Key : [0x0000000000000000]
Regist Key : [0xaaaaaaaaaaaaaaaa], Key Count : 1
Regist Key : [0xbbbbbbbbbbbbbbbb], Key Count : 1

Example to execute the dlmpr utility to clear the Reservation Keys for other hosts (marked by an asterisk (*)):

# /usr/DynamicLinkManager/bin/dlmpr -c hdisk2 hdisk3

Example

dlmpr -k hdisk1; dlmpr -c hdisk2

Setting up Samba on AIX

1. Install rpm packages for samba from IBM freesoftware site:

samba-2.2.7-4.aix4.3.ppc.rpm
samba-common-2.2.7-4.aix4.3.ppc.rpm

2. Run smbpasswd as root to set initial uesr password same as real user password:

# smbpasswd -a USERNAME
3. As root, run swat

4. Connect to server through browser on port 901 and configure:

 

5. To connect from Windows:

net use n: \\hostname\samba-share /USER:username ( will prompt for password

net use n: \\hostname\samba-share /USER:name $PASSWORD /persistent:yes

6. To test the UNC (Universal Naming Convention) connection:

NET USE \\hostname\samba-share  extract /USER:extract

 

 

 Note: to disconnect from windows: net use n: /del

AIX compile, assemble, and link with gcc

If you just run gcc on some source code, it should simply create an executable for you. However, you can also break the process apart and see the compile and assemble commands.

gcc -S showsum.c
as -u -mcom -o showsum.o showsum.s
ld showsum.o /lib/crt0.o -lc -o showsum

This also leaves your showsum.o object code around, which might be all you really want of you are trying to compile a library. The most interesting part of this, however, is the showsum.s which is actually your program converted into assembler by gcc. You can look at it and even change little pieces of it if you know what you are doing:

more showsum.s
        .file   "showsum.c"
        .toc
        .csect .text[PR]
        .align 2
        .lglobl .strtoimax
        .csect strtoimax[DS]
strtoimax:
        .long .strtoimax, TOC[tc0], 0
        .csect .text[PR]
.strtoimax:
        .extern __mulh
        .extern __mull
        .extern __divss
        .extern __divus
        .extern __quoss
        .extern __quous
        mflr 0
        stw 31,-4(1)
        stw 0,8(1)
        stwu 1,-72(1)
        mr 31,1
        stw 3,96(31)
        stw 4,100(31)
        stw 5,104(31)
        lwz 3,96(31)
        lwz 4,100(31)
        lwz 5,104(31)

Of course this will also be very different on an x86 platform because the instruction set is different. It would interesting to compare what decisions gcc makes on either a Windows or Linux system. I have recently been reading about cross-compiling , and I think this gets into that territory.

Emacs Lisp

; Emacs Lisp

I have been playing around with the lisp integrated into emacs, rather than one that you bring up with slime and run alongside emacs.  Of course the first big difference is that so much is tied to how you call the function, pass it variables, and what it does.  Many if not all of the games are written in emacs lisp and you can go to help, read about them, and then pull up their lisp source.

sumacheck – downloads patches from IBM and send email

Suma (smitty suma) is a pretty cool automated patch downloader for AIX. I tweaked it a little bit to send me emails only when it finds something new. Just put this in cron and don’t worry about the cron setup through suma itself.

#################################################################
# Title      :  sumacheck - Goes to IBM and gets new patches
# Author     :  John Rigler
# Date       :  01-13-2009
# Requires   :  ksh
#################################################################

/usr/suma/bin/suma -x -a RqType=Latest -a Action=Download \
 -a Repeats=n  > /tmp/$$.sumafile

grep SUCCEED /tmp/$$.sumafile > /tmp/$$.sumasuccess

if [[ $? -eq 0 ]]
 then
   mail -s "New Packages from IBM" userid@company.com \
   < /tmp/$$.sumasuccess
 fi

rm /tmp/$$.sumafile /tmp/$$.sumasuccess

Script to tell me what hosts are down in a list

#! /usr/bin/ksh
#################################################################
# Title      :  pinghosts - Returns status of all hosts
# Author     :  John Rigler
# Date       :  01-09-2009
# Requires   :  ksh
#################################################################



grep -v "^#" $1 | while read HOSTNAME # Only read uncommented lines
  do
    # Execute the ping once and wait 2 seconds
    ping -c 1 -w 2 $HOSTNAME  2>&1 1>/dev/null
    if [[ ! $? -eq 0 ]]
    then
        echo "$HOSTNAME down"
    fi
  done