Upload Tizen:Base source
[framework/base/util-linux-ng.git] / disk-utils / raw.8
1 .\" -*- nroff -*-
2 .TH RAW 8 "Aug 1999" "Version 0.1"
3 .SH NAME
4 raw \- bind a Linux raw character device
5 .SH SYNOPSIS
6 .B raw
7 .I /dev/raw/raw<N> <major> <minor>
8 .PP
9 .B raw
10 .I /dev/raw/raw<N> /dev/<blockdev>
11 .PP
12 .B raw
13 .B \-q
14 .I /dev/raw/raw<N>
15 .PP
16 .B raw
17 .B \-qa
18 .SH DESCRIPTION
19 .B raw
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
23 module later).
24 .PP
25 .B raw
26 is used in two modes: it either sets raw device bindings, or it queries
27 existing bindings.  When setting a raw device,
28 .I /dev/raw/raw<N>
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
31 terms of its
32 .I major
33 and
34 .I minor
35 device numbers, or as a path name
36 .I /dev/<blockdev>
37 to an existing block device file.
38 .PP
39 The bindings already in existence can be queried with the 
40 .I \-q
41 option, with is used either with a raw device filename to query that one
42 device, or with the 
43 .I \-a
44 option to query all bound raw devices.
45 .PP
46 Unbinding can be done by specifying major and minor 0.
47 .PP
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
55 I/O.
56 .PP
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.
63 .SH OPTIONS
64 .TP
65 .B -q
66 Set query mode.
67 .B raw
68 will query an existing binding instead of setting a new one.
69 .TP
70 .B -a
71 With
72 .B -q
73 , specifies that all bound raw devices should be queried.
74 .TP
75 .B -h
76 provides a usage summary.
77 .SH BUGS
78 The Linux
79 .B dd
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).
83
84 .PP
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!
90 .SH AUTHOR
91 Stephen Tweedie (sct@redhat.com)
92 .SH AVAILABILITY
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/.