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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. How to uninstall jellyfish software package from Ubuntu
  2. logsave: command not found
  3. inxi Command Examples in Linux
  4. fwupdmgr Command Examples in Linux
  5. guake: command not found
  6. How to Limit some User Memory Resources on CentOS/RHEL using cgroup
  7. bfg Command Examples (Remove large files or passwords from Git history like git-filter-branch)
  8. Oracle RMAN interview questions
  9. Linux OS Service ‘lm_sensors’
  10. CentOS/RHEL – How to Remove stale ISCSI Target Node Information from ISCSI Initiator Server

You May Also Like

Primary Sidebar

Recent Posts

  • Chezmoi: A multi-machine dotfile manager, written in Go
  • cheat: Create and view interactive cheat sheets on the command-line
  • chars: Display names and codes for various ASCII and Unicode characters and code points
  • chafa: Image printing in the terminal

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright