man-pages/man8/raw.8.html
2021-03-31 01:06:50 +01:00

170 lines
4.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of RAW</TITLE>
</HEAD><BODY>
<H1>RAW</H1>
Section: System Administration (8)<BR>Updated: August 1999<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
raw - bind a Linux raw character device
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>raw</B>
<I>/dev/raw/raw&lt;N&gt; &lt;major&gt; &lt;minor&gt;</I>
<P>
<B>raw</B>
<I>/dev/raw/raw&lt;N&gt; /dev/&lt;blockdev&gt;</I>
<P>
<B>raw -q</B>
<I>/dev/raw/raw&lt;N&gt;</I>
<P>
<B>raw -qa</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>raw</B>
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).
<P>
<B>raw</B>
is used in two modes: it either sets raw device bindings, or it queries
existing bindings. When setting a raw device,
<I>/dev/raw/raw&lt;N&gt;</I>
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</I>
and
<I>minor</I>
device numbers, or as a path name
<I>/dev/&lt;blockdev&gt;</I>
to an existing block device file.
<P>
The bindings already in existence can be queried with the
<I>-q</I>
option, which is used either with a raw device filename to query that one
device, or with the
<I>-a</I>
option to query all bound raw devices.
<P>
Unbinding can be done by specifying major and minor 0.
<P>
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.
<P>
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.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-q</B>, <B>--query</B><DD>
Set query mode.
<B>raw</B>
will query an existing binding instead of setting a new one.
<DT id="2"><B>-a</B>, <B>--all</B><DD>
With
<B>-q</B>
, specify that all bound raw devices should be queried.
<DT id="3"><B>-h</B>, <B>--help</B><DD>
Display help text and exit.
<DT id="4"><B>-V</B>, <B>--version</B><DD>
Display version information and exit.
<P>
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>BUGS</H2>
The Linux
<B><A HREF="/cgi-bin/man/man2html?1+dd">dd</A></B>(1)
command should be used without the <B>bs=</B> option, or the blocksize
needs to be a multiple of the sector size of the device (512 bytes usually),
otherwise it will fail with &quot;Invalid Argument&quot; messages (EINVAL).
<P>
<P>
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,
but is regarded either a bug or a feature depending on who you ask!
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>
Rather than using raw devices applications should prefer
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2)
devices, such as /dev/sda1, with the O_DIRECT flag.
<A NAME="lbAH">&nbsp;</A>
<H2>AUTHOR</H2>
Stephen Tweedie (<A HREF="mailto:sct@redhat.com">sct@redhat.com</A>)
<A NAME="lbAI">&nbsp;</A>
<H2>AVAILABILITY</H2>
The raw command is part of the util-linux package and is available from
<A HREF="https://www.kernel.org/pub/linux/utils/util-linux/.">https://www.kernel.org/pub/linux/utils/util-linux/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="8"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="9"><A HREF="#lbAF">BUGS</A><DD>
<DT id="10"><A HREF="#lbAG">NOTES</A><DD>
<DT id="11"><A HREF="#lbAH">AUTHOR</A><DD>
<DT id="12"><A HREF="#lbAI">AVAILABILITY</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:15 GMT, March 31, 2021
</BODY>
</HTML>