How to Choose Between Raw Partitions and UNIX Files

A raw partition on a UNIX system is a part of the disk where there is no file system. Although Adaptive Server can use UNIX files for database devices, Sybase strongly recommends that UNIX files only be used if the buffer cache is disabled for writes to the files. For any database device that is running on a UNIX file, you should disallow the use of buffer cache for writes by running the sp_deviceattr stored procedure and setting the dsync option to true.

For example, to ensure that you disallow the use of buffer cache for writes to the database device datadev1, run the following command:

1> sp_deviceattr datadev1, dsync, true
2> go

NoteThe ability to disallow the use of buffered writes to UNIX files by setting dsync option to true was first introduced in Adaptive Server version 12.0. In pre-12.0 servers, there is no way to avoid the use of buffer cache for writes on database devices placed on UNIX files. For this reason, Sybase strongly recommends that only raw partitions be used as database devices on any installation running a pre-12.0 version of Adaptive Server.

Most UNIX systems use a buffer cache for disk I/O. Writes to disk are stored in the buffer and may not be written to disk immediately. If Adaptive Server completes a transaction and sends the result to a UNIX file, the transaction is considered complete even though the UNIX buffer cache may not have been written to disk. If the system crashes before this buffer cache is written, you lose data. In this situation, Adaptive Server has no way of knowing that the write to disk eventually failed, and the transaction is not rolled back. In addition, some UNIX operating systems do partial writes. In that case, if the system crashes, the Sybase device will be corrupted.

Using raw partitions for Sybase devices allows Adaptive Server to process its own I/O requests, without having to go through the UNIX buffering scheme. In this way, Adaptive Server knows exactly what portions of a transaction completed or failed in the event of a system crash. If Sybase devices use UNIX files, corruption could occur.

Refer to the Adaptive Server installation and configuration guides or your operating system documentation for more information.