1 .TH RAW 8 "August 1999" "util-linux" "System Administration"
3 raw \- bind a Linux raw character device
6 .I /dev/raw/raw<N> <major> <minor>
9 .I /dev/raw/raw<N> /dev/<blockdev>
17 is used to bind a Linux raw character device to a block device. Any
18 block device may be used: at the time of binding, the device driver does
19 not even have to be accessible (it may be loaded on demand as a kernel
23 is used in two modes: it either sets raw device bindings, or it queries
24 existing bindings. When setting a raw device,
26 is the device name of an existing raw device node in the filesystem.
27 The block device to which it is to be bound can be specified either in
32 device numbers, or as a path name
34 to an existing block device file.
36 The bindings already in existence can be queried with the
38 option, which is used either with a raw device filename to query that one
41 option to query all bound raw devices.
43 Unbinding can be done by specifying major and minor 0.
45 Once bound to a block device, a raw device can be opened, read and
46 written, just like the block device it is bound to. However, the raw
47 device does not behave exactly like the block device. In particular,
48 access to the raw device bypasses the kernel's block buffer cache
49 entirely: all I/O is done directly to and from the address space of the
50 process performing the I/O. If the underlying block device driver can
51 support DMA, then no data copying at all is required to complete the
54 Because raw I/O involves direct hardware access to a process's memory, a
55 few extra restrictions must be observed. All I/Os must be correctly
56 aligned in memory and on disk: they must start at a sector offset on
57 disk, they must be an exact number of sectors long, and the data buffer
58 in virtual memory must also be aligned to a multiple of the sector
59 size. The sector size is 512 bytes for most devices.
62 \fB\-q\fR, \fB\-\-query\fR
65 will query an existing binding instead of setting a new one.
67 \fB\-a\fR, \fB\-\-all\fR
70 , specify that all bound raw devices should be queried.
72 \fB\-h\fR, \fB\-\-help\fR
73 Display help text and exit.
75 \fB\-V\fR, \fB\-\-version\fR
76 Display version information and exit.
81 command should be used without the \fBbs=\fR option, or the blocksize
82 needs to be a multiple of the sector size of the device (512 bytes usually),
83 otherwise it will fail with "Invalid Argument" messages (EINVAL).
86 Raw I/O devices do not maintain cache coherency with the Linux block
87 device buffer cache. If you use raw I/O to overwrite data already in
88 the buffer cache, the buffer cache will no longer correspond to the
89 contents of the actual storage device underneath. This is deliberate,
90 but is regarded either a bug or a feature depending on who you ask!
92 Stephen Tweedie (sct@redhat.com)
94 The raw command is part of the util-linux package and is available from
95 ftp://ftp.kernel.org/pub/linux/utils/util-linux/.