Categotry Archives: udev

redhat 6用udev设置multipath盘的权限

1

Posted on by

   在操作系统redhat 6上,重启multipath服务,盘的权限就变root了,需要用udev绑定设置权限。

查看设备

[root@oradbca ~]# dmsetup ls 
data01  (253:2)
crs03   (253:3)
VG0-LV_ROOT     (253:6)
crs02   (253:1)
crs01   (253:0)
data03  (253:5)
data02  (253:4)

 

配置参数

[root@oradbca ~]# cat /etc/udev/rules.d/12-dm-permissions.rules 
ENV{DM_NAME}=="crs01", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="crs02", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="crs03", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="data01", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="data02", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="data03", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"

 

重启服务

	service multipath restart

 

查看权限

[root@oradbca ~]# ll /dev/dm-*
brw-rw---- 1 grid asmadmin 253, 0 Jul 23 14:26 /dev/dm-0
brw-rw---- 1 grid asmadmin 253, 1 Jul 23 14:26 /dev/dm-1
brw-rw---- 1 grid asmadmin 253, 2 Jul 13 03:48 /dev/dm-2
brw-rw---- 1 grid asmadmin 253, 3 Jul 23 14:26 /dev/dm-3
brw-rw---- 1 grid asmadmin 253, 4 Jul 13 03:48 /dev/dm-4
brw-rw---- 1 grid asmadmin 253, 5 Jul 23 14:26 /dev/dm-5
brw-rw---- 1 root disk     253, 6 Jul 13 03:04 /dev/dm-6

 

贴multipath配置文件:

blacklist {
        devnode "^(sda)"
#       devnode "^(ram|raw|loop|fd|md|sr|scd|st|sdh|sdq)[0-9]*"
        devnode "^cciss.*"
}

## Use user friendly names, instead of using WWIDs as names.
defaults {
        user_friendly_names yes
        max_fds             max
        queue_without_daemon no  
        flush_on_last_del yes 
        dev_loss_tmo infinity
        fast_io_fail_tmo 5
}


devices {
        device {
                vendor                  "NetAPP"
                product                 "FAS2240"
                path_grouping_policy    group_by_prio
                features                "3 queue_if_no_path pg_init_retries 50"
                prio                    "ontap"
                getuid_callout          "/lib/udev/scsi_id -g -u -d /dev/%n"
                path_checker            tur
                path_selector           "round-robin 0"
                hardware_handler        "0"
                failback                imediate
                rr_weight               uniform
                rr_min_io               128
        }
}




multipaths {
        multipath {
                wwid                    360a98000426b5953423f456e30774c61
                alias                   crs01
        }
        multipath {
                wwid                    360a98000426b5953423f456e30774c63
                alias                   crs02
        }
        multipath {
                wwid                    360a98000426b5953423f456e30774c65
                alias                   crs03
        }
                multipath {
                wwid                    360a98000426b5953423f456e30774c67
                alias                   data01
        }
                multipath {
                wwid                    360a98000426b5953423f456e30774c69
                alias                   data02
        }
                multipath {
                wwid                    360a98000426b5953423f456e30774c6b
                alias                   data03
        }
}

USE Udev for Oracle ASM

0

Posted on by

   下面说明RHEL5和RHEL6通过UUID来绑udev

 

RHEL5:

1.检查一下要绑那几块盘

ll /dev/sd*

 

2.生成脚本

for i in b c d e ;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /tmp/99-oracle-asmdevices.rules
done

 

3.检查一下99-oracle-asmdevices.rules

cat /tmp/99-oracle-asmdevices.rules

 

4.copy到udev目录下(rac的话直接copy这个文件到另一个节点上)

cp /tmp/99-oracle-asmdevices.rules /etc/udev/rules.d/99-oracle-asmdevices.rules

 

重启udev

start_udev

 

 

RHEL6:

1.检查一下要绑那几块盘

ll /dev/sd*

 

 

2.生成脚本

for i in b c d e ;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -d /dev/$name\", RESULT==\"`scsi_id -g -u -d /dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /tmp/99-oracle-asmdevices.rules
done

for i in b c d e ;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""      >> /tmp/99-oracle-asmdevices.rules
done

 

3.检查一下99-oracle-asmdevices.rules

cat /tmp/99-oracle-asmdevices.rules

 

4.copy到udev目录下(rac的话直接copy这个文件到另一个节点上)

cp /tmp/99-oracle-asmdevices.rules /etc/udev/rules.d/99-oracle-asmdevices.rules

 

重启udev

start_udev

 

udev管理

1.Test the rules are working as expected.(udevtest)

# #OL5
# udevtest /block/sdb
# udevtest /block/sdc
# udevtest /block/sdd
# udevtest /block/sde

# #OL6
# udevadm test /block/sdb
# udevadm test /block/sdc
# udevadm test /block/sdd
# udevadm test /block/sde

 

2.restart the UDEV service.

# #OL5
# /sbin/udevcontrol reload_rules

# #OL6
# udevadm control --reload-rules

# #OL5 and OL6
# /sbin/start_udev

 

3.udev info

# #OL5
# udevinfo -q all -n /dev/sdb

# #OL6
# udevadm info --query=all --path=/sys/block/sdb
# udevadm info --query=all --name=asm-diska