Showing posts with label udev rules. Show all posts
Showing posts with label udev rules. Show all posts

Tuesday, July 23, 2019

Set persistent permissions across reboot in linux and UDEV rules for ASM disks

For asm disks owner should be oracle:dba

You need to setup udev rules or edit rc.local 

else after reboot permissions will change back to root

There are 2 methods to do it. Oracle recommends setting up UDEV

Here is alternative to udev

vi /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
chown oracle:dba /dev/mapper/mpatha
chown oracle:dba /dev/mapper/mpathb
chown oracle:dba /dev/mapper/mpathc
chmod 660 /dev/mapper/mpatha
chmod 660 /dev/mapper/mpathb
chmod 660 /dev/mapper/mpathc


After that check status of service. If its not enabled enable it

systemctl status rc-local.service
systemctl enable rc-local
systemctl start rc-local


2nd method using UDEV

#############preparing disks for ASM

/usr/lib/udev/scsi_id -g -u -d /dev/sdc
3624a93707784b3a3c17b437c00011074
/usr/lib/udev/scsi_id -g -u -d /dev/sdd
3624a93707784b3a3c17b437c0001106f
/usr/lib/udev/scsi_id -g -u -d /dev/sde
3624a93707784b3a3c17b437c00011071

vi /etc/scsi_id.config
options=-g
wq!

vi /etc/udev/rules.d/99-asmdevices.rules

KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="3624a93707784b3a3c17b437c00011074", SYMLINK+="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="3624a93707784b3a3c17b437c0001106f", SYMLINK+="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="3624a93707784b3a3c17b437c00011071", SYMLINK+="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"




##############Load rules
/sbin/partprobe /dev/sdc1
/sbin/partprobe /dev/sdd1
/sbin/partprobe /dev/sde1


##################Test rules
udevadm test /block/sdc/sdc1
udevadm test /block/sdd/sdd1
udevadm test /block/sde/sde1

#################Restart UDEV Service
udevadm control --reload-rules

check permissions

cd /dev

ls -lHL /dev/tas*


chown -R oracle:dba asm-disk1
chown -R oracle:dba asm-disk2
chown -R oracle:dba asm-disk3


chmod 660 asm-disk1
chmod 660 asm-disk2
chmod 660 asm-disk3

ls -lHL /dev/asm*

Featured Post

Apply Patch 22191577 latest GI PSU to RAC and DB homes using Opatch auto or manual steps

Patch 22191577: GRID INFRASTRUCTURE PATCH SET UPDATE 11.2.0.4.160119 (JAN2016) Unzip the patch 22191577 Unzip latest Opatch Version in or...