AWK TO THE RESCUE 3 – match ASMLib with multipath


27.07.2016
by Kamil Stawiarski

This will be just short article with very simple trick, showing how to match the ASMLib devices with actual multipath devices.
I’m sure there is a simpler way… but I just love using AWK 🙂 If you know a simpler or more elegant solution – please post it in the comments section.

My solution looks like this:

[root@rac-2 ~]# ls -al /dev/oracleasm/disks/ | awk '/^brw/ {printf($NF": ") ; system("ls -al /dev/dm-* | egrep \"" $5"[ ]+"$6"\"")}' | awk '{printf($1" "); system("cat /sys/block/"substr($NF,6)"/dm/name")}' | awk '{printf($1); system("multipath -ll " $2)}'
DATA01:360002ac0000000000000002a0001a94f dm-5 3PARdata,VV
size=300G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:13 sde  8:64   active ready running
  |- 2:0:0:13 sdac 65:192 active ready running
  |- 1:0:1:13 sdq  65:0   active ready running
  `- 2:0:1:13 sdao 66:128 active ready running
DATA02:360002ac0000000000000002b0001a94f dm-6 3PARdata,VV
size=300G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:14 sdf  8:80   active ready running
  |- 2:0:0:14 sdad 65:208 active ready running
  |- 1:0:1:14 sdr  65:16  active ready running
  `- 2:0:1:14 sdap 66:144 active ready running
DATA03:360002ac0000000000000002c0001a94f dm-7 3PARdata,VV
size=300G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:15 sdg  8:96   active ready running
  |- 2:0:0:15 sdae 65:224 active ready running
  |- 1:0:1:15 sds  65:32  active ready running
  `- 2:0:1:15 sdaq 66:160 active ready running
DATA04:360002ac0000000000000002d0001a94f dm-8 3PARdata,VV
size=300G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:16 sdh  8:112  active ready running
  |- 2:0:0:16 sdaf 65:240 active ready running
  |- 1:0:1:16 sdt  65:48  active ready running
  `- 2:0:1:16 sdar 66:176 active ready running
GRID01:360002ac000000000000000190001a94f dm-2 3PARdata,VV
size=20G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:10 sdb  8:16   active ready running
  |- 2:0:0:10 sdy  65:128 active ready running
  |- 1:0:1:10 sdn  8:208  active ready running
  `- 2:0:1:10 sdal 66:80  active ready running
INDEX01:360002ac0000000000000001f0001a94f dm-3 3PARdata,VV
size=200G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:11 sdc  8:32   active ready running
  |- 2:0:0:11 sdaa 65:160 active ready running
  |- 1:0:1:11 sdo  8:224  active ready running
  `- 2:0:1:11 sdam 66:96  active ready running
INDEX02:360002ac000000000000000200001a94f dm-9 3PARdata,VV
size=200G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:17 sdi  8:128  active ready running
  |- 2:0:0:17 sdag 66:0   active ready running
  |- 1:0:1:17 sdu  65:64  active ready running
  `- 2:0:1:17 sdas 66:192 active ready running
INDEX03:360002ac000000000000000210001a94f dm-10 3PARdata,VV
size=200G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:18 sdj  8:144  active ready running
  |- 2:0:0:18 sdah 66:16  active ready running
  |- 1:0:1:18 sdv  65:80  active ready running
  `- 2:0:1:18 sdat 66:208 active ready running
INDEX04:360002ac000000000000000220001a94f dm-11 3PARdata,VV
size=200G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:19 sdk  8:160  active ready running
  |- 2:0:0:19 sdai 66:32  active ready running
  |- 1:0:1:19 sdw  65:96  active ready running
  `- 2:0:1:19 sdau 66:224 active ready running
INDEX05:360002ac000000000000000230001a94f dm-12 3PARdata,VV
size=200G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:20 sdl  8:176  active ready running
  |- 2:0:0:20 sdaj 66:48  active ready running
  |- 1:0:1:20 sdx  65:112 active ready running
  `- 2:0:1:20 sdav 66:240 active ready running
REDO01:360002ac000000000000000240001a94f dm-4 3PARdata,VV
size=20G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:12 sdd  8:48   active ready running
  |- 2:0:0:12 sdab 65:176 active ready running
  |- 1:0:1:12 sdp  8:240  active ready running
  `- 2:0:1:12 sdan 66:112 active ready running
REDO02:360002ac000000000000000250001a94f dm-13 3PARdata,VV
size=20G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 1:0:0:21 sdm  8:192  active ready running
  |- 2:0:0:21 sdak 66:64  active ready running
  |- 1:0:1:21 sdz  65:144 active ready running
  `- 2:0:1:21 sdaw 67:0   active ready running

Contact us

Database Whisperers sp. z o. o. sp. k.
al. Jerozolimskie 200, 3rd floor, room 342
02-486 Warszawa
NIP: 5272744987
REGON:362524978
+48 508 943 051
+48 661 966 009
info@ora-600.pl

Newsletter Sign up to be updated