• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Use Udev Rules to Create oracleasm Disks in CentOS/RHEL 8

By admin

This post will help to configure Oracleasm disks using Udev rules in 2 node cluster.

On first node

1. List the disks:

[root@node01 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda  8:0     0  2G   0       disk
sdb  8:16    0  2G   0       disk
Note: Create partitions for the disks.

2. Find the disk ID:

[root@node01 ~]# udevadm info --query=all --name=/dev/sda | egrep "WWN|SERIAL"
E: ID_SCSI_SERIAL=[id]
E: ID_SERIAL=0QEMU_QEMU_HARDDISK_AAAAAAAAA
E: ID_SERIAL_SHORT=[id]
E: SCSI_IDENT_SERIAL=[id]
[root@node01 ~]# udevadm info --query=all --name=/dev/sdb | egrep "WWN|SERIAL"
E: ID_SCSI_SERIAL=[id]
E: ID_SERIAL=0QEMU_QEMU_HARDDISK_BBBBBBBBB
E: ID_SERIAL_SHORT=[id]
E: SCSI_IDENT_SERIAL=[id]

3. Create a new file 96-asm.rules:

[root@node01 ~]# touch /etc/udev/rules.d/96-asm.rules

4. Append the file 96-asm.rules with discovered information of disk ID:

[root@node01 ~]# vim /etc/udev/rules.d/96-asm.rules
## Disk /dev/sda
KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_AAAAAAAAA", SYMLINK+="oracleasm/DATA1", OWNER="oracle", GROUP="dba", MODE="0660"
## Disk /dev/sdb
KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_BBBBBBBBB", SYMLINK+="oracleasm/DATA2", OWNER="oracle", GROUP="dba", MODE="0660"

5. Reload the udev/rules:

[root@node01 ~]# udevadm control --reload-rules
[root@node01 ~]# udevadm trigger --type=devices --action=change

6. List the oracleasm disk:

[root@node01 ~]# ll /dev/oracleasm/DATA*
lrwxrwxrwx. 1 root root 6 Sep 28 14:24 /dev/oracleasm/DATA1 -> ../sda
lrwxrwxrwx. 1 root root 6 Sep 28 14:24 /dev/oracleasm/DATA2 -> ../sdb
[root@node01 ~]#

On Second Node

1. List the disks:

[root@node02 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda  8:0     0  2G   0       disk
sdb  8:16    0  2G   0       disk
Note: /dev/sd* devices name will not persistence after reboot, find with disk id.

2. Find the disk ID:

[root@node02 ~]# udevadm info --query=all --name=/dev/sdb | egrep "WWN|SERIAL"
E: ID_SCSI_SERIAL=[id]
E: ID_SERIAL=0QEMU_QEMU_HARDDISK_AAAAAAAAA
E: ID_SERIAL_SHORT=[id]
E: SCSI_IDENT_SERIAL=[id]
[root@node02 ~]# udevadm info --query=all --name=/dev/sdc | egrep "WWN|SERIAL"
E: ID_SCSI_SERIAL=[id]
E: ID_SERIAL=0QEMU_QEMU_HARDDISK_BBBBBBBBB
E: ID_SERIAL_SHORT=[id]
E: SCSI_IDENT_SERIAL=[id]

3. Create a new file 96-asm.rules:

[root@node02 ~]# touch /etc/udev/rules.d/96-asm.rules

4. Either copy the 96-asm.rules from other node or make a new entry with discovered information:

[root@node02 ~]# vim /etc/udev/rules.d/96-asm.rules
## Disk /dev/sdb
KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_AAAAAAAAA", SYMLINK+="oracleasm/DATA1", OWNER="oracle", GROUP="dba", MODE="0660"
## Disk /dev/sdc
KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_BBBBBBBBB", SYMLINK+="oracleasm/DATA2", OWNER="oracle", GROUP="dba", MODE="0660"

5. Reload the udev/rules:

[root@node02 ~]# udevadm control --reload-rules
[root@node02 ~]# udevadm trigger --type=devices --action=change

6. List the oracleasm disk:

[root@node02 ~]# ll /dev/oracleasm/DATA*
lrwxrwxrwx. 1 root root 6 Sep 28 14:57 /dev/oracleasm/DATA1 -> ../sdb
lrwxrwxrwx. 1 root root 6 Sep 28 14:57 /dev/oracleasm/DATA2 -> ../sdc
[root@node02 ~]#
Note: For multipath device use the device name accordingly.

Filed Under: ASM, CentOS/RHEL, CentOS/RHEL 8, Linux, oracle

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : Understanding Kexec and Kdump
  2. How to Disable rpc.quotad Service in CentOS/RHEL 6 and 7
  3. Running RMAN DUPLICATE / RESTORE on a different version than source database version.
  4. “iscsiadm” Discovery TimeOut With Two Or More Network Interfaces in CentOS/RHEL
  5. Script to monitor RMAN Backup and Restore Operations
  6. Oracle Database: Profile Limits (Resource Parameter(s)) Are Not Enforced / Do Not Work
  7. How to monitor /etc/shadow and /etc/passwd file for changes with Auditd?
  8. How to Schedule Jobs with ‘at’ command under Linux
  9. How to Enable Disk Quotas on an XFS File System
  10. How to configure kdump in Oracle Enterprise Linux (OEL 5,6)

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary