IBM Support

Shared Storage Pools - advanced lu -list the search continues

How To


Summary

The basic "lu -list" command for listing SSP is not good IMHO but it can be reformatted any way you like

Objective

Nigels Banner

Environment

Shared Storage Pools (SSP) are a feature of the VIOS and presented to the Virtual Machines as vSCSI disks.

Steps

With Shared Storage Pools phase 5 coming soon,  we have the lu -list command that output the Logical Unit (virtual disks) in Tier then Alphabetical order - hurray!

But it still has challenges and one command output can't please every one!   Trouble is everyone has there own ideas of  “perfect layout”

It is a "no win" problem for the developers.   Here are three of my pet hates

pet hates diagram

Fortunately, the SSP designers are very clever.   The lu options allow you a raw format. As an example:

  $  lu -list -field LU_SIZE LU_NAME -fmt :  32768:testa  40960:testb  38912:vm97boot  8256:vm97data  8192:testc  8192:v23456789012345678901234567890  38912:vm96boot  8256:vm96data
    

OK, not pretty but nothing awk can’t sort out.

As we no longer need a sort the LUs by name we can reduce the ksh script to just one line (4 for readability):

  echo "SizeMB UsedMB Used%  Type    Tier Name"  /usr/ios/cli/ioscli lu -list -fmt :  \  -field LU_SIZE LU_USED_SPACE LU_USED_PERCENT LU_PROVISION_TYPE TIER_NAME LU_NAME \  | awk -F: '{ printf "%6d %6d %4d%% %5s %7s %s\n",$1,$2,$3,$4,$5,$6}'
    

This works on BOTH VIOS 2.2.3 (random order) and the future VIOS 2.2.4 (Tier then LU name order) and you get:

VIOS 2.2.3.x

    SizeMB  UsedMB Used%  Type    Tier Name   1048576  971779   92%  THIN  SYSTEM purple3files     65536   65536  100% THICK  SYSTEM orange5a     32768   19956   60%  THIN  SYSTEM vm34     32768   32768  100%  THIN  SYSTEM vm61b      32768    3392   10%  THIN  SYSTEM AIX735_b     32768   27016   82%  THIN  SYSTEM vm16boot     65536   26563   40%  THIN  SYSTEM ruby32data1     65536       0    0%  THIN  SYSTEM emerald3     25600       0    0%  THIN  SYSTEM volume-orange5_data1

VIOS 2.2.4

   SizeMB  UsedMB Used%  Type    Tier Name    32768       0    0%  THIN    test testa    40960       0    0%  THIN    test testb    38912    2562    6%  THIN    test vm97boot     8256      23    0%  THIN    test vm97data    39936   39936  100% THICK    prod testc     8192       0    0%  THIN    prod v23456789012345678901234567890    40960    2562    6%  THIN    prod vm96boot     8256      26    0%  THIN    prod vm96data

Note: I have two Tiers here and they are ordered first.

 

A good start for two lines of ksh script but not good enough for me.

I actually need to sort the output differently for different views of the data like:

  1. All LUs in alphabetical order so I can simply find the one I want in one go.
  2. Which LU has the larger size?
  3. Which LU is  actually taking the most storage?
  4. Order on tiers then name when I want too.

etc.   So here is my NEW and Improved nlu ksh script where we can order the output with options and it works on VIOS 2.2.3 and VIOS 2.2.4 with Tiers (when or if they arrive :-).

  $ nlu -?  /home/padmin/nlu Nigel's lu command with improved layout and column ordering  /home/padmin/nlu [-sizemb | -usedmb | -used | -type | -tier | -name (default)]  $
    

Example default output by LU Name - my favourite default

  $ nlu   SizeMB  UsedMB Used%  Type  Tier Name    32768       0    0%  THIN  test testa    40960       0    0%  THIN  test testb    39936   39936  100% THICK  prod testc     8192       0    0%  THIN  prod v23456789012345678901234567890    40960    2562    6%  THIN  prod vm96boot     8256      26    0%  THIN  prod vm96data    38912    2562    6%  THIN  test vm97boot     8256      23    0%  THIN  test vm97data  $ 
    

Example output reordered by column

  $ nlu -sizemb   SizeMB  UsedMB Used%  Type  Tier Name     8192       0    0%  THIN  prod v23456789012345678901234567890     8256      23    0%  THIN  test vm97data     8256      26    0%  THIN  prod vm96data    32768       0    0%  THIN  test testa    38912    2562    6%  THIN  test vm97boot    39936   39936  100% THICK  prod testc    40960       0    0%  THIN  test testb    40960    2562    6%  THIN  prod vm96boot  $ nlu -usedmb   SizeMB  UsedMB Used%  Type  Tier Name     8192       0    0%  THIN  prod v23456789012345678901234567890    32768       0    0%  THIN  test testa    40960       0    0%  THIN  test testb     8256      23    0%  THIN  test vm97data     8256      26    0%  THIN  prod vm96data    38912    2562    6%  THIN  test vm97boot    40960    2562    6%  THIN  prod vm96boot    39936   39936  100% THICK  prod testc  $ nlu -tier   SizeMB  UsedMB Used%  Type  Tier Name    39936   39936  100% THICK  prod testc     8192       0    0%  THIN  prod v23456789012345678901234567890    40960    2562    6%  THIN  prod vm96boot     8256      26    0%  THIN  prod vm96data    32768       0    0%  THIN  test testa    40960       0    0%  THIN  test testb    38912    2562    6%  THIN  test vm97boot     8256      23    0%  THIN  test vm97data
    

Here is the actual ksh script for nlu that is Nigel's New lu command

Runnable as padmin, root or any padmin like user (restricted shell with oem_setup_env command).

  if [[ $(whoami) != "root" ]]  then          command=$(whence $0)          # echo DEBUG I am padmin so restart $command again as the root user          echo "$command" $1 | oem_setup_env  else          # echo DEBUG now I am root          # lowercase the parameter with tr to avoid input case errors          case `echo $1 | tr "[A-Z]" "[a-z]" ` in          1 | -sizemb)            COLUMN="-nk 1" ;;          2 | -usedmb)            COLUMN="-nk 2" ;;          3 | -used | -used%)     COLUMN="-nk 3" ;;          4 | -type)              COLUMN="-k 4" ;;          5 | -tier)              COLUMN="-k 5" ;;          6 | -name)              COLUMN="-k 6" ;;          ? | -?)          echo $0 "Nigel's lu command with improved layout and column ordering"          echo $0 "[-sizemb | -usedmb | -used | -type | -tier | -name (default)]"          exit 0                  ;;          *)                      COLUMN="-k 6" ;;          esac            echo " SizeMB  UsedMB Used%  Type  Tier Name"            /usr/ios/cli/ioscli \          lu -list -field LU_SIZE LU_USED_SPACE LU_USED_PERCENT \                  LU_PROVISION_TYPE TIER_NAME LU_NAME -fmt : \          | awk -F: '{ printf "%7d %7d %4d%% %5s %5s %s\n", $1,$2,$3,$4,$5,$6}' \          | sort $COLUMN  fi  exit 0
    

 


The End
 

    ">

    Additional Information


    If you find errors or have question, email me: 

    • Subject: Advanced lu
    • E-mail: n a g @ u k . i b m . c o m  

    Also find me on

    Document Location

    Worldwide

    [{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"Component":"","Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"HW1W1","label":"Power ->PowerLinux"},"Component":"","Platform":[{"code":"PF016","label":"Linux"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Component":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

    Document Information

    Modified date:
    08 May 2020

    UID

    ibm11116207