mksysb Backups w/ NIM

NIM is great for backing up systems and pushing out packages, but there isn’t a included system for managing mksysb images.  I’ve got a little script that runs on the NIM server and either does a mksysb on all the clients registered or you can specify certain clients.  It also keeps X number of old mksysb images and purges the remaining ones.  It’s needs a little cosmetic work, but you can use it as a basis for your own system.

get_mksysb

Now, since you have NIM working, you really should run a mksysb backup to tape so you have bootable media to get your NIM server back up.  I have two of them, which happen to also be my TSM servers, that I also backup to eachother.  Since you can’t have your NIM master be a client on another NIM server, I have a little script that generates a mksysb on disk (plus any extra VGs) and uses scp to copy the images to the other server. It’s stupid simple, and could use come cosmetics, but it works:

#!/bin/ksh
# Usage: mksysb.ksh dest_hostname [ extra_vg ... ]

hostname=`hostname`
dest_host=$1

shift

scp_file() {
        /usr/bin/scp $1 $dest_host:/export/mksysb/$hostname/

}


/usr/bin/mksysb -e -i -X /shared/mksysb.$hostname

if [ $? -eq 0 ]
then
        scp_file /shared/mksysb.$hostname 
else
        echo "mksysb backup failed!"
        exit 1
fi

if [ $? -eq 0 ]
then
        rm /shared/mksysb.$hostname
fi

while [ "$1" != "" ]
do
        savevg -f /shared/$1.savevg $1
        if [ $? -eq 0 ]
        then
                scp_file /shared/$1.savevg
                rm /shared/$1.savevg
        else
                echo "savevg of $1 failed!"
                exit 1
        fi
        shift
done

If you need to restore this mksysb, you just have to register it as a NIM object, then register the client on the NIM master and do the restore as normal.

Mounting ISO Images On AIX

UPDATE – Chris Gibson pointed out that with AIX 6.1 you can use a loopback device like Linux.

I recently heard someone discuss how to handle ISO images on AIX. On Linux, you can mount the ISO image as a filesystem, which is pretty slick.

Starting in AIX 6.1, you can use the loopmount command to create a loopback device and mount an ISO directly:

loopmount -i cdrom.iso -o “-V cdrfs -o ro” -m /mnt

And, loopumount unmounts the ISO and removes the loopback device:

loopumount -i cdrom.iso -o "/mnt"

There are a couple of gotcha’s, but nothing unusual. An ISO can only be associated with one loopback device at a time, the mount is only readonly, and it’s not supported in WPARs.

But, AIX previous to 6.1 doesn’t support mounting ISO images directly. The recommendation was to mount the ISO as a virtual optical drive on the VIOS. But, I don’t use VIOS because it hasn’t gained uptake in our environment and with our vendors. You can always burn the image and mount the CD, but if your optical drive is tied up on another LPAR you may not be able to move the optical drive to the right LPAR.

There is another way to mount those images, but it’s not a one-step process. What you need to do is create a LV at least as big as your ISO image, then copy the ISO data to that LV, and then mount the LV:

mklv -y cdlv -s n rootvg 704M hdisk0
dd if=cdrom.iso of=/dev/cdlv
mount -v cdrfs -o ro /dev/cdlv /mnt
        

Switching VGs from concurrent mode without varyoff?

I recently got an Email asking:

In HACMP, is it possible to pass a vg varied on in enhanced mode to varied on in non-enhanced mode without any varyoff ?

As far as I know, it’s not. There are some operations that cannot be performed on a VG varied on in concurrent mode, usually anything modifying the VG structure.

If we need to do something that will modify the structure of the volume groups, we do it during a regularly scheduled downtime. This ensures that the applications aren’t writing to the VG, and we can safely make modifications. You don’t even necessarily have to bring down the HACMP resource groups. Simply unmount all the filesystems, or stop all the applications that may have any raw LVs open, varyoff the VG on all the nodes, then do a varyonvg on just one node. After you’ve made your changes it’s again simple to varyoff the VG, and run the appropritate commands to vary it back on in concurrent mode on the appropriate nodes. Just be sure that the VGs are in active or passive mode appropriately before you bring the applications back up.

IBM LMT Agent Fails To Install

I recently had an AIX system where the IBM License Management Tool failed to install. The failure message I got is:

CODAG076E Writing the agent signature file to the agent installation folder has failed. Check the agent installation folder and ensure that: 
-You have write access to the folder. 
-Files are unlocked. 
-There is sufficient space on the disk.

