How to create Oracle ASM disks using disk or multipath devices in Red Hat Enterprise Linux?
Environment
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
- Oracle ASM
- Udev
- Exceptions:
- For VMware guests
- Follow the directions in: "How to get the WWID of the disk within a RHEL guest on VMware ESX host?" for cases where the device wwid is not shown within udevadm output. Device WWIDs need to specifically be enabled within VMware hypervisor for a guest, otherwise no such persistent identifier is provided.
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
- Please use the following steps to create Oracle ASM disks with either disks or dm-multipath:
- Identify Device(s): determine self-identifier for the disk or multipath device using an environmental (E:) variable from
udevadmcommand output. - Create Rule(s): Create a udev rule file
/etc/udev/rules.d/96-storage-asm.rulesand add a udev rule for each disk or multipath device. - Apply Rule(s): Reload the
udevservice for the above changes to take effect and create the ASM disks.
- Identify Device(s): determine self-identifier for the disk or multipath device using an environmental (E:) variable from
- It is highly recommended to also review the following Best Practices guide which covers udev rules in greater detail, as well as various other important settings recommend for running Oracle.
- To prevent ASM disk mutlipath mapping issues see "Oracle application crashes when a single path in multipath fails"
- When configuring user and group permissions, the user and group MUST be local to the environment, not provided over LDAP, as udev runs as a system user early in the boot process before LDAP users are available.
- Identify Device(s): determine self-identifier for the disk or multipath device using an environmental (E:) variable from
udevadmcommand 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 thenID_SERIAL, the disks serial number. ReplacesdXbelow 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. ReplacempathXbelow 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=0x6001405a02467a627a24e62afa3d506csg_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_UUIDabove 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
udevis much more efficient than usingProgram=within udev rules. Therefore using theE:variables already available for a device is the recommended practice when creating udev rules. - Create Rule(s): Create a udev rule file
/etc/udev/rules.d/96-storage-asm.rulesand 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=:"0660for 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, andMODEvalues as needed for matching your environment.
- For disks, add the following rule within the above file:
- Apply Rule(s): As root, reload the
udevservice 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
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.