Friday, March 6, 2015

Create user friendly device alias on Solaris for ASM


oracle@solaris:~$ ls -l /dev/rdsk/c2t*d0s6
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t0d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@0,0:g,raw
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t1d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@1,0:g,raw
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t2d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@2,0:g,raw
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t3d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@3,0:g,raw
lrwxrwxrwx   1 root     root          50 Mar  2 17:10 /dev/rdsk/c2t4d0s6 -> ../../devices/pci@0,0/pci1000,8000@14/sd@4,0:g,raw


oracle@solaris:~$ ls -l /devices/pci@0,0/pci1000,8000@14/*g,raw |grep oracle
crw-rw----   1 oracle   dba      208, 198 Mar  6 21:37 /devices/pci@0,0/pci1000,8000@14/sd@0,0:g,raw
crw-rw----   1 oracle   dba      208, 262 Mar  6 21:37 /devices/pci@0,0/pci1000,8000@14/sd@1,0:g,raw
crw-rw----   1 oracle   dba      208, 326 Mar  6 21:37 /devices/pci@0,0/pci1000,8000@14/sd@2,0:g,raw
crw-rw----   1 oracle   dba      208, 390 Mar  6 21:37 /devices/pci@0,0/pci1000,8000@14/sd@3,0:g,raw
crw-rw----   1 oracle   dba      208, 454 Mar  6 21:37 /devices/pci@0,0/pci1000,8000@14/sd@4,0:g,raw

root@solaris:/u01/asmdisks# mknod disk1 c 208 198
root@solaris:/u01/asmdisks# mknod disk2 c 208 262
root@solaris:/u01/asmdisks# mknod disk3 c 208 326
root@solaris:/u01/asmdisks# mknod disk4 c 208 390
root@solaris:/u01/asmdisks# mknod disk5 c 208 454
root@solaris:/u01/asmdisks# chmod 660 disk*
root@solaris:/u01/asmdisks# chown oracle:dba disk*
root@solaris:/u01/asmdisks# ls -l disk*
crw-rw----   1 oracle   dba      208, 198 Mar  6 22:55 disk1
crw-rw----   1 oracle   dba      208, 262 Mar  6 23:04 disk2
crw-rw----   1 oracle   dba      208, 326 Mar  6 23:05 disk3
crw-rw----   1 oracle   dba      208, 390 Mar  6 23:05 disk4
crw-rw----   1 oracle   dba      208, 454 Mar  6 23:05 disk5
root@solaris:/u01/asmdisks#

oracle@solaris:/u01/asmdisks$  kfod status=TRUE disks=all dscvgroup=true asm_diskstring=/u01/asmdisks/
--------------------------------------------------------------------------------
Disk          Size Header    Path                                     Disk Group   User     Group
================================================================================
   1:      16331 Mb MEMBER    /u01/asmdisks/disk1                      DATA         oracle   dba
   2:      16331 Mb MEMBER    /u01/asmdisks/disk2                      DATA         oracle   dba
   3:      16331 Mb MEMBER    /u01/asmdisks/disk3                      DATA         oracle   dba
   4:      16331 Mb CANDIDATE /u01/asmdisks/disk4                      #            oracle   dba
   5:      16331 Mb CANDIDATE /u01/asmdisks/disk5                      #            oracle   dba
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
      +ASM /u01/app/oracle/product/12.1.0/grid
oracle@solaris:/u01/asmdisks$  kfod status=TRUE disks=all dscvgroup=true
--------------------------------------------------------------------------------
Disk          Size Header    Path                                     Disk Group   User     Group
================================================================================
   1:      16331 Mb MEMBER    /dev/rdsk/c2t0d0s6                       DATA         oracle   dba
   2:      16331 Mb MEMBER    /dev/rdsk/c2t1d0s6                       DATA         oracle   dba
   3:      16331 Mb MEMBER    /dev/rdsk/c2t2d0s6                       DATA         oracle   dba
   4:      16331 Mb CANDIDATE /dev/rdsk/c2t3d0s6                       #            oracle   dba
   5:      16331 Mb CANDIDATE /dev/rdsk/c2t4d0s6                       #            oracle   dba
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
      +ASM /u01/app/oracle/product/12.1.0/grid

Command line references for kfod:


_asm_a/llow_only_raw_disks              KFOD allow only raw devices [_asm_allow_only_raw_disks=(TRUE)/FALSE]
_asm_l/ibraries         ASM Libraries[_asm_libraries=lib1,lib2,...]
_asms/id                ASM Instance[_asmsid=sid]
_b/oot          Running in pre-install env (boot=TRUE/FALSE)
_f/lexinfo              Provide flexinfo      (_flexinfo=TRUE/FALSE)
_p/atch_lib             Patchlib [_patch_lib=<asmclntsh_path>]
_u/ser          OS Username
asm_/diskstring         ASM Diskstring [asm_diskstring=discoverystring, discoverystring ...]
asmc/ompatibility               Include diskgroup ASM compatibility [asmcompatibility=TRUE/(FALSE)]
cli/ent_cluster         client cluster name
clus_/version           cluster version
clust/er                KFOD cluster [cluster=TRUE/(FALSE)]
db_/unique_name         db_unique_name for ASM instance[db_unique_name=dbname]
dbc/ompatibility                Include diskgroup DB compatibility [dbcompatibility=TRUE/(FALSE)]
disk_/access            Disk access method [disk_access=DIRECT/(INDIRECT)]
disks           Disks to discover [disks=raw,asm,badsize,all]
ds/cvgroup              Include group name [dscvgroup=TRUE/(FALSE)]
f/orce          Force option to delete files (force=TRUE/FALSE)
g/roup          Disks in diskgroup [group=diskgroup]
h/ostlist               hostlist[hostlist=host1,host2,...]
metadata_a/usize                AU Size for Metadata Size Calculation
metadata_c/lients               Client Count for Metadata Size Calculation
metadata_d/isks         Disk Count for Metadata Size Calculation
metadata_n/odes         Node Count for Metadata Size Calculation
metadata_r/edundancy            Redundancy for Metadata Size Calculation
na/me           Include disk name [name=TRUE/(FALSE)]
no/hdr          KFOD header suppression [nohdr=TRUE/(FALSE)]
ol/r            Import credentials to OLR [olr=TRUE/(FALSE)]
op              KFOD options type [OP=DISKS/CANDIDATES/MISSING/GROUPS/INSTS/VERSION/PATCHES/PATCHLVL/CLIENTS/RM/RMVERS/DFLTDSTR/GPNPDSTR/METADATA/CREDCRECLUS/GETCLSTYPE/CREDEXPORT/GETASMGUID/CREDDELCLUS/CREDVERIFY/UPGRADEVERIFY/ALL]
p/file          ASM parameter file [pfile=parameterfile]
r/im_disk_access                Rim disk access method [rim_disk_access=DIRECT/(INDIRECT)]
s/tatus         Include disk header status [status=TRUE/(FALSE)]
v/erbose                KFOD verbose errors [verbose=TRUE/(FALSE)]
w/rap           wrap file for credentials
oracle@solaris:/u01/asmdisks$ kfod asm_diskstring=/u01/asmdisk/*  status=TRUE disk=all
KFOD-00101: LRM error [107] while parsing command line arguments
_asm_a/llow_only_raw_disks              KFOD allow only raw devices [_asm_allow_only_raw_disks=(TRUE)/FALSE]
_asm_l/ibraries         ASM Libraries[_asm_libraries=lib1,lib2,...]
_asms/id                ASM Instance[_asmsid=sid]
_b/oot          Running in pre-install env (boot=TRUE/FALSE)
_f/lexinfo              Provide flexinfo      (_flexinfo=TRUE/FALSE)
_p/atch_lib             Patchlib [_patch_lib=<asmclntsh_path>]
_u/ser          OS Username
asm_/diskstring         ASM Diskstring [asm_diskstring=discoverystring, discoverystring ...]
asmc/ompatibility               Include diskgroup ASM compatibility [asmcompatibility=TRUE/(FALSE)]
cli/ent_cluster         client cluster name
clus_/version           cluster version
clust/er                KFOD cluster [cluster=TRUE/(FALSE)]
db_/unique_name         db_unique_name for ASM instance[db_unique_name=dbname]
dbc/ompatibility                Include diskgroup DB compatibility [dbcompatibility=TRUE/(FALSE)]
disk_/access            Disk access method [disk_access=DIRECT/(INDIRECT)]
disks           Disks to discover [disks=raw,asm,badsize,all]
ds/cvgroup              Include group name [dscvgroup=TRUE/(FALSE)]
f/orce          Force option to delete files (force=TRUE/FALSE)
g/roup          Disks in diskgroup [group=diskgroup]
h/ostlist               hostlist[hostlist=host1,host2,...]
metadata_a/usize                AU Size for Metadata Size Calculation
metadata_c/lients               Client Count for Metadata Size Calculation
metadata_d/isks         Disk Count for Metadata Size Calculation
metadata_n/odes         Node Count for Metadata Size Calculation
metadata_r/edundancy            Redundancy for Metadata Size Calculation
na/me           Include disk name [name=TRUE/(FALSE)]
no/hdr          KFOD header suppression [nohdr=TRUE/(FALSE)]
ol/r            Import credentials to OLR [olr=TRUE/(FALSE)]
op              KFOD options type [OP=DISKS/CANDIDATES/MISSING/GROUPS/INSTS/VERSION/PATCHES/PATCHLVL/CLIENTS/RM/RMVERS/DFLTDSTR/GPNPDSTR/METADATA/CREDCRECLUS/GETCLSTYPE/CREDEXPORT/GETASMGUID/CREDDELCLUS/CREDVERIFY/UPGRADEVERIFY/ALL]
p/file          ASM parameter file [pfile=parameterfile]
r/im_disk_access                Rim disk access method [rim_disk_access=DIRECT/(INDIRECT)]
s/tatus         Include disk header status [status=TRUE/(FALSE)]
v/erbose                KFOD verbose errors [verbose=TRUE/(FALSE)]
w/rap           wrap file for credentials