When using ASMLIB to manage ASM disks, the device path info is not displayed in gv$asm_disk.path.
If you are using ASMLIB Support Tools 2.1. and later (package oracleasm-support-2.1*) you can get that info by running 'oracleasm querydisk -p' as root:
# ls -l /dev/oracleasm/disks
total 0
brw-rw---- 1 grid asmadmin 8, 5 May 2 12:00 DISK1
brw-rw---- 1 grid asmadmin 8, 6 May 2 12:00 DISK2
brw-rw---- 1 grid asmadmin 8, 7 May 2 12:00 DISK3
...
# oracleasm querydisk -p DISK1
Disk "DISK1" is a valid ASM disk
/dev/sda5: LABEL="DISK1" TYPE="oracleasm"
total 0
brw-rw---- 1 grid asmadmin 8, 5 May 2 12:00 DISK1
brw-rw---- 1 grid asmadmin 8, 6 May 2 12:00 DISK2
brw-rw---- 1 grid asmadmin 8, 7 May 2 12:00 DISK3
...
# oracleasm querydisk -p DISK1
Disk "DISK1" is a valid ASM disk
/dev/sda5: LABEL="DISK1" TYPE="oracleasm"
Otherwise, that info can be obtained with a shell script like this:
#!/bin/bash
for asmlibdisk in `ls /dev/oracleasm/disks/*`
do
echo "ASMLIB disk name: $asmlibdisk"
asmdisk=`kfed read $asmlibdisk | grep dskname | tr -s ' '| cut -f2 -d' '`
echo "ASM disk name: $asmdisk"
majorminor=`ls -l $asmlibdisk | tr -s ' ' | cut -f5,6 -d' '`
device=`ls -l /dev | tr -s ' ' | grep "$majorminor" | cut -f10 -d' '`
echo "Device path: /dev/$device"
done
for asmlibdisk in `ls /dev/oracleasm/disks/*`
do
echo "ASMLIB disk name: $asmlibdisk"
asmdisk=`kfed read $asmlibdisk | grep dskname | tr -s ' '| cut -f2 -d' '`
echo "ASM disk name: $asmdisk"
majorminor=`ls -l $asmlibdisk | tr -s ' ' | cut -f5,6 -d' '`
device=`ls -l /dev | tr -s ' ' | grep "$majorminor" | cut -f10 -d' '`
echo "Device path: /dev/$device"
done
The script can be run as OS user that owns ASM or Grid Infrastructure home, i.e. it does not need to be run as privileged user. The only requirement it that kfed binary exists and that it is in the PATH.
If an ASMLIB disk was alrady deleted, it will not show up in /dev/oracleasm/disks. I can check for devices that are (or were) associated with ASM with a script like this:
#!/bin/bash
for device in `ls /dev/sd*`
do
asmdisk=`kfed read $device|grep ORCL|tr -s ' '|cut -f2 -d' '|cut -c1-4`
if [ "$asmdisk" = "ORCL" ]
then
echo "Disk device $device may be an ASM disk"
fi
done
for device in `ls /dev/sd*`
do
asmdisk=`kfed read $device|grep ORCL|tr -s ' '|cut -f2 -d' '|cut -c1-4`
if [ "$asmdisk" = "ORCL" ]
then
echo "Disk device $device may be an ASM disk"
fi
done
This scripts takes a peek at sd devices in /dev, so in addition to kfed in the PATH, it needs to be run as privileged user. Of course you can look at /dev/dm*, /dev/mapper, etc or all devices in /dev, although that may not be a good idea.
There was recently a question on how to achieve the above without kfed. Here is one way to do it:
#!/bin/bash
for device in `ls /dev/sd*`
do
asmdisk=`od -c $device | head | grep 0000040 | tr -d ' ' | cut -c8-11`
if [ "$asmdisk" = "ORCL" ]
then
echo "Disk device $device may be an ASM disk"
fi
done
for device in `ls /dev/sd*`
do
asmdisk=`od -c $device | head | grep 0000040 | tr -d ' ' | cut -c8-11`
if [ "$asmdisk" = "ORCL" ]
then
echo "Disk device $device may be an ASM disk"
fi
done