There are several requirements for configuring RAW I/O devices for DB2 so that the DB2 instance can be protected by LifeKeeper.

Requirements

  • The Linux OS must support Raw I/O devices. For most distributions this support was included in the 2.4 kernel, but there are some distributions that support Raw I/O on a 2.2. kernel.
  • All Raw I/O devices must be bound to a shared disk partition. A number of shared SCSI disk partitions is required. The exact number is determined by the number of tablespaces that will be located on Raw I/O devices. (Please see to DB2 documentation for guidelines for writing tablespaces on raw devices).
  • DB2 Version 7.1 Fix Pack 3 or later OR DB2 Version 8 or higher is required.

Raw I/O Setup Steps

The following steps 1-4 were taken from Section 7.3.1.1 (“Using Raw I/O on Linux”) of the IBM Db2 Universal Database Release Notes Version 7.2/Version 7.1 Fix Pack 3. In this example, the raw partition to be used is /dev/sda5. It should not contain any valuable data.

Note that step 4 or 5 will vary depending upon whether you are using Multiple Logical Nodes.

  1. Calculate the number of 4 096-byte pages in this partition, rounding down if necessary.

Example:

# fdisk /dev/sda

Command (m for help):p

Disk /dev/sda:255 heads, 63 sectors, 1106 cylinders

Units = cylinders of 16065 * 512 bytes

Device Boot
Start
End
Blocks
System
ID
dev/sda1
1
23
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( ((1106-524+1)*16065*512)/4096 )

num_pages = 11170736

  1. Bind an unused raw device node to this partition. Since this needs to be done every time the machine is rebooted, and requires root access, you may want to add the raw bindings to a system initialization file (i.e. rc.local or boot.local.) These bindings must be removed once the hierarchy is under LifeKeeper protection. LifeKeeper will re-establish the raw bindings for Raw I/O devices that are under LifeKeeper protection.

Use raw -qa to see which raw device nodes are already in use:

raw /dev/raw/raw1 /dev/sda5

/dev/raw/raw1:bound to major 8, minor 5

  1. Set global read permissions on the raw device controller and the disk partition. Set global read and write permissions on the raw device:

# chmod a+r /dev/rawctl

# chmod a+r /dev/sdb1

# chmod a+rw /dev/raw/raw1

  1. Important: This step only applies if you are using DB2 EE OR your DB2 EEE configuration will never run Multiple Logical Nodes (MLNs) even after failover. If the configuration may run MLNs at some point, proceed to step 5.

Create the tablespace in DB2, specifying the raw device, not the disk partition.

For example:

CREATE TABLESPACE dms1

MANAGED BY DATABASE

USING (DEVICE ‘/dev/raw/raw1’ 11170736)

Tablespaces on raw devices are also supported for all other page sizes supported by DB2.

  1. Note: This step must be followed if the configuration is running MLNs or will run MLNs at some point after failover.

Create the table space in DB2, specifying the raw device, not the disk partition, and specify a different raw I/O device node for each DB2 instance partition.

For example:

CREATE TABLESPACE dms1

MANAGED BY DATABASE

USING (DEVICE ‘/dev/raw/raw1’ 11170736) on NODE (NODENUM)

USING (DEVICE ‘/dev/raw/<different raw device node>’ ####### ) on NODE (NODENUM)

Note: ON NODE must be used because each DB2 node (database partition server) must use a different raw I/O device. This must be specified even if the node is running on a different machine so that the failover will work correctly.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment