Three Scripts

Edit: Some links no longer work.

Originally posted October 15, 2013 on AIXchange

I’ve seen a few good scripts lately. Brian Smith mentions a couple of them in his blog. This one will show you if your HBA/hdisk settings are actually in effect.

            “There are several storage related settings in AIX that cannot be changed if the device is active. These include “fast_fail,” dynamic tracking (dyntrk), and the “num_cmd_elems” for HBAs and the Queue Depth for hdisks.

            “Your options to set these are either make the device inactive (usually by taking redundant paths offline) and then make the change, or to use the “-P” flag on chdev and then reboot the server to make the change effective at the next boot.

            “The “-P” option on chdev has one major drawback however. As soon as you make the change with chdev “-P”, it appears that the setting is active right away even before the reboot. If you check with “lsattr”, it will appear as if the setting has taken effect. However it actually won’t take effect until the next reboot. What has essentially taken place is that the running configuration is out of sync with the ODM. The ODM reflects the updated settings, however they can’t be changed in the running configuration of the AIX kernel until the next reboot.”

Brian’s other script shows the location of every physical partition on each hdisk:

            “… The output shows which Logical Volume (LV) is on each of the PPs (or if it is free space). The output is color coded so each LV has its own color so that it is very easy to see where each LV physically is across the entire Volume Group. You can specify the number of columns of output depending on the size of your screen.

            “The intended use of the script is to show a visual representation of the Volume Group to make using commands which move around LPs/PPs such as migratelp easier to use, to make LVM/disk maintenance easier, and also as a learning tool.”

Finally, IBMer Dean Rowswell sent me the following script. He explains, “Lately I’ve been working with customers who are still using virtual SCSI, so I updated my old script with some new information. Maybe others will use this, too. It helped me to quickly and easily set the MPIO path priorities to balance I/O across the VIOS.”

It runs on an AIX LPAR. Here’s some sample output:

root@nim:/:# get_vdisk_path_priority
———————
Virtual SCSI adapters
———————
U9117.MMA.06XXXXX-V6-C41  Virtual I/O Slot  vscsi1
U9117.MMA.06XXXXX-V6-C42  Virtual I/O Slot  vscsi2

Attributes (vscsi_err_recov and vscsi_path_to) for VSCSI adapter: vscsi1 ->
fast_fail 30
Attributes (vscsi_err_recov and vscsi_path_to) for VSCSI adapter: vscsi2 ->
fast_fail 30

VDISK: hdisk0     ADAPTER: vscsi2  (MPIO priority: 2)   ADAPTER: vscsi1
(MPIO priority: 1)    VG: vgNIM1
VDISK: hdisk2   ADAPTER: vscsi1  (MPIO priority: 1)   ADAPTER: vscsi2
(MPIO priority: 2)     VG: rootvg
VDISK: hdisk3     ADAPTER: vscsi1  (MPIO priority: 1)   ADAPTER: vscsi2
(MPIO priority: 2)     VG: vgNIM2
VDISK: hdisk7     ADAPTER: vscsi2  (MPIO priority: 2)   ADAPTER: vscsi1
(MPIO priority: 1)     VG: None

Now for Dean’s script: 

#!/bin/ksh

# Created by Dean Rowswell, November 8, 2011

# Modified by Dean Rowswell, September 5, 2013

#       Combine all paths into a single line with the hdisk

# Modified by Dean Rowswell, October 2, 2013

#          Add the volume group info for each hdisk

#         Display the vscsi adapter attributes

# This script will display each virtual scsi disk path priority info

VDISKS=`lsdev -Cc disk -Sa -s vscsi -F name`

if [ ${#VDISKS} -eq 0 ]

then

        echo “There are no Virtual SCSI disks on this system”

        exit 0

else

            DATE=`date +’%Y%m%d_%H%M%S’`

        echo “———————“

        echo “Virtual SCSI adapters”

        echo “———————“

        lsslot -c slot|grep vscsi

            for VSCSI in `lsdev -Ccadapter -Sa -F name|grep vscsi`

            do

                           echo “\nAttributes (vscsi_err_recov and vscsi_path_to) for VSCSI adapter: ${VSCSI} -> \c”

                        lsattr -El ${VSCSI} -a vscsi_err_recov,vscsi_path_to -F value | tr ‘\n’ ‘ ‘

            done

            echo

            lspv >/tmp/lspv.${DATE}

            for VDISK in ${VDISKS}

        do

                echo “\nVDISK: ${VDISK}\t\c”

                LSPATHS=`lspath -F ‘parent:connection’ -l ${VDISK}`

                for LSPATH in ${LSPATHS}

               do

                        PARENT=`echo ${LSPATH} | awk -F: ‘{print $1}’`

                        CONN=`echo ${LSPATH} | awk -F: ‘{print $2}’`

                        echo ”  ADAPTER: ${PARENT}  (MPIO priority: `lspath -AE -l ${VDISK} -p ${PARENT} -w ${CONN}|awk ‘{print $2}’`) \c”

                done

                        VG=`grep -w ${VDISK} /tmp/lspv.${DATE} | awk ‘{print $3}’`

                        echo “\tVG: ${VG}\c”

        done

fi

rm /tmp/lspv.${DATE}

echo

More conversation from Twitter (@robmcnelly):

@ROOTvgNET

ROOTVG – AIX & POWER Portal – Stream AIX AUDIT into SYSLOG | Do more with AIX Audit and Syslog! http://www.rootvg.net/content/view/575/1/ … via @ROOTvgNET

‏@chromeaix #powersystems #AIX Using the NIM service handler with the NIM Alternate Disk Migration tool http://ow.ly/2ADpjg

@cgibbo Creating a System Copy WPAR. https://www.ibm.com/developerworks/community/blogs/cgaix/entry/lpar_to_wpar_migration?lang=en … #AIX #WPARS

@ibmvlp Download the Quick Reference mobile app for IBM Power Systems http://www-03.ibm.com/systems/power/resources/mobileapp/index.html …

@power_gaz >100 on “Tricks of the Power Masters” webinar http://tinyurl.com/PowerSystemsTechnicalWebinars … including @cgibbo and @chmod666 Thanks #ibmpowersystems #aix #power7

@UnixToolTip One advantage of visually dull environments like the command line or an editor is that there isn’t much to do there but work.

@mr_nmon 9 Oct Ten Things POWER & AIX Techies need to know from the IBM Announcements 8th Oct 2013 See my #AIXpert blog https://www.ibm.com/developerworks/community/blogs/aixpert/entry/ten_things_power_techies_need_to_know_from_the_ibm_announcements_8th_oct_2013 …

@cgibbo: @brian_smi new -T flag for mksysb command.” This does a JFS2 snapshot & backs that up for a time consistent fileset.

@cgibbo 7 Oct Simplified Shared Ethernet Adapter Failover config. Removes requirement for ctrl channel for SEA FO. #PowerVM #AIX http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=an&subtype=ca&appname=gpateam&supplier=760&letternum=ENUSJP13-0509 …

@cgibbo 7 Oct New lsattr P option to display attributes that may not yet be in effect on running system. AIX 7.1 TL3 & 6.1 TL9 #AIX http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=an&subtype=ca&appname=gpateam&supplier=760&letternum=ENUSJP13-0508 …

@zootman HMC v 7.8 – Tracking of DLPAR activity within the current profile enables reactivation of a LPAR with all changes intact. YAY!