2011-08-18 15:18:34 -05:00
|
|
|
.TH RAW 8 "August 1999" "util-linux" "System Administration"
|
2006-12-06 17:25:41 -06:00
|
|
|
.SH NAME
|
|
|
|
raw \- bind a Linux raw character device
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B raw
|
2006-12-06 17:25:43 -06:00
|
|
|
.I /dev/raw/raw<N> <major> <minor>
|
2006-12-06 17:25:41 -06:00
|
|
|
.PP
|
|
|
|
.B raw
|
2006-12-06 17:25:43 -06:00
|
|
|
.I /dev/raw/raw<N> /dev/<blockdev>
|
2006-12-06 17:25:41 -06:00
|
|
|
.PP
|
2011-08-28 04:14:42 -05:00
|
|
|
.B raw \-q
|
2006-12-06 17:25:43 -06:00
|
|
|
.I /dev/raw/raw<N>
|
2006-12-06 17:25:41 -06:00
|
|
|
.PP
|
2011-08-28 04:14:42 -05:00
|
|
|
.B raw \-qa
|
2006-12-06 17:25:41 -06:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.B raw
|
|
|
|
is used to bind a Linux raw character device to a block device. Any
|
|
|
|
block device may be used: at the time of binding, the device driver does
|
|
|
|
not even have to be accessible (it may be loaded on demand as a kernel
|
|
|
|
module later).
|
|
|
|
.PP
|
|
|
|
.B raw
|
|
|
|
is used in two modes: it either sets raw device bindings, or it queries
|
|
|
|
existing bindings. When setting a raw device,
|
2006-12-06 17:25:43 -06:00
|
|
|
.I /dev/raw/raw<N>
|
2006-12-06 17:25:41 -06:00
|
|
|
is the device name of an existing raw device node in the filesystem.
|
|
|
|
The block device to which it is to be bound can be specified either in
|
|
|
|
terms of its
|
|
|
|
.I major
|
|
|
|
and
|
|
|
|
.I minor
|
|
|
|
device numbers, or as a path name
|
|
|
|
.I /dev/<blockdev>
|
|
|
|
to an existing block device file.
|
|
|
|
.PP
|
2014-04-20 19:30:25 -05:00
|
|
|
The bindings already in existence can be queried with the
|
2020-07-24 05:06:09 -05:00
|
|
|
.B \-q
|
2011-08-28 04:14:42 -05:00
|
|
|
option, which is used either with a raw device filename to query that one
|
2014-04-20 19:30:25 -05:00
|
|
|
device, or with the
|
2020-07-24 05:06:09 -05:00
|
|
|
.B \-a
|
2006-12-06 17:25:41 -06:00
|
|
|
option to query all bound raw devices.
|
|
|
|
.PP
|
2006-12-06 17:26:12 -06:00
|
|
|
Unbinding can be done by specifying major and minor 0.
|
|
|
|
.PP
|
2006-12-06 17:25:41 -06:00
|
|
|
Once bound to a block device, a raw device can be opened, read and
|
|
|
|
written, just like the block device it is bound to. However, the raw
|
|
|
|
device does not behave exactly like the block device. In particular,
|
|
|
|
access to the raw device bypasses the kernel's block buffer cache
|
|
|
|
entirely: all I/O is done directly to and from the address space of the
|
|
|
|
process performing the I/O. If the underlying block device driver can
|
|
|
|
support DMA, then no data copying at all is required to complete the
|
|
|
|
I/O.
|
|
|
|
.PP
|
|
|
|
Because raw I/O involves direct hardware access to a process's memory, a
|
|
|
|
few extra restrictions must be observed. All I/Os must be correctly
|
|
|
|
aligned in memory and on disk: they must start at a sector offset on
|
|
|
|
disk, they must be an exact number of sectors long, and the data buffer
|
|
|
|
in virtual memory must also be aligned to a multiple of the sector
|
|
|
|
size. The sector size is 512 bytes for most devices.
|
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
2013-04-05 05:36:29 -05:00
|
|
|
\fB\-q\fR, \fB\-\-query\fR
|
2006-12-06 17:25:41 -06:00
|
|
|
Set query mode.
|
|
|
|
.B raw
|
|
|
|
will query an existing binding instead of setting a new one.
|
|
|
|
.TP
|
2013-04-05 05:36:29 -05:00
|
|
|
\fB\-a\fR, \fB\-\-all\fR
|
2006-12-06 17:25:41 -06:00
|
|
|
With
|
2020-07-24 05:06:09 -05:00
|
|
|
.BR \-q ,
|
|
|
|
specify that all bound raw devices should be queried.
|
2006-12-06 17:25:41 -06:00
|
|
|
.TP
|
2013-04-05 05:36:29 -05:00
|
|
|
\fB\-h\fR, \fB\-\-help\fR
|
2013-10-14 14:34:39 -05:00
|
|
|
Display help text and exit.
|
2013-04-05 05:36:29 -05:00
|
|
|
.TP
|
|
|
|
\fB\-V\fR, \fB\-\-version\fR
|
|
|
|
Display version information and exit.
|
|
|
|
|
Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
There is value in ensuring that manual page sections use consistently
named sections, as far as possible, and also that sections have a
consistent order within manual pages. This is one of a series of patches
to place manual page sections in a consistent order.
In this patch, we ensure that the NOTES, HISTORY, BUGS, and EXAMPLE
sections are always placed near the end of the page, just above
AUTHORS, COPYRIGHT, SEE ALSO, and AVAILABILITY.
One page is not fixed by this patch: term-utils/agetty.8. This page
is a mess of unusual section names, and probably requires an individual
edit.
Testing that no gross editing mistake (causing accidental loss or addition
of text) was performed as follows:
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > a
[Apply patch]
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > b
$ diff a b
$ echo $?
0
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 02:28:32 -05:00
|
|
|
.SH NOTES
|
|
|
|
Rather than using raw devices applications should prefer
|
|
|
|
.BR open (2)
|
2020-07-24 05:06:09 -05:00
|
|
|
devices, such as
|
|
|
|
.IR /dev/sda1 ,
|
|
|
|
with the
|
|
|
|
.B O_DIRECT
|
|
|
|
flag.
|
2006-12-06 17:25:41 -06:00
|
|
|
.SH BUGS
|
2007-01-25 04:22:42 -06:00
|
|
|
The Linux
|
2011-08-28 04:14:42 -05:00
|
|
|
.BR dd (1)
|
|
|
|
command should be used without the \fBbs=\fR option, or the blocksize
|
|
|
|
needs to be a multiple of the sector size of the device (512 bytes usually),
|
|
|
|
otherwise it will fail with "Invalid Argument" messages (EINVAL).
|
2006-12-06 17:25:41 -06:00
|
|
|
.PP
|
|
|
|
Raw I/O devices do not maintain cache coherency with the Linux block
|
|
|
|
device buffer cache. If you use raw I/O to overwrite data already in
|
|
|
|
the buffer cache, the buffer cache will no longer correspond to the
|
|
|
|
contents of the actual storage device underneath. This is deliberate,
|
2020-07-24 05:06:09 -05:00
|
|
|
but is regarded as either a bug or a feature, depending on who you ask!
|
2020-05-19 07:51:28 -05:00
|
|
|
.SH AUTHORS
|
2006-12-06 17:25:41 -06:00
|
|
|
Stephen Tweedie (sct@redhat.com)
|
2007-07-02 18:17:04 -05:00
|
|
|
.SH AVAILABILITY
|
2010-11-30 04:41:59 -06:00
|
|
|
The raw command is part of the util-linux package and is available from
|
2016-12-17 02:06:57 -06:00
|
|
|
https://www.kernel.org/pub/linux/utils/util-linux/.
|