Followed by:

CODAG011E - The command cannot be executed.

Of course, installp takes care of everything by removing the evidence. So, the usual install logs get wiped, if they were ever created. I started by checking the likely suspects, /var and /tmp. Both had plenty of free space and both had good permissions. I double-checked my response file, it looked good and has worked on other systems.

So, I turned to filesystem free space. All of my filesytems have plenty of free space, as a percentage of size. And, there aren’t any filesystem full messages in the errpt. But, /opt and / both didn’t have much free space in terms of actual bytes. After adding just a little space to both of those, the install went through normally. And, on another system adding some free space to /var resolved the same error.

NPIV N-Port changes w/ AIX

I was at a meeting with other storage admin’s where they talked about never using NPIV with AIX servers because AIX can’t handle it if the N-Port changes due to a N-Port failover in AG mode. I’ve never seen that. In testing our AIX boxes handled the failover without any problems. Part of the reason may be because I’ve enabled Dynamic Tracking and Fast I/O Failover on these fibre adapters. Dynamic Tracking allows for N-Port ID changes, and Fast I/O Failover makes the failure of a Fibre adapter happen faster, which can be good if you are using a multi-path driver. It’s a simple change, but requires either a reboot or bringing down the adapter for the changes. Here’s the command to make the changes in the ODM, which will be applied the next time you reboot:

chdev  -l fscsi1 -a dyntrk='yes' -a fc_err_recov='fast_fail' '-P'

The other, and better, option is to build F-Port trunks to front your AG switch, which preserves the PID in case of a ISL failure, but that requires a trunking license on your switches.

Removing stuborn VGs

I had a junior admin delete LUNs from the SAN before removing the volume group associated with it. The volume group was still in the ODM, but the PVs were gone and not coming back. Exporting the VG didn’t work:

# exportvg datavg
0516-772 exportvg: Unable to export volume group datavg

The VG is in the ODM:

 # odmget -q name=datavg CuDv

CuDv:
        name = "datavg"
...

The way to remove it from the ODM is:

 # odmdelete -o CuDv -q name=datavg

AIX – Remove failed MPIO paths

Here is a quick and dirty script to remove failed MPIO paths. You can end up with failed paths if you make some SAN connection changes.

for disk in `lsdev -Cc disk | grep 2107 | awk '{ print $1 }'`
do
        for path in `lspath -l $disk -F "status connection" | grep Failed | awk '{ print $2 }'`
        do
                echo $disk
                rmpath -l $disk -w $path -d
        done
done

secldapclntd Failure w/ HACMP

After upgrading to AIX 5.3 TL9 SP4, we found that secldapclntd will go into a death loop during a HACMP failover. It consumes more and more CPU until the system doesn’t have any capacity left, and stops the HACMP failover. Killing secldapclntd will let HACMP continue.

We didn’t see this behavior w/ AIX 5.3 TL8 SP3. IBM has identified a couple of issues that are probably coming together to cause our problem, but they won’t be fixed in TL9… ever. IBM’s work-around is to setup a pre and post-event script to stop secldapclntd before the IP takeover (and release) and restart it afterward. In testing, this works pretty well, and it only takes a few seconds to stop and start secldapclntd.

