2 .TH RAW 8 "Aug 1999" "Version 0.1"
4 raw \- bind a Linux raw character device
7 .I /dev/raw/raw<N> <major> <minor>
10 .I /dev/raw/raw<N> /dev/<blockdev>
20 is used to bind a Linux raw character device to a block device. Any
21 block device may be used: at the time of binding, the device driver does
22 not even have to be accessible (it may be loaded on demand as a kernel
26 is used in two modes: it either sets raw device bindings, or it queries
27 existing bindings. When setting a raw device,
29 is the device name of an existing raw device node in the filesystem.
30 The block device to which it is to be bound can be specified either in
35 device numbers, or as a path name
37 to an existing block device file.
39 The bindings already in existence can be queried with the
41 option, with is used either with a raw device filename to query that one
44 option to query all bound raw devices.
46 Unbinding can be done by specifying major and minor 0.
48 Once bound to a block device, a raw device can be opened, read and
49 written, just like the block device it is bound to. However, the raw
50 device does not behave exactly like the block device. In particular,
51 access to the raw device bypasses the kernel's block buffer cache
52 entirely: all I/O is done directly to and from the address space of the
53 process performing the I/O. If the underlying block device driver can
54 support DMA, then no data copying at all is required to complete the
57 Because raw I/O involves direct hardware access to a process's memory, a
58 few extra restrictions must be observed. All I/Os must be correctly
59 aligned in memory and on disk: they must start at a sector offset on
60 disk, they must be an exact number of sectors long, and the data buffer
61 in virtual memory must also be aligned to a multiple of the sector
62 size. The sector size is 512 bytes for most devices.
68 will query an existing binding instead of setting a new one.
73 , specifies that all bound raw devices should be queried.
76 provides a usage summary.
80 (1) command should be used without bs= option or the blocksize needs to be a
81 multiple of the sector size of the device (512 bytes usually) otherwise it
82 will fail with "Invalid Argument" messages (EINVAL).
85 Raw I/O devices do not maintain cache coherency with the Linux block
86 device buffer cache. If you use raw I/O to overwrite data already in
87 the buffer cache, the buffer cache will no longer correspond to the
88 contents of the actual storage device underneath. This is deliberate,
89 but is regarded either a bug or a feature depending on who you ask!
91 Stephen Tweedie (sct@redhat.com)
93 The raw command is part of the util-linux-ng package and is available from
94 ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.