Creating a Db2 home file system for a partitioned database system (Linux)

As part of setting up your partitioned database system on Linux® operating systems, you need to create a Db2® home file system. Then you must NFS export the home file system and mount it from each computer participating in the partitioned database system.

About this task

You must have a file system that is available to all machines that will participate in your partitioned database system. This file system will be used as the instance home directory.

For configurations that use more than one machine for a single database instance, NFS (Network File System) is used to share this file system. Typically, one machine in a cluster is used to export the file system using NFS, and the remaining machines in the cluster mount the NFS file system from this machine. The machine that exports the file system has the file system mounted locally.

For more information on setting up NFS on Db2 products, see Setting up DB2 for UNIX and Linux on NFS mounted file systems.

For more command information, see your Linux distribution documentation.

Procedure

To create, NFS export, and NFS mount the Db2 home file system, perform the following steps:

  1. On one machine, select a disk partition or create one using fdisk.
  2. Using a utility like mkfs, create a file system on this partition.
    The file system should be large enough to contain the necessary Db2 program files as well as enough space for your database needs.
  3. Locally mount the file system you have just created and add an entry to the /etc/fstab file so that this file system is mounted each time the system is rebooted.
    For example:
    /dev/hda1    /db2home    ext3   defaults   1 2
  4. To automatically export an NFS file system on Linux at boot time, add an entry to the /etc/exports file.
    Be sure to include all of the host names participating in the cluster as well as all of the names that a machine might be known as. Also, ensure that each machine in the cluster has root authority on the exported file system by using the "root" option.
    The /etc/exports file is an ASCII file which contains the following type of information:
    /db2home machine1_name(rw) machine2_name(rw)  
    To export the NFS directory, run
    /usr/sbin/exportfs -r
  5. On each of the remaining machines in the cluster, add an entry to the /etc/fstab file to NFS mount the file system automatically at boot time.
    As in the following example, when you specify the mount point options, ensure that the file system is mounted at boot time, is read-write, is mounted hard, includes the bg (background) option, and that setuid programs can be run properly.
    fusion-en:/db2home /db2home nfs rw,timeo=7,
       hard,intr,bg,suid,lock
    where fusion-en represents the machine name.
  6. NFS mount the exported file system on each of the remaining machines in the cluster.
    Enter the following command:
    mount /db2home
    If the mount command fails, use the showmount command to check the status of the NFS server. For example:
    showmount -e fusion-en
    where fusion-en represents the machine name.
    This showmount command should list the file systems which are exported from the machine named fusion-en. If this command fails, the NFS server may not have been started. Run the following command as root on the NFS server to start the server manually:
    /etc/rc.d/init.d/nfs restart
    Assuming the present run level is 3, you can have this command run automatically at boot time by renaming K20nfs to S20nfs under the following directory: /etc/rc.d/rc3.d.

Results

By performing these steps, you have completed the following tasks:
  1. On a single computer in the partitioned database environment, you have created a file system to be used as the instance and home directory.
  2. If you have a configuration that uses more than one machine for a single database instance, you have exported this file system using NFS.
  3. You have mounted the exported file system on each participating computer.