Translation

The oldest posts, are written in Italian. If you are interested and you want read the post in English, please use Google Translator. You can find it on the right side. If the translation is wrong, please email me: I'll try to translate for you.

venerdì, marzo 25, 2016

lsasmdsk, Solaris version (ENG)


In order to associate the ASM disk in /dev/oracle directory with raw device, I made follofing script

#!/bin/ksh

DISK_ASM_DIR=/dev/oracle
DISK_OS_DIR=/dev/rdsk
DISK_OS_SCSI=${DISK_OS_DIR}/../../devices/scsi_vhci
DISK_OS_TYPE=brw #also crw

echo "ASM Disk        Device                                             Mj, Mn"
echo "--------------  -------------------------------------------------  ----------"
for _asm_disk_name in $(ls -l $DISK_ASM_DIR |grep -v total |awk '{print $(NF)}'); do
  asm_major_nr=$(ls -l ${DISK_ASM_DIR}/${_asm_disk_name} |awk 'BEGIN {FS=","}{print $1}'|awk '{print $NF}')
  asm_minor_nr=$(ls -l ${DISK_ASM_DIR}/${_asm_disk_name} |awk 'BEGIN {FS=","}{print $2}'|awk '{printf "%3s", $1}')
  scsi_disk=$(ls -l ${DISK_OS_SCSI} |grep ${asm_major_nr}|grep ${asm_minor_nr}|grep ^brw|sed 's/[@g|:| ]/,/g'|sed 's/,,*/,/g'|nawk -v amn="${asm_minor_nr}" 'BEGIN {FS=","} $6==amn {print $(NF-1)}')
  os_disk=$(ls /dev/rdsk |grep -i ${scsi_disk}|grep s0$)
  printf "%-15s %-50s [%-s,%4s]\n" $_asm_disk_name ${DISK_OS_DIR}/$os_disk ${asm_major_nr} ${asm_minor_nr}
done

This is an example of output

ASM Disk        Device                                             Mj, Mn
--------------  -------------------------------------------------  ----------
CRSOCR01        /dev/dsk/c5t600601605D102200355914322ACCDD11d0s0   [118, 480]
CRSVTG01        /dev/dsk/c5t600601605D102200345914322ACCDD11d0s0   [118, 488]
ORTST001        /dev/dsk/c5t600601605D1022006A5AB93EDDF9DD11d0s0   [118, 504]
ORTST002        /dev/dsk/c5t600601605D1022006B5AB93EDDF9DD11d0s0   [118, 496]
ORTST003        /dev/dsk/c5t600601605D1022006C5AB93EDDF9DD11d0s0   [118, 512]
WRADK001        /dev/dsk/c5t600601605D10220020BD730C29CCDD11d0s0   [118, 440]
WRADK002        /dev/dsk/c5t600601605D10220021BD730C29CCDD11d0s0   [118, 368]
WRADK003        /dev/dsk/c5t600601605D10220022BD730C29CCDD11d0s0   [118, 296]
WRADK004        /dev/dsk/c5t600601605D10220023BD730C29CCDD11d0s0   [118, 224]
WRADK005        /dev/dsk/c5t600601605D10220024BD730C29CCDD11d0s0   [118, 152]
WRADK006        /dev/dsk/c5t600601605D10220025BD730C29CCDD11d0s0   [118,  32]

Nessun commento: