Showing posts with label asm format. Show all posts
Showing posts with label asm format. 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*

Friday, October 6, 2017

cleaning all asm disks and headers and recreating diskgroup in solaris

Identify the disks for the diskgroup you are trying to format everything from

In my case i am cleanup data diskgroup and the raw devices are
/dev/rdsk/c0d3s0
/dev/rdsk/c0d4s0
..
..
...
..


So i am running the following command to cleanup disks



dd if=/dev/zero of=/dev/rdsk/c0d3s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d4s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d5s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d6s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d7s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d8s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d9s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d10s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d11s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d12s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d13s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d14s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d15s0 bs=1048576 count=50
dd if=/dev/zero of=/dev/rdsk/c0d16s0 bs=1048576 count=50



Recreating diskgroup in solaris

Login as root


# format

select disk

y
p
6
default
default
0
0
1
default
default
0
0

0
default
default
1

10920c/65532c (depending on disk)
label
y
q


After its done

View permissions using

ls -lhL /dev/rdsk/c0d*s0

grant permission to oracle user on the disk

chown oracle:dba /dev/rdsk/c0d3s0
chown oracle:dba /dev/rdsk/c0d4s0

chmod 660 /dev/rdsk/c0d3s0
chmod 660 /dev/rdsk/c0d4s0

Once you do this

you should be able to see diskgroup in asmca and proceed creating diskgroup

To improve rebalance speed

alter diskgroup data rebalance power 4;

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...