Method 1 : scsimgr

# ioscan -m dsf
Persistent DSF           Legacy DSF(s)
========================================
/dev/pt/pt2              /dev/rscsi/c4t10d0
/dev/pt/pt3              /dev/rscsi/c6t9d0
/dev/pt/pt5              /dev/rscsi/c8t0d0
/dev/rdisk/disk10        /dev/rdsk/c5t0d0
                         /dev/rdsk/c7t0d0

# scsimgr get_attr -D /dev/rdisk/disk10 -a serial_number

        SCSI ATTRIBUTES FOR LUN : /dev/rdisk/disk10

name = serial_number
current = "1111150H0000"  <---- lun id is "0F0"
default = 
saved = 

Method 2 : inq for EMC devices

Lun id is :SER NUM

# inq -nodots
Inquiry utility, Version V7.3-1305 (Rev 1.0)      (SIL Version V7.3.1.0 (Edit Level 1305)
Copyright (C) by EMC Corporation, all rights reserved.
For help type inq -h.



-------------------------------------------------------------------------------
DEVICE               :VEND    :PROD            :REV   :SER NUM    :CAP(kb)     
-------------------------------------------------------------------------------
/dev/rdsk/c5t0d0     :EMC     :SYMMETRIX       :5875  :55500h0000 :        2880
/dev/rdsk/c7t0d0     :EMC     :SYMMETRIX       :5875  :55500h0000 :        2880

Script for HPUX 11.31 only : Use at your own risk !

#!/usr/bin/sh

export PATH=$PATH:/sbin:/bin:/usr/bin:/usr/local/bin:/usr/sbin:/usr/local/bin

for disk in `ioscan -m dsf | grep rdisk | grep -v _p | awk '{print $1}'`
do

CDISK=`echo $disk | sed -e 's/rdisk/disk/g'`
VENDOR=`diskinfo $disk | grep vendor | awk -F: '{print $2}'`
SIZEKB=`diskinfo $disk | grep size | awk '{print $2}'`
LUNID=`scsimgr get_attr -D $disk -a wwid | grep current | awk -F= '{print $2}' | sed -e 's/\(^....*\)\(....$\)/\2/'`
SIZEGB=$(($SIZEKB/1024/1024))

echo "${disk}:${VENDOR}: ${LUNID} : ${SIZEGB}GB"

done