DB2 Version 10.1 for Linux, UNIX, and Windows

Creating a shared file system

Once you have created a DB2® pureScale® instance, you must create the file systems for the database directories and log files, before you create a database.

Before you begin

You must have a list of storage paths that are connected to the hosts in the cluster. The disk cannot be currently used by any other file system on any host with connectivity to this disk. To perform this task, you must either own the disks and have read and write access to them, or be the DB2 cluster services administrator.

Procedure

  1. Use the db2cluster command to create the file system for the database:
    db2cluster -create -filesystem database-filesystem-name -disk storage-paths \
               -mount mount-point
    Note: The file system name in the command is created under a root file system name of /db2fs unless a mount point is provided.
  2. Use the db2cluster command to create the file system for the log files:
    db2cluster -create -filesystem logfile-filesystem-name -disk storage-paths \
               -mount mount-point
  3. Optional: Check that the file systems were mounted on their hosts:
    mount | grep filesystem-name
    This command can be run from any host in the DB2 pureScale instance.
  4. Check the amount of space on the file system:
    df filesystem-directory
    This command can be run from any host in the DB2 pureScale instance. For a large file system, it might take a few minutes for all of the storage to register with the operating system. Reissue this command after a few minutes if the amount of space is less than expected immediately after the file system creation command completes.

Results

Once the file system has been created by the db2cluster command, the file system is mounted and available for usage on the local host. The instance owner has immediate read and write access to the file system. If a root user created the file system, there are no disk ownership checks.

Example

A DBA installed the DB2 pureScale Feature and created the DB2 pureScale instance using the db2setup GUI. The four available disks are hdisk3, hdisk4, hdisk5, and hdisk6, as shown by a ls command:
ls -l /dev/hdisk3 /dev/hdisk4 /dev/hdisk5 /dev/hdisk6

brw-------    1 db2inst1 system       17, 12 Nov 11 10:39 /dev/hdisk3
brw-------    1 db2inst1 system       17, 14 Nov 11 10:39 /dev/hdisk4
brw-------    1 db2inst1 system       17, 12 Nov 11 10:39 /dev/hdisk5
brw-------    1 db2inst1 system       17, 14 Nov 11 10:39 /dev/hdisk6
The DBA creates the file systems for the database:
db2cluster -create -filesystem mydb2database -disk /dev/hdisk3,/dev/hdisk4 \
           -mount /db2fs/mydb2database
Next, the DBA creates the file systems for the log files:
db2cluster -create -filesystem mydb2logs -disk /dev/hdisk5,/dev/hdisk6 \
                  -mount /db2fs/mydb2logs
Now that the db2database and db2logs file systems are created, the DBA checks to see whether the file system for the database is mounted:
mount | grep mydb2database

/dev/mydb2database /db2fs/mydb2database mmfs rw,mtime,atime,dev=mydb2database
If the file system was successfully mounted, the DBA can check the amount of space on the file system:
df /db2fs/mydb2database

Filesystem         512-blocks Free       %Used Iused  %Iused Mounted on
/dev/mydb2database 1048576000 739581952  30%   263665    52% /db2fs/mydb2database
Finally, the DBA creates the database:
db2 create database testdb1 on /db2fs/mydb2database dbpath on /db2fs/mydb2logs

What to do next

Once the file systems for the database directory and log directories are created, you can create a database. If the root user created the file system, the root user is required to create a directory (or change the ownership of the current mount point directory), so the instance owner has access to the file system.