How to create udev rules of storage devices for ASM usage

  • Read

When I install the Grid Infrastructure(GI), usually I need to configure the udev rule for the storage devices to get a persistent device names and set the right owner, group and permissions on them for ASM.

Below is one simple way to finish such task.

1. Get the WWNA of the devices

[root@olinux73 ~]# /lib/udev/scsi_id -g -u -d /dev/sda
[root@olinux73 ~]# /lib/udev/scsi_id -g -u -d /dev/nvme0n1

For every device, this value is unique. All partitions share the same WWNA as the device itself.

2. For whole disk, use ENV{DEVTYPE}=="disk"; For partitions, use ENV{DEVTYPE}=="partition" and ATTR{partition}=="1" or ATTR{partition}=="2" for first partition and second partition. If you have more partitions, just increase the partition index number.

3. Create the udev rules.

KERNEL=="nvme*",ENV{DEVTYPE}=="partition",ATTR{partition}=="1",PROGRAM=="/lib/udev/scsi_id -g -u -d /dev/$name",RESULT=="24a6127ea9be0c2419be0d9d3498ec01d",SYMLINK+="oracleasm/nvme11"
KERNEL=="nvme*",ENV{DEVTYPE}=="partition",ATTR{partition}=="2",PROGRAM=="/lib/udev/scsi_id -g -u -d /dev/$name",RESULT=="24a6127ea9be0c2419be0d9d3498ec01d",SYMLINK+="oracleasm/nvme12"
KERNEL=="sd*",ENV{DEVTYPE}=="partition",ATTR{partition}=="1",PROGRAM=="/lib/udev/scsi_id -g -u -d /dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB8552f1b3-000f3f4e",SYMLINK+="oraocr"

Of course you should add other options like

OWNER="grid", GROUP="asmadmin", MODE="0660"
OWNER="oracle", GROUP="dba", MODE="0660"

Run below commands to make it take effect.

udevadm control --reload-rules && udevadm trigger

Done! How to create udev rules of storage devices for ASM usage

  • by Published on 21/05/2018 02:29:19
  • Repost please keep this link:


Anonymous Write

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: