ASM Disk Mapping
At times, we need to know the original partition of an ASM disk for maintenance.
In this post, we'll talk about 2 popular disk mapping ways of ASM disks.
UDEV
ASM disks mapped by udev (userspace /dev) have symbolic links can be traced.
Check Discovery Path
[grid@primary01 ~]$ sqlplus / as sysasm
...
SQL> show parameter asm_diskstring
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string /dev/asm/*
List Discovery Path
[grid@primary01 ~]$ ll /dev/asm
total 0
lrwxrwxrwx 1 root root 7 Sep 28 14:34 disk01 -> ../sdb1
lrwxrwxrwx 1 root root 7 Sep 28 14:34 disk02 -> ../sdc1
lrwxrwxrwx 1 root root 7 Sep 28 14:34 disk03 -> ../sdd1
lrwxrwxrwx 1 root root 7 Sep 28 14:34 disk04 -> ../sde1
List Disk Partitions
[grid@primary01 ~]$ ll /dev/sd[b-e]1*
brw-rw---- 1 grid asmadmin 8, 17 Sep 28 14:34 /dev/sdb1
brw-rw---- 1 grid asmadmin 8, 33 Sep 28 14:34 /dev/sdc1
brw-rw---- 1 grid asmadmin 8, 49 Sep 28 14:34 /dev/sdd1
brw-rw---- 1 grid asmadmin 8, 65 Sep 28 14:34 /dev/sde1
Those symbolic links lead you to find the right disk partition of a specific ASM disk.
By the way, raw devices need to be partitioned before mapping to ASM disks on Linux, while AIX can take raw devices as ASM disks directly.
ASMLib
On the other hand, ASM disks mapped by ASMLib are not such straightforward, we need more steps to find it.
List ASM Disks
First of all, we need to know all valid ASM disk names.
[grid@primary01 ~]$ oracleasm listdisks
OCR1
OCR2
OCR3
DATA1
DATA2
Query ASM Disk
Suppose we'd like to know the original partition of DATA1, we query the ASM disk like this.
[grid@primary01 ~]$ oracleasm querydisk -d DATA1
Disk "DATA1" is a valid ASM disk on device [8,20]
Where [8,20] is the major number and minor number of a partition respectively.
List Disk Partitions
Next, we list all disk partitions.
There could be a lot of disk partitions, just focus their major and minor numbers.
[grid@primary01 ~]$ ls -l /dev/sd*
...
brw-rw---- 1 root disk 8, 20 Apr 24 2017 /dev/sdb4
...
We found it.
There're other ways to list all disk partitions, including major number, minor number and size. You may have a look.