IBM Support

Shared Storage Pools - advanced lu -list the search continues

How To


Summary

Shared Storage Pools "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

Shared Storage Pools phase 5 release has the lu -list command that outputs the Logical Unit (virtual disks) in Tier then Alphabetical order - hurray!

But it still has challenges and one command output can't please everyone!   The trouble is everyone has their own ideas of “perfect layout” It is a "no win" problem for the developers. Here are three of my pet hates.

Fortunately, the SSP designers are clever. The lu command has a raw output 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 program works on all VIOS versions (Tier then LU name order) and you get:

   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 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 taking the most storage?
  4. Order on tiers then name when I want too.

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 and VIOS 3.1 with Tiers.

  $ 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  
$ 
  $ 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    
9936   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

Additional Information


Other places to find Nigel Griffiths IBM (retired)

Document Location

Worldwide

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

Document Information

Modified date:
20 December 2023

UID

ibm11116207