I was collecting a list of WWPNs for a bunch of new AIX LPARs I was installing from scratch. There were two ways I could find the WWPN for a virtual Fibre Channel adapter on a new LPAR i.e. one that did not yet have an operating system installed.

I started by checking the LPAR properties from the HMC (as shown below).

image

To speed things up I moved to the HMC command line tool, lssyscfg, to display the WWPNs (as shown below).

hscroot@hmc1:~> lssyscfg -r prof -m 750-2 -F virtual_fc_adapters --filter lpar_names=lpar1

"""32/client/2/vio2/30/c0507603a2410000,c0507603a2410001/0"",""33/client/2/vio2/31/c0507603a2410002,c0507603a2410003/0"",""30/client/1/vio1/30/c0507603a2410004,c0507603a2410005/0"",""31/client/1/vio1/31/c0507603a2410006,c0507603a2410007/0""" """30/client/1/vio1/30/c0507603a2410004,c0507603a2410005/0"",""31/client/1/vio1/31/c0507603a2410006,c0507603a2410007/0"""

This was good. I now had a list of WWPNs for each LPAR.

# cat lpar1_wwpns.txt

c0507603a292007c

c0507603a292007e

c0507603a2920078

c0507603a292007a

I gave these WWPNS to my SAN administrator so that he could manually zone in the LPARs on the SAN switches and allocate storage to each. He then, half-jokingly said, Gee, it would be nice if you could insert the colons into the WWPNS for me! J. Of course, this got me thinking and after a few minutes of playing with sed, I came up with a way to do this quickly.

# cat lpar1_wwpns.txt | sed 's/../&:/g;s/:$//'

c0:50:76:03:a2:92:00:7c

c0:50:76:03:a2:92:00:7e

c0:50:76:03:a2:92:00:78

c0:50:76:03:a2:92:00:7a

Now my list of WWPNs was ready to be cutnpaste by my SAN admin. He was happy.