Our local AIX team wrote these scripts to make this task easier. Root not required. You should have your AIX admin evaluate these scripts before you install and run them on their systems.
The first script is a modified lspv that lists all physical disks and displays which VG they are assigned to or if they belong to Oracle ASM.
lspv2
Code: Select all
#!/bin/ksh
if [ $# -eq 0 ]
then
touch /tmp/ASM_lspv.out
/usr/sbin/lspv > /tmp/lspv.out
for i in `grep None /tmp/lspv.out | awk '{print $1}'`
do
ls -l /dev/r${i} | grep oracle > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "$i" >> /tmp/ASM_lspv.out
fi
done
cat /tmp/lspv.out | grep -vwf /tmp/ASM_lspv.out > /tmp/lspv1.out 2>/dev/
null
cat /tmp/lspv.out | grep -wf /tmp/ASM_lspv.out | sed 's/none
None/ASM Disk For Oracle ASM Disk act
ive/' > /tmp/lspv2.out 2>/dev/null
cat /tmp/lspv1.out /tmp/lspv2.out
rm -f /tmp/ASM_lspv.out
rm -f /tmp/lspv.out
rm -f /tmp/lspv1.out
rm -f /tmp/lspv2.out
else
/usr/sbin/lspv $*
fi
The second script depends on the first script, and builds a list of just 3par disks, LUN ID, and VG assignment.
ls3par
Code: Select all
echo "Disk\tLUN\tVG Name"
for i in `lsdev -Cc disk | grep -i 3par | awk '{print $1}'`
do
LUNID=`lsattr -El $i | grep -i lun | awk '{print $2}' | awk -F"x" '{print $2}' |
awk -F"000000000000$" '{print $1}'`
((mydec=16#$LUNID))
VGNM=`/opt/local/bin/lspv2 | grep -w $i | awk '{print $3}' | sed 's/Disk/ASM Dis
k/g'`
echo "$i\t$mydec\t$VGNM" >> /tmp/3par.$$
done
cat /tmp/3par.$$ | sort -n +1 2>/dev/null
rm -f /tmp/3par.$$
Example Output wrote:Disk LUN VG Name
hdisk23 0 backupsvg
hdisk24 1 backupsvg
hdisk25 2 backupsvg
hdisk26 3 backupsvg
hdisk27 4 backupsvg
hdisk28 5 backupsvg
hdisk29 6 ASM Disk
hdisk30 7 ASM Disk
hdisk31 8 ASM Disk
hdisk32 9 ASM Disk
hdisk33 10 ASM Disk
hdisk42 11 hrdvora1vg
hdisk43 12 hrdvora3vg
hdisk44 13 hrdvora2vg
hdisk45 14 hrdvp1vg