DISK(7) — HP-UX
NAME
disk − direct disk access
DESCRIPTION
This page describes the actions of the general HP-UX disk drivers when referring to a disk as either a block-special or character-special (raw) device.
Block special files access disks via the system’s normal buffering mechanism. Buffering is done in such a way that concurrent access through multiple opens or a mount of the same physical device do not get out of phase. Block special files may be read and written without regard to physical disk records. Each I/O operation results in one or more logical block transactions. The size of the logical block request can be found in f_blksize as returned by ustat(2).
There is also a raw interface via a character special file which provides for direct transmission between the disk and the user’s read or write buffer. A single read or write operation results in exactly one transaction. Therefore raw I/O is considerably more efficient when many bytes are transmitted in a single operation because blocked disk access requires potentially several transactions and does not transmit directly to user space.
In raw I/O, there may be implementation dependent restrictions on the alignment of the user buffer in memory. Also, each transfer must occur on a sector boundary and must read a whole number of sectors. The sector size is a hardware dependent value.
Each raw access is independent of other raw accesses and of block accesses to the same physical device. Thus, transfers are not guaranteed to occur in any particular order.
In raw I/O, each operation is completed to the device before the call returns. For block-mode writes, the data may be cached until it is convenient for the system to write it. In addition, block-mode reads potentially do a one (or more) block read-ahead. The interaction of block-mode and raw access to the same disk is not specified, and in general is unpredictable.
Disk device file names are in the following format:
/dev/{r}dsk/(r)(c#d)#s#
where r indicates a raw interface to the disk, the second r should not be used and is reserved for future use, the c#d indicates the controller number (which is optionally specified by the system administrator), and #s# indicates the drive and section numbers, respectively. The assignment of controller, drive, and section numbers is described in the System Administrator’s manual for your system.
WARNING
On some systems, having both a mounted file system and a block special file open on the same device is asking for trouble; this should be avoided if possible. This is because it may be possible for some files to have private buffers in some systems.
HARDWARE DEPENDENCIES
Series 500
Block-special devices cannot be opened for I/O.
Series 800
All transfers must begin on a DEV_BSIZE boundary.
AUTHOR
Disk was developed by HP and AT&T.
SEE ALSO
mkdev(1M), mknod(1M), ct(7), intro(7). HP-UX System Administrator’s Manual included with your system.
Hewlett-Packard Company — Version B.1, April 12, 1993