ASM disk to Physical Disk Mapping

Use oracleasm querydisk -p <ASM_DISK> command


[root@guang ~]# oracleasm listdisks
ACFS_ORA_HOME_VOL1
CRSVOL1
DATAVOL1
FRAVOL1
[root@guang ~]# oracleasm querydisk -p DATAVOL1
Disk "DATAVOL1" is a valid ASM disk
/dev/sde1: LABEL="DATAVOL1" TYPE="oracleasm"

we can also use this procedure that has been tested on Redhat and CentOS platform. Similar procedure applies to other Unix platforms.

Get disks formatted by oracleasm lib


[oracle@myhost ] oracleasm listdisks

DATAVOL1
DATAVOL2
DATAVOL3
FRAVOL1

Get details about the physical disk mapped to ASM disk


[oracle@myhost ] oracleasm querydisk -d DATAVOL1

Disk "DATAVOL1" is a valid ASM disk on device [8, 33]

where [8,33] is [minor number,major number] of a device

Use “ls -l /dev” to locate the physical disk by its minor and major number


[oracle@myhost ] ls -l /dev |grep "8," |grep 33
brw-r----- 1 root    disk   8,   33 May  1 16:32 sdc1

So the ASM disk “DATAVOL1” was created on top of ‘/dev/sdc1’

Use the following script to map all ASM disks to physical disks

#!/bin/ksh
for i in `/etc/init.d/oracleasm listdisks`
do
v_asmdisk=`/etc/init.d/oracleasm querydisk -d $i | awk  '{print $2}'`
v_minor=`/etc/init.d/oracleasm querydisk -d $i | awk -F[ '{print $2}'| awk -F] '{print $1}' | awk '{print $1}'`
v_major=`/etc/init.d/oracleasm querydisk -d $i | awk -F[ '{print $2}'| awk -F] '{print $1}' | awk '{print $2}'`
v_device=`ls -la /dev | grep $v_minor | grep $v_major | awk '{print $10}'`
echo "ASM disk $v_asmdisk based on /dev/$v_device  [$v_minor $v_major]"
done

A sample report looks like


ASM disk "DATAVOL1" based on /dev/sdc1  [8, 33]
ASM disk "DATAVOL2" based on /dev/sdf1  [8, 81]
ASM disk "DATAVOL3" based on /dev/sdb1  [8, 17]
ASM disk "FRAVOL1" based on /dev/sdd1  [8, 49]

Advertisements

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: