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).
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
This was good. I now had a list of WWPNs for each LPAR.
# cat lpar1_wwpns.txt
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/:$//'
Now my list of WWPNs was ready to be cut’n’paste by my SAN admin. He was happy.