How to Use Udev Rules to Create oracleasm Disks in CentOS/RHEL 8
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 diskNote: 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 diskNote: /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.
目录 返回
首页