DB2 Version 9.7 for Linux, UNIX, and Windows

Configuring and setting up DMS direct disk access (Linux)

When working with containers to store data, the database manager supports direct disk (raw) access using the block device interface (that is, raw I/O).

About this task

The following information should be used when working in a Linux environment. On Linux/390, the database manager does not support direct disk access devices.

To configure or raw I/O on Linux:

In this example, the raw database partition to be used is /dev/sda5. It should not contain any valuable data.

  1. Calculate the number of 4 096-byte pages in this database partition, rounding down if necessary. For example:
    # fdisk /dev/sda
    Command (m for help): p
    
    Disk /dev/sda: 255 heads, 63 sectors, 1106 cylinders
    Units = cylinders of 16065 * 512 bytes
    Table 1. Linux raw I/O calculations.
    Device boot Start End Blocks Id System
    /dev/sda1 1 523 4200997 83 Linux
    /dev/sda2 524 1106 4682947+ 5 Extended
    /dev/sda5 524 1106 4682947 83 Linux
    Command (m for help): q
    # 
    The number of pages in /dev/sda5 is:
    num_pages = floor( (4682947 * 1024)/4096 )
    num_pages = 1170736
  2. Create the table space by specifying the disk partition name. For example:
    CREATE TABLESPACE dms1
    MANAGED BY DATABASE
    USING (DEVICE '/dev/sda5' 1170736)
  3. To specify logical partitions by using junction points (or volume mount points), mount the RAW partition to another NTFS-formatted volume as a junction point, then specify the path to the junction point on the NTFS volume as the container path. For example:
    CREATE TABLESPACE TS4
       MANAGED BY DATABASE USING (DEVICE 'C:\JUNCTION\DISK_1' 10000,
          DEVICE 'C:\JUNCTION\DISK_2' 10000)
    The database manager first queries the partition to see whether there is a file system R on it; if yes, the partition is not treated as a RAW device, and performs normal file system I/O operations on the partition.

Table spaces on raw devices are also supported for all other page sizes supported by the database manager.

Prior to Version 9, direct disk access using a raw controller utility on Linux was used. This method is now deprecated, and its use is discouraged. The database manager will still allow you to use this method if the Linux operating system still supports it, however, there will be a message in the db2diag log files that will indicate that its use is deprecated.

The prior method would have required you to "bind" a disk partition to a raw controller, then specify that raw controller to the database manager using the CREATE TABLESPACE command:
   CREATE TABLESPACE dms1
   MANAGED BY DATABASE
   USING (DEVICE '/dev/raw/raw1' 1170736) 

Before you begin

Before setting up raw I/O on Linux, one or more free IDE or SCSI disk database partitions are required. In order to reference the disk partition when creating the table space, you must know the name of the disk partition and the amount of space associated with the disk partition that is to be allocated to the table space.