3 Configuring Oracle ASMLIB

The following procedures are a guideline for the initial configuration of ASMLIB on Oracle Linux. See the following Oracle Database documentation for more information:

Important:

Changes to ASMLIB configuration don't take immediate effect. Stop the database and all related processes when reconfiguring ASMLIB. Changes usually take effect after the next system reboot.

Initializing ASMLIB Configuration

After installation, configure the ASMLIB software and scan for disks on boot by using the management utility, /usr/sbin/oracleasm.

You can read the ASMLIB configuration file at /etc/sysconfig/oracleasm, however we recommend that you always use oracleasm configure to change configuration parameters, so that this file is always correctly configured. The interactive (-i) option is typically used to configure the library for the first time.

  • Run the configuration utility in interactive mode to initialize the configuration.
    sudo oracleasm configure -i

    If run for the first time, the oracleasm configure utility asks a series of questions, including which user id and group id to assign permission to use ASMLIB.

    If the Oracle Database is configured to run as the oracle user and the dba group, the output looks similar to the following:

    Configuring the Oracle ASM library driver.
                
    This will configure the on-boot properties of the Oracle ASM library
    driver.  The following questions will determine whether the driver is
    loaded on boot and what permissions it will have.  The current values
    will be shown in brackets ('[]').  Hitting <ENTER> without typing an
    answer will keep that current value.  Ctrl-C will abort.
                
    Default user to own the driver interface []: oracle
    Default group to own the driver interface []: dba
    Start Oracle ASM library driver on boot (y/n) [n]: y
    Scan for Oracle ASM disks on boot (y/n) [y]: y
    Maximum number of disks that may be used in ASM system [2048]: 2048
    Enable iofilter if kernel supports it (y/n) [y]: y
    Writing Oracle ASM library driver configuration: done
  • Enable and start the oracleasm service.

    After you have finished configuring ASMLIB, enable and start the oracleasm service.

    sudo systemctl enable --now oracleasm

Configuring ASM I/O Filtering

oracleasm-support includes an ASM I/O filtering feature that depends on BPF infrastructure support in the kernel. This feature is available in UEK R7 or Oracle Linux 9 with RHCK. When enabled, the I/O filter feature rejects any write operations that aren't started by ASM and prevents writes to ASM disks by admin commands such as dd after disks have been added to the ASM system.

See Release Notes for oracleasm-support 3.0 for more information about the I/O filter feature.
  1. Run the configuration utility to enable or disable I/O filtering.

    By default, the I/O filter feature is enabled. Use the oracleasm configure command to disable or enable the I/O filter feature.

    1. Disable the I/O filter.
      sudo oracleasm configure --iofilter n
    2. Enable the I/O filter.
      sudo oracleasm configure --iofilter y
  2. Run the configuration utility to set the maximum number of disk devices that ASMLIB can use with I/O filtering.

    I/O filtering requires a mapping of the maximum number of disk devices that ASMLIB can use. The default value is 2048, but this value can be changed to any value, such as 4096, by running:

    sudo oracleasm configure --maxdevs 4096

Making Disks Available to ASMLIB

Every disk that the Oracle Database accesses using ASMLIB must be labeled. This topic describes how to create an ASM disk label, verify it, and how to remove a label.

The following commands show how to scan disks, and create ASM disk labels. Instructions are also provided for viewing and querying disk labels and also for removing them.

  1. Use the oracleasm scandisks command to scan all block devices attached to the system for ASM disk labels and make any ASM disks found available to ASM.
    sudo oracleasm scandisks

    Output might appear similar to the following:

    Reloading disk partitions: done
    Cleaning any stale ASM disks...
    Setting up iofilter map for ASM disks: done
    Scanning system for ASM disks...
  2. Use the oracleasm createdisk command to label a disk.
    sudo oracleasm createdisk VOL1 /dev/sdg1

    The following output might be displayed:

    Writing disk header: done
    Instantiating disk: done
  3. Use the oracleasm listdisks command to view existing disk labels.
    sudo oracleasm listdisks

    Output might appear similar to the following:

    VOL1
    VOL2
    VOL3
  4. Use the oracleasm querydisk command to check whether a disk device has a label.
    sudo oracleasm querydisk /dev/sdg1

    If the device isn't labeled as an ASM disk, the following output is displayed:

    Device "/dev/sdg1" is not marked as an ASM disk
    If the device is labeled as an ASM disk, output appears as follows:
    Device "/dev/sdg1" is marked an ASM disk with the label "VOL1"
    You can also query an ASM disk label to see whether the label is valid, for example:
    sudo oracleasm querydisk VOL1
  5. Use the oracleasm deletedisk command to remove an ASM label from a disk.
    sudo oracleasm deletedisk VOL1

    The following output might be displayed:

    Clearing disk header: done
    Dropping disk: done

When you have finished configuring disk availability, you can check that the disks are visible in ASM. See Validating ASM Disk Visibility Using a Discovery String.

Checking ASMLIB Configuration Status

Use the oracleasm status command to show the status of ASMLIB configuration. This command can help identify issues and can show which features are enabled.

  • Run oracleasm status to view the current configuration status.
    sudo oracleasm status
    The following example output is taken from a system running UEK R7:
    Checking if the oracleasm kernel module is loaded: no (Not required with kernel 5.15.0)
    Checking if /dev/oracleasm is mounted: no (Not required with kernel 5.15.0)
    Checking which I/O Interface is in use: io_uring (KABI_V3)
    Checking if io_uring is enabled: yes
    Checking if ASM disks have the correct ownership and permissions: yes
    Checking if ASM I/O filter is set up: yes
    The following checks are performed:
    • Check if the oracleasm kernel module is loaded: The kernel module is required for earlier kernels that don't include io_uring.

    • Check if the /dev/oracleasm is mounted: When the oracleasm kernel module is used, a device node is configured and mounted. This action isn't required with kernels that include io_uring.

    • Check which I/O interface is being used: in the case of a kernel that's using KABI_V3 the io_uring interface is used, while a kernel using KABI_V2 uses the oracleasm driver interface.

    Note that the following checks are only performed when KABI_V3 is detected:

    • Check if io_uring is enabled: On a kernel that includes io_uring, the io_uring feature must be enabled to use ASMLIB. See Enabling or Restricting io_uring.

    • Check if ASM disks have correct ownership and permissions: Checks that any disk devices that are labeled for ASM use are owned by the user and group configured for ASM, and set when you initialized the configuration. See Initializing ASMLIB Configuration.

    • Check if ASM I/O filter is enabled and configured: On kernels that include the required BPF functionality, I/O filtering can be enabled and configured to protect ASM disks from accidental overwrites. See Configuring ASM I/O Filtering.

Validating ASM Disk Visibility Using a Discovery String

ASM uses discovery strings to describe which of the labeled ASM disks attached to a system are available to the Oracle Database instance.

Use the oracleasm discover command to validate ASM discovery strings and view characteristics of the associated ASM disks.

  • List all ASM disks on the system.
    sudo oracleasm discover

    The following output might be displayed:

    Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
    [ASM Library - Linux, version 3.0.0 (KABI_V3), Aug 26 2024 00:20]
    Discovered disk: ORCL:DB1 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
    Discovered disk: ORCL:DB2 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
    Discovered disk: ORCL:VOL1 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
    Discovered disk: ORCL:VOL2 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
  • List all ASM disks whose labels begin with "VOL".
    sudo oracleasm discover ORCL:VOL\*

    The following output might be displayed:

    Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
    [ASM Library - Linux, version 3.0.0 (KABI_V3), Aug 26 2024 00:20]
    Discovered disk: ORCL:VOL1 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
    Discovered disk: ORCL:VOL2 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]