Solaris MPxIO and EMC VMAX – device information

This post is for everyone who uses Solaris together with EMC storage.
EMC offers an inquiry tool for different OS platforms which helps the OS admin to receive details of the attached luns, the system itself like HBAs and so on.

One night at work we needed to migrate hundreds and hundreds of LUNs and I was so annoyed by working with different windows and tmux panes that is started to type some commands into my shell. Just quick and dirty as I didn’t care and only wanted to get some sort of mapping of our MPxIO and the Symmetrix devices done asap.

Well this is what ended up to help me through the night. This was back in 2014 and used the inquiry tool version 7.6.2.0 I believe.

print "";banner $(uname -n);for ldom in $(ldm ls|egrep -v "NAME"|nawk '{print $1}');do if [ $ldom == "primary" ]; then printf "\n### $ldom ###\n#\n";printf " %14s %60s\n%-52s%-s\n" "$(/usr/sbin/zpool list|grep NAME)" "dev info" "|------------------------------------------------------|" "|-----------------------------------------------------------------------------------------------------------|"; for pools in $(/usr/sbin/zpool list -H -o name);do printf " ";/usr/sbin/zpool list $pools|grep -v NAME|tr -d '\n';printf "%8s" " ";for dev in $(/usr/sbin/zpool status $pools|grep c0t|awk '{print $1}');do printf "%-26s" $dev;done;printf "\n\n";done;else printf "\n### $ldom ###\n#\n";printf "%14s %60s\n%-52s%-s\n" "LDM" "V-MAX" "|---------------------------------------------|" "|-----------------------------------------------------------------------------------------------------------|";sum=0;for j in $(for i in $(ldm ls -o disk $ldom|grep -v VOLUME|nawk '{print $2}'|sed s/@primary-vds0//g);do ldm ls -o disk primary |grep -w $i|nawk -F"/" '{print $4}'|sed s/d0.*//g;done);do vdisk=$(ldm ls -o disk primary|grep $j|sed s/primary-vds0//g|nawk '{printf $1}');printf " %-16s" $vdisk;ldm ls -o disk $ldom|grep -w $vdisk|nawk '{printf "%-9s", $4}';Zpool=$(/usr/sbin/zdb -l /dev/dsk/$(ldm ls -o disk primary|grep $j|awk -F"/" '{print $4}'|sed s/d0.*/d0s0/g)|grep -w "name: "|awk -F"'" '{print  $2}'|uniq);if [ $Zpool ];then printf "%-26s" $Zpool;else printf "%-26s" "N/A";fi ;/scripts/admin/inq.sol64 -nodots -dev "/dev/rdsk/$(print $j)d0s0"|grep "c0t6"|sed 's/\/dev\/rdsk\///g'|sed 's/ *//g'|awk -F":" '{printf "%40s%12s%11s", $1, $3, $6}';/scripts/admin/inq.sol64 -nodots -identifier device_name -dev "/dev/rdsk/$(print $j)d0s0"|grep "c0t6"|sed 's/ *//g'|nawk -F":" '{printf "%7s   %-s\n", $2, $4}';sum=$((sum+$(/scripts/admin/inq.sol64 -nodots -dev "/dev/rdsk/$(print $j)d0s0"|grep "c0t6"|nawk -F":" '{print $6}')));done;print "\n\trelative Domain LUN size (sum)\t\t->\t$sum kb\t->\t$((($sum/1024/1024))) gb";print "\n\teffective Domain LUN size (sum/2)\t->\t$((($sum/2))) kb\t->\t$((($sum/1024/1024/2))) gb";fi;done;printf "\n### vdsdev without domain ###\n#\n";for disk in $(ldm ls -o disk primary|grep dsk|sed 's/primary-vds0//g'|awk '{print $1}');do ldm ls -o disk |grep v$disk>/dev/null||printf " $disk  <<  not added to a domain\n";done;printf "\n### unused mpxio luns ###\n#\n";for l in $(/usr/sbin/fcinfo lu|grep "c0.*d0s[0-9]"|nawk -F"/" '{print $4}'|sed 's/d0s[0-9]/d0/g');do ldm ls -o disk primary|grep $l > /dev/null||/scripts/admin/inq.sol64 -nodots -identifier device_name -dev "/dev/rdsk/$(print $l)s2"|grep "c0t6"|sed 's/\/dev\/rdsk\///g'|awk -F":" '{printf "%39s%11s%-s\n", $1, $2, $4}';done

Maybe someone is in need of something like it.
One day, probably a day that I am quiet bored, I will add some more to it and format it even, or even better rewrite it in Perl maybe.
Actually my biggest hope is that the Solaris engineers will come up with something close to it before I get bored. ;)