Friday, August 28, 2009

Query Disk Device (ASMLib) by Disk Label "oracleasm"

On old ASMLib version , that's not easy to get Disk Device Name from Disk Label(sample script).

On asmlib-support since 2.1.0... we can use "oracleasm" command-line to query!
# for x in `rpm -qa | grep oracleasm`; do rpm --query --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n" $x ; done

oracleasm-2.6.18-128.el5-2.0.5.1.el5 (x86_64)
oracleasm-support-2.1.3.1.el5 (x86_64)
oracleasmlib-2.0.4.1.el5 (x86_64)
# oracleasm
Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
oracleasm --exec-path
oracleasm -h
oracleasm -V

The basic oracleasm commands are:
configure Configure the Oracle Linux ASMLib driver
init Load and initialize the ASMLib driver
exit Stop the ASMLib driver
scandisks Scan the system for Oracle ASMLib disks
status Display the status of the Oracle ASMLib driver
listdisks List known Oracle ASMLib disks
querydisk Determine if a disk belongs to Oracle ASMlib
createdisk Allocate a device for Oracle ASMLib use
deletedisk Return a device to the operating system
renamedisk Change the label of an Oracle ASMlib disk
update-driver Download the latest ASMLib driver
Example: use "oracleasm" query disk device name
# oracleasm listdisks
VOL1
# oracleasm querydisk
Usage: oracleasm-querydisk [-l <manager>] [-v] [-d|-p] <label>|<device> ...
# oracleasm querydisk VOL1
Disk "VOL1" is a valid ASM disk
# oracleasm querydisk -d VOL1
Disk "VOL1" is a valid ASM disk on device [7, 1]
# oracleasm querydisk -p VOL1
Disk "VOL1" is a valid ASM disk
/dev/loop1: LABEL="VOL1" TYPE="oracleasm"

3 comments:

Anonymous said...

Hi Surachart, found this short note, but really helpful. thank you for sharing.

Thanks
Kai

Suhas Dwarakanath said...

Hello Buddy,
I really find your posts on RAC amazingly accurate and helpful!
All search engines should tag you for RAC!
May God bless you.
Regards,
Suhas

Surachart Opun said...

thank you.
find out more on Oracle Docs
http://tahiti.oracle.com