A place for Unix Thoughts and Ideas

Mapping OS Devices to Veritas Device names in Veritas 5.1

With Veritas 5.1, if you are using native DMP, enclosure based naming is mandatory.

Now this is good as 5.1 has enhancements where the device name now includes the LDEV number for the array and it makes it easy for storage grows.

But this can kind of be a PITA if you are building fresh or you don’t have the LDEV number and are just trying to find the veritas device name for a set of luns.

This is a expansion of a 1 liner I posted awhile back, it has been expanded to include the Veritas Device name in the output.

Here it is and you can copy/paste it into a bash session. You can change the order and padding by modifying the awk statement

for c in $(iostat -En | grep Soft | awk '{print $1}' | cut -d t -f1 | sort | uniq); do 
for i in `iostat -En | grep Soft | awk '{print $1}' | grep "$c"`;do 
vxdisk list $i &>/dev/null || continue
DEV=`vxdisk list $i | grep Device | awk '{print $2}'`
SZ=$(iostat -En $i | grep Size | cut -d'<' -f2)
echo "$i ${SZ%% *} $DEV" | awk '{printf ( "%s\t%s %4d GB (%d MB)\n", $1, $3, $2/1024/1024/1024+.05, $2/1024/1024+.05) }'
done | sort -t d +1 -n; done

This is the output of vxdisk list

root@testserver# vxdisk -e list
DEVICE       TYPE           DISK        GROUP        STATUS               OS_NATIVE_NAME   ATTR
tagmastore-usp0_073a auto           -            -           error                c3t50060E800547724Dd7 hdprclm fc
tagmastore-usp0_073b auto:cdsdisk   tstdg05      tstdg       online thinrclm shared c3t50060E800547724Dd8s2 hdprclm fc
tagmastore-usp0_0733 auto:cdsdisk   oraappsdg01  oraappsdg   online thinrclm      c3t50060E800547724Dd4s2 hdprclm fc
tagmastore-usp0_0734 auto:cdsdisk   -            -           online thinrclm      c3t50060E800547724Dd0s2 hdprclm fc
tagmastore-usp0_0735 auto:cdsdisk   -            -           online thinrclm      c3t50060E800547724Dd1s2 hdprclm fc
tagmastore-usp0_0736 auto:cdsdisk   -            -           online thinrclm      c3t50060E800547724Dd2s2 hdprclm fc
tagmastore-usp0_0737 auto:cdsdisk   oracrsdg01   oracrsdg    online thinrclm shared c3t50060E800547724Dd3s2 hdprclm fc
tagmastore-usp0_0738 auto:cdsdisk   tstdg02      tstdg       online thinrclm shared c3t50060E800547724Dd5s2 hdprclm fc
tagmastore-usp0_0739 auto:cdsdisk   tstdg03      tstdg       online thinrclm shared c3t50060E800547724Dd6s2 hdprclm fc
tagmastore-usp0_1904 auto:cdsdisk   tstdg06      tstdg       online thinrclm shared c3t50060E800547724Dd9s2 hdprclm fc
tagmastore-usp0_1905 auto:cdsdisk   tstdg01      tstdg       online thinrclm shared c3t50060E800547724Dd10s2 hdprclm fc
tagmastore-usp0_4026 auto:cdsdisk   oraexpdg01   oraexpdg    online thinrclm shared c3t50060E800547724Dd11s2 hdprclm fc

Now the output of my script on the same server using DMP multipathing

c2t50060E800547725Dd0   tagmastore-usp0_0734    0 GB (90 MB)
c2t50060E800547725Dd1   tagmastore-usp0_0735    0 GB (90 MB)
c2t50060E800547725Dd2   tagmastore-usp0_0736    0 GB (90 MB)
c2t50060E800547725Dd3   tagmastore-usp0_0737    0 GB (500 MB)
c2t50060E800547725Dd4   tagmastore-usp0_0733   50 GB (51200 MB)
c2t50060E800547725Dd5   tagmastore-usp0_0738   10 GB (10240 MB)
c2t50060E800547725Dd6   tagmastore-usp0_0739   10 GB (10240 MB)
c2t50060E800547725Dd7   tagmastore-usp0_073a   50 GB (51200 MB)
c2t50060E800547725Dd8   tagmastore-usp0_073b  500 GB (512000 MB)
c2t50060E800547725Dd9   tagmastore-usp0_1904   10 GB (10240 MB)
c2t50060E800547725Dd10  tagmastore-usp0_1905   10 GB (10240 MB)
c2t50060E800547725Dd11  tagmastore-usp0_4026 1023 GB (1048000 MB)
c3t50060E800547724Dd0   tagmastore-usp0_0734    0 GB (90 MB)
c3t50060E800547724Dd1   tagmastore-usp0_0735    0 GB (90 MB)
c3t50060E800547724Dd2   tagmastore-usp0_0736    0 GB (90 MB)
c3t50060E800547724Dd3   tagmastore-usp0_0737    0 GB (500 MB)
c3t50060E800547724Dd4   tagmastore-usp0_0733   50 GB (51200 MB)
c3t50060E800547724Dd5   tagmastore-usp0_0738   10 GB (10240 MB)
c3t50060E800547724Dd6   tagmastore-usp0_0739   10 GB (10240 MB)
c3t50060E800547724Dd7   tagmastore-usp0_073a   50 GB (51200 MB)
c3t50060E800547724Dd8   tagmastore-usp0_073b  500 GB (512000 MB)
c3t50060E800547724Dd9   tagmastore-usp0_1904   10 GB (10240 MB)
c3t50060E800547724Dd10  tagmastore-usp0_1905   10 GB (10240 MB)
c3t50060E800547724Dd11  tagmastore-usp0_4026 1023 GB (1048000 MB)

