Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


Using Raw Device Partitions


The term raw devices applies to the character oriented disk device files (as opposed to the block oriented ones) normally found in /dev. These device files are a part of the interface between the hardware disks and the Unix system software.

In most Unix systems it is a performance advantage to use raw device files for data storage. By using raw devices, the Unix file system (which uses index pages to locate the file blocks) is bypassed and the operating system is able to perform more effective I/O.

Of course, the effect also depends on several other factors such as file size, transaction rate, I/O-implementation, etc. Generally, large and/or frequently used databanks should be stored in raw device files.

Note: Familiarity with raw device files is recommended. It is essential that a raw device file be correctly defined, since the normal Unix file handling safeguards do not apply. Some important points to be considered:

The major disadvantage of using a raw device file is that the maximum file size is fixed by the size of the partition. If the partition becomes full, the raw device file must be moved to a larger partition, if one is available.

In the worst case, the disk must be reformatted in order to create a larger partition.

Caution: Always take a complete backup before reformatting a disk and before setting up any raw device files for use!

Use of the raw device interface is completely transparent from the point of view of a Mimer SQL user. A user has no way of distinguishing a system using raw device files from a system where ordinary Unix files are used to store databanks.

Creating a Raw Disk Partition

If it is decided to use raw I/O towards a disk and a character special device for the disk partition in question is missing, such a device must be created. This can be done from a Logical Volume Manager (LVM) or on some systems by using the mknod command.

LVM

When a logical volume is created a corresponding character oriented raw device is created along with the block oriented one. When using raw I/O towards the character oriented device, make sure the block oriented device is not used (and not mounted at boot).

Mknod

The major and minor numbers for the disk partition must first be identified and then the character special, non-buffering, device can be created:

 # ls -l sdb2
 brw-rw----   1 root     disk       8,  18 May  5  2011 /dev/sdb2
 # mknod rawname c 8 18
 # ls -l *sdb2
 crw-rw----   1 root     root       8,  18 Feb 18 08:51 /dev/rsdb2
 brw-rw----   1 root     disk       8,  18 May  5  2011 /dev/sdb2

Arranging to Put a Databank on a Raw Device

The database server must be stopped:

 # mimcontrol -t m101server
 

The databank file should be renamed:

 # mv transdb.dbf transdb.dbf.ORDINARY
 

Create a soft link to the raw device file, using the original databank file name. Make sure that the owner of the databank, usually root, is the only one with access to the partition:

Note: It must be verified that the partition that corresponds to the raw device is not part of a file system that can be mounted.
 # ln -s /dev/rdsk/rawname transdb.dbf
 # chmod 600 /dev/rdsk/rawname
 # chmod 600 /dev/dsk/rawname
 

Copy the original databank file onto the soft link and restart the database server:

 # cp transdb.dbf.ORDINARY transdb.dbf
 # mimcontrol -s m101server

Arranging to Take a Databank off a Raw Device

The database server must be stopped:

 # mimcontrol -t m101server
 

The raw device databank file must be copied to an ordinary block oriented file, located on a partition large enough to hold the complete raw device partition. Then the soft link can be removed:

 # cp transdb.dbf /extra/transdb.dbf
 # unlink transdb.dbf
 

Now the raw device partition can be used for other purposes. However, to be able to start the database system again, the databank file (in this case the TRANSDB file
/extra/transdb.dbf) must be locatable by the database server. This can be achieved by arranging for the databank file to be moved back to its original location.

Another solution is to update the /etc/sqlhosts file by adding an optional databank location.


Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX