#!/bin/bash ########################################################### # Purpose: Mapping LUN Number to VxVM Disk in Linux # Author: 2DayGeek # Version: v1.0 ###########################################################
echo "DG_Name Block_Device LUN_Number" echo "-------------------------------------------------------------------" for dg_name in `vxdg list | awk '{print $1}' | grep -v NAME` do for d_name in `vxdisk -e list | grep -i $dg_name | awk '{print $1}' do for b_device in `vxdisk list $d_name | grep -w state=enabled | awk '{print $1}' | head -1` do echo "$dg_name --> $b_device --> $(lsscsi --scsi | grep $b_device | awk '{print $NF}'" done done done | column -t
设置 Shell 脚本文件的可执行权限。
1 2
chmod +x VxVM_disk_mapping_with_LUN_number.sh
最后执行脚本查看结果。
1 2
sh VxVM_disk_mapping_with_LUN_number.sh
你的输出将类似于此。但是,DG 名称、块设备和 LUN 会与此不同。
如果你想即时运行上述脚本,请使用下面的单行脚本。
1 2
# for dg_name in `vxdg list | awk '{print $1}' | grep -v NAME`; dofor d_name in `vxdisk -e list | grep -i $dg_name | awk '{print $1}'; dofor b_device in `vxdisk list $d_name | grep -w state=enabled | awk '{print $1}' | head -1`; do echo "$dg_name --> $b_device --> $(lsscsi --scsi | grep $b_device | awk '{print $NF}'"; done; done; done | column -t