and the Output of the same server with MPXIO multipathing

c4t60060E80054772000000477200000733d0   tagmastore-usp0_0733   50 GB (51200 MB)
c4t60060E80054772000000477200000734d0   tagmastore-usp0_0734    0 GB (90 MB)
c4t60060E80054772000000477200000735d0   tagmastore-usp0_0735    0 GB (90 MB)
c4t60060E80054772000000477200000736d0   tagmastore-usp0_0736    0 GB (90 MB)
c4t60060E80054772000000477200000737d0   tagmastore-usp0_0737    0 GB (500 MB)
c4t60060E80054772000000477200000738d0   tagmastore-usp0_0738   10 GB (10240 MB)
c4t60060E80054772000000477200000739d0   tagmastore-usp0_0739   10 GB (10240 MB)
c4t60060E8005477200000047720000073Ad0   tagmastore-usp0_073a   50 GB (51200 MB)
c4t60060E8005477200000047720000073Bd0   tagmastore-usp0_073b  500 GB (512000 MB)
c4t60060E80054772000000477200001904d0   tagmastore-usp0_1904   10 GB (10240 MB)
c4t60060E80054772000000477200001905d0   tagmastore-usp0_1905   10 GB (10240 MB)
c4t60060E80054772000000477200004026d0   tagmastore-usp0_4026 1023 GB (1048000 MB)

Now here is the script with only 2 columns. Since format works on the Unix Devices and vxdisksetup on the Veritas Device name. This script is useful for building a input file for a multivariable read while loop to label and then initialize the disk.

for c in $(iostat -En | grep Soft | awk '{print $1}' | cut -d t -f1 | sort | uniq); do
for i in `iostat -En | grep Soft | awk '{print $1}' | grep "$c"`;do
vxdisk list $i &>/dev/null ||  break
DEV=`vxdisk list $i | grep 'Device:' | awk '{print $2}'`
printf "%s\t%s\n" $i $DEV; done  | sort -t d +1 -n; done


c2t50060E800547725Dd0   tagmastore-usp0_0734
c2t50060E800547725Dd1   tagmastore-usp0_0735
c2t50060E800547725Dd2   tagmastore-usp0_0736
c2t50060E800547725Dd3   tagmastore-usp0_0737
c2t50060E800547725Dd4   tagmastore-usp0_0733
c2t50060E800547725Dd5   tagmastore-usp0_0738
c2t50060E800547725Dd6   tagmastore-usp0_0739
c2t50060E800547725Dd7   tagmastore-usp0_073a
c2t50060E800547725Dd8   tagmastore-usp0_073b
c2t50060E800547725Dd9   tagmastore-usp0_1904
c2t50060E800547725Dd10  tagmastore-usp0_1905
c2t50060E800547725Dd11  tagmastore-usp0_4026
c3t50060E800547724Dd0   tagmastore-usp0_0734
c3t50060E800547724Dd1   tagmastore-usp0_0735
c3t50060E800547724Dd2   tagmastore-usp0_0736
c3t50060E800547724Dd3   tagmastore-usp0_0737
c3t50060E800547724Dd4   tagmastore-usp0_0733
c3t50060E800547724Dd5   tagmastore-usp0_0738
c3t50060E800547724Dd6   tagmastore-usp0_0739
c3t50060E800547724Dd7   tagmastore-usp0_073a
c3t50060E800547724Dd8   tagmastore-usp0_073b
c3t50060E800547724Dd9   tagmastore-usp0_1904
c3t50060E800547724Dd10  tagmastore-usp0_1905
c3t50060E800547724Dd11  tagmastore-usp0_4026

Sample use

for c in $(iostat -En | grep Soft | awk '{print $1}' | cut -d t -f1 | sort | uniq); do
for i in `iostat -En | grep Soft | awk '{print $1}' | grep "$c"`;do
vxdisk list $i &>/dev/null ||  break
DEV=`vxdisk list $i | grep 'Device:' | awk '{print $2}'`
printf "%s\t%s\n" $i $DEV; done  | sort -t d +1 -n; done > /tmp/storage_map.txt

printf "label 0 y n n" > /tmp/cmd
egrep 'c2.*d[6-10]' /tmp/storage_map.txt| while read dev ver; do  format -e -f /tmp/cmd -d $dev; vxdisk scandisks; /etc/vx/bin/vxdisksetup -i $ver;done

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: