Using UDEV for ASM

Using UDEV for ASM

Hello! To add a disk to an Oracle database via UDEV and write a comprehensive article, follow the steps below. Explanations for configuration files and important fields are also provided.

1. Preparing the New Disk

First, connect the new disk to the server and ensure it is recognized using fdisk or lsblk.

[root@vahiddb ~]# lsblk   

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT   

sda      8:0    0  100G  0 disk  

├─sda1   8:1    0    1G  0 part /boot/efi  

├─sda2   8:2    0   40G  0 part /u01  

├─sda3   8:3    0   20G  0 part /  

├─sda4   8:4    0   15G  0 part /var  

├─sda5   8:5    0    5G  0 part /home  

├─sda6   8:6    0    4G  0 part [SWAP]  

└─sda7   8:7    0   15G  0 part /tmp   

sdb      8:16   0   20G  0 disk   

sr0     11:0    1 13.2G  0 rom

Creating a Partition on the Disk

Create a new partition using fdisk or parted.

[root@vahiddb ~]# fdisk /dev/sdb

Follow the prompts to create the partition.

3. Finding the Unique Identifier of the Disk

To find the unique identifier of the disk, use the scsi_id command:

[root@vahiddb ~]# sudo /usr/lib/udev/scsi_id -g -u -d /dev/sdb

1ATA_VBOX_HARDDISK_VBa32d0c6e-5f61b0e2

Save this value for later use.

Adding UDEV Rules

Open or create a new UDEV rules file.

[root@vahiddb ~]# vi /etc/udev/rules.d/99-oracle-disk.rules

Add the following rule:

PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/sdb1", RESULT=="1ATA_VBOX_HARDDISK_VBa32d0c6e-5f61b0e2", NAME="DATA01", OWNER="oracle", GROUP="asmadmin", MODE="0660"

Field Explanations:

  • PROGRAM: The program to run to extract the unique ID of the disk.
  • RESULT: The result of the scsi_id program, which must match your disk's ID.
  • NAME: The name to assign to the disk (e.g., DATA01).
  • OWNER: The owner of the device file (e.g., oracle).
  • GROUP: The group owner of the device file (e.g., asmadmin).
  • MODE: The file permissions for the device file (e.g., 0660).

Applying UDEV Settings

To apply the new UDEV settings, run the following commands:

udevadm control --reload-rules

udevadm trigger

Final Check:

After performing these steps, the disk's properties should be as follows:

 

[root@vahiddb ~]# ll /dev/sdb

brw-rw----. 1 oracle asmadmin 8, 16 Aug  4 04:30 /dev/sdb