Tuesday, 31 May 2016

ASM disk and raw device mapping


If we need to know about the ASM disk and raw device mapping we can use the below script.

Script:

#!/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 -w "$majorminor" | cut -f10 -d' '`
echo "Device path: /dev/$device"
done



If an ASMLIB disk was already deleted, then we cannot find it in /dev/oracleasm/disks. We can use below script to check for devices that are (or were) associated with ASM.
Script:

#!/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


Thanks 
Srini

No comments:

Post a Comment


No one has ever become poor by giving