RHEL 6.9 udev 将lv绑定raw devices

时间:2021-06-22 15:35:24

环境

RHEL6|RHEL7,LVM2,RAW device

用途

使用LVM的lv逻辑卷绑定裸设备

1. 编辑 /etc/udev/rules.d/60-raw.rules 添加如下:

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

# Create raw character device mapping:

ENV{DM_VG_NAME}=="vgoradata", ENV{DM_LV_NAME}=="lv_5G_1", RUN+="/bin/raw /dev/raw/raw1 %N"

ENV{DM_VG_NAME}=="vgoradata", ENV{DM_LV_NAME}=="lv_5G_2", RUN+="/bin/raw /dev/raw/raw2 %N"

ENV{DM_VG_NAME}=="vgoradata", ENV{DM_LV_NAME}=="lv_5G_3", RUN+="/bin/raw /dev/raw/raw3 %N"

# To set permissions:

KERNEL=="raw*", OWNER:="grid", GROUP:="asmadmin", MODE:="0660" LABEL="raw_end

2.使规则生效

udevadm control --reload-rules

udevadm trigger --type=devices --action=change

3.查看结果

# raw -qa

/dev/raw/raw1:  bound to major 253, minor 0

/dev/raw/raw2:  bound to major 253, minor 1

/dev/raw/raw3:  bound to major 253, minor 2

# vs -o +lv_kernel_major,lv_kernel_minor
   LV      VG        Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert KMaj KMin
   lv_5G_1 vgoradata -wi-a----- 2.00g                                                      253    0
   lv_5G_2 vgoradata -wi-a----- 2.00g                                                      253    1
   lv_5G_3 vgoradata -wi-a----- 2.00g                                                      253    2

参考

https://access.redhat.com/solutions/231323