The views expressed on this blog are my own and do not necessarily reflect the views of Oracle

May 11, 2010

How to map an ASMLIB disk to a device name


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"

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

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

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

May 9, 2010

Quarter rack Exadata deployment

Last week I was on-site for an Exadata deployment. I didn't do much, as I was there to learn - to see an actual machine (I haven't seen an Exadata version 2 system before) and understand what is involved in the deployment for the customer. I helped to solve some issues and delivered two presentations - on RAC and ASM, so I wasn't just a visitor after all :)

We deployed the quarter rack system, i.e. 2 database machines (Sun Fire™ X4170):











and 3 storage cells (Sun Fire™ X4275):












Throw in two InfiniBand® switches, for interconnect and storage access, Ethernet switch, KVM:











and you have 2 node cluster ready to run Oracle RAC database.

The system is delivered wired up, with the OS and Exadata software installed, so the hardware set up consists of inspecting the cabling, connecting the mains cables, updating the firmware, configuring the switches and booting the system up. All green is what we want to see after that:












The rest of the deployment consisted of patching Exadata software to the latest and greatest version, the Grid Infrastructure and database software install, DBFS set up, customer's data import, Grid Control config and bunch of tests to make sure it all works as it should.

I spend most of my time on the Linux command line and SQL> prompt, so it was good to go out and put my hands on the hardware that powers those servers and databases.

All, well almost all, photos I took.