On ASMLib, If need to querydisk.
Used oracleasm script to query disk LABEL from disk device:
# /etc/init.d/oracleasm querydisk /dev/sdc5
Disk "/dev/sdc5" is marked an ASM disk with the label "VOL1"
But If used disk Label to query, that get major,minor numbers.
# /etc/init.d/oracleasm querydisk VOL1
Disk "VOL1" is a valid ASM disk on device [8, 37]
On asmlib-support since 2.1.0
# /etc/init.d/oracleasm querydisk -d VOL1
Disk "VOL1" is a valid ASM disk on device [8, 37]
After that, used major,minor numbers to find disk device.
# ls -l /dev/* | grep 8, | grep 37
brw-rw---- 1 root disk 8, 37 Jul 31 17:48 /dev/sdc5
If written sample shell code:
#!/bin/sh
# Script: getasmlib
if [ $# -ne 1 ]
then
echo "Please Check arguments."
echo
echo "./getasmlib [label]"
echo
echo " ./getasmlib VOL01"
exit 0
fi
LABEL=$1
C=`/etc/init.d/oracleasm querydisk -d ${LABEL} |grep 'a valid ASM disk' |wc -l`
if [ ${C} -eq 0 ]
then
echo "Don't Found ${LABEL} Disk in ASMLIB"
exit 0
fi
M=`/etc/init.d/oracleasm querydisk -d ${LABEL} | grep 'a valid ASM disk' |awk -F\[ '{print $2 }' | awk '{print $1}'`
N=`/etc/init.d/oracleasm querydisk -d ${LABEL} | grep 'a valid ASM disk' |awk -F\, '{print $2 }' | awk -F\] '{print $1}'`
for x in ` ls -l --time-style=long-iso /dev/* | grep ${M} | grep ${N}' ' | awk '{print $9}' `
do
/etc/init.d/oracleasm querydisk $x |grep -i ${LABEL}
done
Example:
# ./getasmlib VOL1
Disk "/dev/sdc5" is marked an ASM disk with the label "VOL1"
# ./getasmlib VOL2
Disk "/dev/sdc6" is marked an ASM disk with the label "VOL2"
Just sample shell code ;)
Tuesday, August 04, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment