1. 멀티패스 생성

defaults {
    find_multipaths yes
    user_friendly_names yes
}

# make your luns to human readable name
multipaths {
  multipath {
      wwid          360002ac000000000000000020000f8cc
        alias           lun1g001
    }
  multipath {
      wwid          360002ac000000000000000030000f8cc
        alias           lun1g002
    }

2. 해당 LUN을 RAW Device로 등록

/etc/udev/rules.d/60-raw.rules

# RAW Device이름은 반드시 rawN 이어야 하며 N > 0 이다.
ACTION=="add|change", ENV{DM_NAME}=="lun1g001", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add|change", ENV{DM_NAME}=="lun1g002", RUN+="/bin/raw /dev/raw/raw2 %N"

3. 추가적으로 해당 장치 권한을 설정해준다.
/etc/udev/rules.d/12-dm-permission.rules

ENV{DM_UUID}=="mpath-?*", OWNER:="oracle", GROUP:="dba", MODE:="660"

4. 만들어진 RAW Device를 Oracle RAC에 등록하여 사용한다.


LVM 으로 raw devices 구성

1. LVM 구성 확인

[root@localhost mapper]# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda2  centos lvm2 a--  <19.00g     0
  /dev/sdb   vg_raw lvm2 a--  <20.00g <5.00g

[root@localhost mapper]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   2   0 wz--n- <19.00g     0
  vg_raw   1   3   0 wz--n- <20.00g <5.00g

[root@localhost mapper]# lvs
  LV    VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  centos -wi-ao---- <17.00g                                                    
  swap  centos -wi-ao----   2.00g                                                    
  raw_1 vg_raw -wi-a-----   5.00g                                                    
  raw_2 vg_raw -wi-a-----   5.00g                                                    
  raw_3 vg_raw -wi-a-----   5.00g  

2. raw devices 구성
/etc/udev/rules.d/60-raw.rules

ACTION!="add|change", GOTO="raw_end"

# Create raw character device mapping:
ENV{DM_VG_NAME}=="vg_raw", ENV{DM_LV_NAME}=="raw_1", RUN+="/bin/raw /dev/raw/raw1 %N"    // DM_VG_NAME 에는 해당 VG명 , LV_NAME 에는 lv 명 기입
ENV{DM_VG_NAME}=="vg_raw", ENV{DM_LV_NAME}=="raw_2", RUN+="/bin/raw /dev/raw/raw2 %N"
ENV{DM_VG_NAME}=="vg_raw", ENV{DM_LV_NAME}=="raw_3", RUN+="/bin/raw /dev/raw/raw3 %N"


# # To set permissions:
KERNEL=="raw*", OWNER:="root", GROUP:="root", MODE:="0660"  // OWNER 와 GROUP 은 접근할 유저를 등록하면된다 (ex: oracle,tibero ..)

LABEL="raw_end"

3. 추가한 rules 시스템에 적용 및 확인

[root@localhost mapper]# udevadm control --reload-rules
[root@localhost mapper]# udevadm trigger --type=devices --action=change
[root@localhost mapper]# raw -qa
/dev/raw/raw1:  bound to major 253, minor 2
/dev/raw/raw2:  bound to major 253, minor 3
/dev/raw/raw3:  bound to major 253, minor 4

[root@localhost mapper]# lvs -o +lv_kernel_major,lv_kernel_minor
  LV    VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert KMaj KMin
  root  centos -wi-ao---- <17.00g                                                      253    0
  swap  centos -wi-ao----   2.00g                                                      253    1
  raw_1 vg_raw -wi-a-----   5.00g                                                      253    2
  raw_2 vg_raw -wi-a-----   5.00g                                                      253    3
  raw_3 vg_raw -wi-a-----   5.00g                                                      253    4