Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

Chapter 13. Configuring I/O for Raw Partitions

13.1. General

Raw partitions allow Oracle to bypass the OS cache. A raw device can be assigned or bound to block devices such as disk or disk partitions. When a raw device is bound to a disk, any read or write access to the raw device will perform a raw I/O with the disk. A raw I/O through the /dev/raw interface bypasses the kernel's block buffer cache entirely that is normally associated with block devices and goes right to the low level device itself. By bypassing the cache it accesses a physical device directly which allows applications such as Oracle databases to have more control over the I/O to the physical device. In fact, Oracle does it is own data caching and raw devices allow Oracle to ensure that data gets written to the disk immediately without OS caching.
Since Automatic Storage Management (ASM) is the recommended option for large amounts of storage in RAC environments, the focus of this article and section is on the usage of raw devices and block devices for ASM. ASM offers many advantages over conventional file systems. The ASM file system is not buffered and supports asynchronous I/O. It allows you to group sets of physical disks to logical entities as disk groups. You can add or remove disks without downtime. In fact, you could move a whole database from one SAN storage to another SAN without downtime. ASM spreads I/O over all the available disks automatically to avoid hot spots. ASM does also it is own striping and offers mirroring. ASM can be setup using the ASM library driver or raw devices. Starting with 10g R2, neither is necessarily required.


Raw I/O was briefly deprecated by the Linux community, so Oracle 10g R2 no longer requires raw devices for the database. Oracle 10g R2 automatically opens all block devices such as SCSI disks using the O_DIRECT flag, thus bypasses the OS cache. Support for raw devices was reinstated in Red Hat Enterprise Linux 5.4 and later.
For older Oracle Database and Red Hat Enterprise Linux versions raw devices are still a recommended option for ASM and data files, and remain supported. For more information on using block devices, see Section 13.4, “Using Block Devices for Oracle 10g Release 2 in Red Hat Enterprise Linux 4 and 5”. Unfortunately, Oracle Clusterware R2 OUI still requires raw devices or a Cluster File System.


The name of the devices are assigned by the Linux and is determined by the scan order of the bus. Therefore, the device names are not guaranteed to persist across reboots. For example, SCSI device /dev/sdb can change to /dev/sda if the scan order of the controllers is not configured. To force the scan order of the controllers, aliases can be set in /etc/modprobe.conf. For example:
alias scsi_hostadapter1 aic7xxx
alias scsi_hostadapter2 lpfc
These settings will guarantee that the Adaptec adapter for local storage is used first and then the Emulex adapter(s) for SAN storage. Fortunately, Red Hat Enterprise Linux 4 and 5 have already addressed this issue by delaying the loading of lpfc (Emulex) and various qla (QLogic) drivers until after all other SCSI devices have been loaded. This means that the alias settings in this example would not be required in Red Hat Enterprise Linux 4 and 5. For more information, see Red Hat Enterprise Linux AS 4 Release Notes. Be also careful when adding/removing devices which can change device names on the system. Starting Oracle with incorrect device names or raw devices can cause permanent damage to the database. For stable device naming in Linux 2.4 and 2.6, see Optimizing Linux I/O.