Creating an OCFS2 Volume

Follow the procedures in this section to configure your system to use OCFS2 and to create OCFS2 volumes.

Prerequisites

Before you begin, do the following:

  • Prepare the block devices you plan to use for your OCFS2 volumes. Leave the devices as free space.

    We recommend that you store application files and data files on different OCFS2 volumes, but it is only mandatory to do so if your application volumes and data volumes have different requirements for mounting.

  • Make sure that the ocfs2-tools package is installed. Use YaST or command line methods to install them if they are not. For YaST instructions, see Section 9.3, “OCFS2 Packages”.

Configuring OCFS2 Services

Before you can create OCFS2 volumes, you must configure OCFS2 services. .

Follow the procedure in this section for one node in the cluster.

  1. Open a terminal window and log in as the root user or equivalent.

  2. Add the distributed lock manager configuration.

    1. Start the crm shell and create a new scratch configuration:

      crm
      cib new stack-glue
             
    2. Create the DLM service and have it run on all machines in the cluster:

      configure
      primitive dlm ocf:pacemaker:controld op monitor interval=120s
      clone dlm-clone dlm meta globally-unique=false interleave=true
      end
             
    3. Verify the changes you made to the cluster before commiting them:

      cib diff
      configure verify
             
    4. Upload the configuration to the cluster and quit the shell:

      cib commit stack-glue
      quit
             
  3. Add the O2CB configuration with crm.

    1. Start the crm shell and create a new scratch configuration:

      crm
      cib new oracle-glue
             
    2. Configure Pacemaker to start the o2cb service on every node in the cluster.

      configure
      primitive o2cb ocf:ocfs2:o2cb op monitor interval=120s
      clone o2cb-clone o2cb meta globally-unique=false interleave=true
             
    3. Make sure that Pacemaker only starts the o2cb service on nodes that also have a copy of the dlm service already running:

      colocation o2cb-with-dlm INFINITY: o2cb-clone dlm-clone
      order start-o2cb-after-dlm mandatory: dlm-clone o2cb-clone
      end
             
    4. Upload the configuration to the cluster and quit the shell:

      cib commit stack-glue
      quit
             

Creating an OCFS2 Volume

Creating an OCFS2 file system and adding new nodes to the cluster should be performed on only one of the nodes in the cluster.

  1. Open a terminal window and log in as the root user or equivalent.

  2. Check if the cluster is online with the command crm_mon.

  3. Create and format the volume using one of the following methods:

    • Use the mkfs.ocfs2 utility. For information about the syntax for this command, refer to the mkfs.ocfs2 man page.

      To create a new OCFS2 file system on /dev/sdb1 that supports up to 16 cluster nodes, use

      mkfs.ocfs2 -N 16 /dev/sdb1

    See the following table for recommended settings.

    OCFS2 Parameter

    Description and Recommendation

    Volume label

    A descriptive name for the volume to make it uniquely identifiable when it is mounted on different nodes.

    Use the tunefs.ocfs2 utility to modify the label as needed.

    Cluster size

    Cluster size is the smallest unit of space allocated to a file to hold the data.

    Options are 4, 8, 16, 32, 64, 128, 256, 512, and 1024 KB. Cluster size cannot be modified after the volume is formatted.

    Oracle recommends a cluster size of 128 KB or larger for database volumes. Oracle also recommends a cluster size of 32 or 64 KB for Oracle Home.

    Number of node slots

    The maximum number of nodes that can concurrently mount a volume. For each of the nodes, OCFS2 creates separate system files, such as the journals, for each of the nodes. Nodes that access the volume can be a combination of little-endian architectures (such as x86, x86-64, and ia64) and big-endian architectures (such as ppc64 and s390x).

    Node-specific files are referred to as local files. A node slot number is appended to the local file. For example: journal:0000 belongs to whatever node is assigned to slot number 0.

    Set each volume’s maximum number of node slots when you create it, according to how many nodes that you expect to concurrently mount the volume. Use the tunefs.ocfs2 utility to increase the number of node slots as needed; the value cannot be decreased.

    Block size

    The smallest unit of space addressable by the file system. Specify the block size when you create the volume.

    Options are 512 bytes (not recommended), 1 KB, 2 KB, or 4 KB (recommended for most volumes). Block size cannot be modified after the volume is formatted.