How to create Oracle ASM disks using disk or multipath devices in Red Hat Enterprise Linux?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6
  • Oracle ASM
  • Udev

Issue

  • How to create Oracle ASM devices using device-mapper multipath devices in Red Hat Enterprise Linux?
  • How to create ASM device based on the WWID of the disk using udev rule?
  • How to create ASM disk using WWID of the disk?

Resolution


  1. Identify Device(s): determine self-identifier for the disk or multipath device using an environmental (E:) variable from udevadm command output. The identifier is required to be used for creating Oracle ASM devices.
    • A "self-identifier" is an identifier value provided directly by the disk or created multipath device that uniquely identifies the device independent of any device name assigned by the host. That is, while assigned sdX and mpathN names may change across boots, the identifier provided by the device will not change. Typically this identifier is based upon the disk's World Wide IDentifer (WWID).
    • The command below will need to be repeated for each disk and/or multipath device that is to be used with Oracle ASM. Please note down the E: environmental value retrieved for each device. This value will be used in creating the ASM disk udev rule.
    • For disks, use ID_WWN (identifier, world wide name) -- or if that is not available then ID_SERIAL, the disks serial number. Replace sdX below with the scsi disk name to be used as ASM disk.
      $ udevadm info --query=all --name=/dev/sdX |  egrep "WWN|SERIAL"
      E: ID_SERIAL=ST6000NM0004-1FFFFF_ZZZZAAAA
      E: ID_SERIAL_SHORT=Z4D0HDFG
      E: ID_WWN=0x5000c50000000000                              <<== Use this id
      E: ID_WWN_WITH_EXTENSION=0x5000c50000000000
    • For dm-multipath devices, use DM_UUID (dm device Universally Unique IDentifier). This identifier is nominally based up the underlying device's WWID or serial number. Replace mpathX below with the dm-multipath name to be used as ASM disk.
      $ udevadm info --query=all --name=/dev/mapper/mpathX |  grep -i "DM_UUID"
      E: DM_UUID=mpath-36001405a02467a627a24e62afa3d506c         <<== Use this id
      

      $ udevadm info --query=all --name=/dev/sdX | grep -i "ID_WWN" E: ID_WWN=0x6001405a02467a62
      E: ID_WWN_VENDOR_EXTENSION=0x7a24e62afa3d506c
      E: ID_WWN_WITH_EXTENSION=0x6001405a02467a627a24e62afa3d506c

      sg_inq -p 0x83 /dev/sdX

      VPD INQUIRY: Device Identification page
      Designation descriptor number 1, descriptor length: 20
      designator_type: NAA, code_set: Binary
      associated with the addressed logical unit
      NAA 6, IEEE Company_id: 0x1405
      Vendor Specific Identifier: 0xa02467a62
      Vendor Specific Identifier Extension: 0x7a24e62afa3d506c
      [0x6001405a02467a627a24e62afa3d506c]

    • NOTE: The DM_UUID above is derived from the underlying device's WWN as shown. Within the above, sdX is one of the paths of the mpathX device. The ID_WWN_WITH_EXTENSION is the full NAA WWID of the disks under the multipath device.
    • NOTE: Using the environmental variables of udev is much more efficient than using Program= within udev rules. Therefore using the E: variables already available for a device is the recommended practice when creating udev rules.

  2. Create Rule(s): Create a udev rule file /etc/udev/rules.d/96-storage-asm.rules and add a udev rule for each disk or multipath device.
    • For disks, add the following rule within the above file:
      ACTION=="add|change", ENV{ID_WWN}=="{id-wwn-from-udevadm}", SYMLINK+="oracleasm/{asm-disk-name}", GROUP:="dba", OWNER:="oracle", MODE:="0660"
      

      for example, using the information from step 1 to create ASM disk named asm01:

      ACTION=="add|change", ENV{ID_WWN}=="0x5000c50000000000", SYMLINK+="oracleasm/asm01", GROUP:="dba", OWNER:="oracle", MODE:="0660"

    • For dm-multipath devices, add the following rule within the above file:
      ACTION=="add|change", ENV{DM_UUID}=="{dm-uuid-from-udevadm}", SYMLINK+="oracleasm/{asm-disk-name}", GROUP=:"dba", OWNER=:"oracle", MODE=:"0660

      for example, using the information from step 1 to create ASM disk named asm01:

      ACTION=="add|change", ENV{DM_UUID}=="mpath-36001405a02467a627a24e62afa3d506c", SYMLINK+="oracleasm/asm01", GROUP:="dba", OWNER:="oracle", MODE:="0660"

    • Similarly, a udev rule for each device would need to be added into the /etc/udev/rules.d/96-storage-asm.rulesfile.
    • Modify the Group, Owner, and MODE values as needed for matching your environment.

  3. Apply Rule(s): As root, reload the udev service for the above changes to take effect and create the ASM disks. See "How to reload "udev rules" without restarting udev service? " for more complete steps.
    # udevadm control --reload-rules
    # udevadm trigger --type=devices --action=change
SBR
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.