Here’s the workaround by IBM:

  1. Create a script “/usr/local/cluster/start-ldap.sh” and copy it to every node in the cluster
  2. #!/usr/bin/ksh
    echo “STOP LDAP CLIENT Daemon”
    /usr/sbin/start-secldapclntd
    exit 0

  3. Create a script “/usr/local/cluster/stop-ldap.sh” and copy it to every node in the cluster
  4. #!/usr/bin/ksh
    echo “STOP LDAP CLIENT Daemon”
    /usr/sbin/stop-secldapclntd
    exit 0

  5. Create a pre-event
  6. smitty hacmp
    Extended Configuration
    Extended Event Configuration
    Configure Pre/Post-Event Commands
    Add a Custom Cluster Event

    Type or select values in entry fields.
    Press Enter AFTER making all desired changes.
    [Entry Fields]

    * Cluster Event Name [] << I use the name "ldapClientStart" * Cluster Event Description [] << Start ldap client daemon * Cluster Event Script Filename [] << /usr/local/cluster/start-ldap.sh

  7. Create a post-event
  8. smitty hacmp
    Extended Configuration
    Extended Event Configuration
    Configure Pre/Post-Event Commands
    Add a Custom Cluster Event

    Type or select values in entry fields.
    Press Enter AFTER making all desired changes.
    [Entry Fields]

    * Cluster Event Name [] << I use the name "ldapClientStop" * Cluster Event Description [] << Stop ldap client daemon * Cluster Event Script Filename [] << /usr/local/cluster/stop-ldap.sh

  9. Update the acquire_service_addr event
  10. smitty hacmp
    Extended Configuration
    Extended Event Configuration
    Change/Show Pre-Defined HACMP Events
    (select –> acquire_service_addr )
    Change/Show Cluster Events

    Type or select values in entry fields.
    Press Enter AFTER making all desired changes.
    [Entry Fields]

    Event Name acquire_service_addr
    Pre-event Command [ldapClientStop] <<< the defined name "ldapClientStop" Post-event Command [ldapClientStart] <<< the defined name "ldapClientStart"

  11. Update the release_service_addr event
  12. smitty hacmp
    Extended Configuration
    Extended Event Configuration
    Change/Show Pre-Defined HACMP Events
    (select –> release_service_addr )
    Change/Show Cluster Events

    Type or select values in entry fields.
    Press Enter AFTER making all desired changes.
    [Entry Fields]

    Event Name release_service_addr
    Pre-event Command [ldapClientStop] <<< the defined name "ldapClientStop" Post-event Command [ldapClientStart] <<< the defined name "ldapClientStart"

  13. Synchronize the cluster configuration, and you’re done

Load balance algorithm w/ AIX and XIV

IBM only supports a queue depth of 1 when attaching to XIV with the default algorithm of round_robin. Usually round_robin or load_balance is the best choice, but since IBM is only supporting a queue depth of 1 at this time, there is a performance penalty for asynchronous I/Os. This looks to have been fixed in 5.3.10 (APAR IZ42730) and 6.1 (APAR IZ43146), but is still broken (probably never to be fixed) in earlier releases.

So, IBM recommendation is to split up your storage needs into a number of LUNs matching the number of paths to your XIV, use the fail_over algorithm with a larger queue depth, and assign a different path the highest priority for each LUN. This is kind of a poor man’s load balancing. It’s not that bad, other than having to look at 4 or more hdisks for every LUN, and having to figure out what path to give the highest priority for each one!

IBM doesn’t really see this as a problem, but it’s a huge pain to do correctly in an enterprise.

So, how do we start? First, figure out what hdisk you’re talking about, then run:

lspath -H -l hdiskx -F "status name parent path_id connection"
status  name   parent path_id connection

Enabled hdiskx fscsi0 0       50050763061302fb,4010401200000000
Enabled hdiskx fscsi0 1       50050763060302fb,4010401200000000
Enabled hdiskx fscsi1 2       50050763060802fb,4010401200000000
Enabled hdiskx fscsi1 3       50050763061802fb,4010401200000000

We need the parent device and the connection bit (WWN,LUN#) to specify just a single path. Then run:

lspath -AHE -l hdiskx -p fscsi0 -w "50050763061302fb,4010401200000000"
attribute value              description  user_settable

scsi_id   0x20400            SCSI ID      False
node_name 0x5005076306ffc2fb FC Node Name False
priority  1                  Priority     True

That shows you the priority of this path. You can see it’s still the default of 1. You can check the other paths too.

The goal is to spread out the load between all the available paths. To do this, we must create 4 LUNs. If we need 4GB, we need 4 1GB LUNs. Then we can give each one a different primary path. So, in this example, we should run:

chpath -l hdiskx -p fscsi0 -w 50050763061302fb,4010401200000000 -a priority=1
chpath -l hdiskx -p fscsi0 -w 50050763060302fb,4010401200000000 -a priority=2
chpath -l hdiskx -p fscsi1 -w 50050763060802fb,4010401200000000 -a priority=3
chpath -l hdiskx -p fscsi1 -w 50050763061802fb,4010401200000000 -a priority=4

The first command isn’t really necessary, but I was on a roll. Now, we have to change the algorithm for the hdisk and set the queue depth:

chdev -l  hdiskx -a algorithm=fail_over -a queue_depth=32

Make sure to stager the next one so that path 1 gets a priority of 1, 2 gets 2… and 0 gets a priority of 4. Rinse and repeat until you have 4 LUNs each with a different primary path.

Now wasn’t that easy. Oh, and when you add more disks, be sure to keep them distributed as evenly as possible.