본문 바로가기

Linux

CentOS 7 Raw Device 설정

반응형

udev rules를 사용하여 raw device 를 생성

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

 

**문법설명**

SCSI Device

ACTION=="add|change", KERNEL=="sdb", RUN+="/usr/bin/raw /dev/raw/raw1 %N"

 

multipath device

ACTION=="add|change", ENV{DM_NAME}=="mpath_name", RUN+="/usr/bin/raw /dev/raw/raw1 %N"

 

LVM device

ACTION=="add|change", ENV{DM_VG_NAME}=="vg_name", ENV{DM_LV_NAME}=="lv_name", RUN+="/usr/bin/raw /dev/raw/raw1 %N"

 

raw device 권한 설정

ACTION=="add", KERNEL=="raw*", OWNER="admin", GROUP="dba", MODE="0660"

 

**OS상 적용**

udev rules 적용

# udevadm trigger --action=add

 

raw device 확인

# raw -qa


**60-raw.rules 예시**

LVM(raw1~5) 및 scsi(raw6) Raw Device 생성 예문(Version1)

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

 

 

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

 

#make raw Device

ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g00", RUN+="/usr/bin/raw /dev/raw/raw1 %N"

ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g01", RUN+="/usr/bin/raw /dev/raw/raw2 %N"

ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g02", RUN+="/usr/bin/raw /dev/raw/raw3 %N"

ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g03", RUN+="/usr/bin/raw /dev/raw/raw4 %N"

ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g04", RUN+="/usr/bin/raw /dev/raw/raw5 %N"

 

KERNEL=="sdc", RUN+="/usr/bin/raw /dev/raw/raw6 %N"

 

#Set Permissions

KERNEL=="raw*", OWNER="admin", GROUP="dba", MODE="0660"

 

LABEL="raw_end"

 

결과

[root@rawvolumes ~]# 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

/dev/raw/raw4: bound to major 253, minor 5

/dev/raw/raw5: bound to major 253, minor 6

/dev/raw/raw6: bound to major 8, minor 32

[root@rawvolumes ~]#


LVM(raw1~5) 및 scsi(raw6) Raw Device 생성 예문(Version2)

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

 

#make raw Device

ACTION=="add|change", ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g00", RUN+="/usr/bin/raw /dev/raw/raw1 %N"

ACTION=="add|change", ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g01", RUN+="/usr/bin/raw /dev/raw/raw2 %N"

ACTION=="add|change", ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g02", RUN+="/usr/bin/raw /dev/raw/raw3 %N"

ACTION=="add|change", ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g03", RUN+="/usr/bin/raw /dev/raw/raw4 %N"

ACTION=="add|change", ENV{DM_VG_NAME}=="raws", ENV{DM_LV_NAME}=="lv1g04", RUN+="/usr/bin/raw /dev/raw/raw5 %N"

 

ACTION=="add|change", KERNEL=="sdc", RUN+="/usr/bin/raw /dev/raw/raw6 %N"

 

#Set Permissions

ACTION=="add", KERNEL=="raw*", OWNER="admin", GROUP="dba", MODE="0660"

 

결과

[root@rawvolumes ~]# 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

/dev/raw/raw4: bound to major 253, minor 5

/dev/raw/raw5: bound to major 253, minor 6

/dev/raw/raw6: bound to major 8, minor 32

[root@rawvolumes ~]#

반응형

'Linux' 카테고리의 다른 글

Free 명령어 정리  (0) 2024.04.03
Linux LVM on CentOS 7  (0) 2024.04.03
iscsi multipath IO 구성  (0) 2024.04.03