]>
Commit | Line | Data |
---|---|---|
232dc924 | 1 | .TH RAW 8 "August 1999" "util-linux" "System Administration" |
eb63b9b8 KZ |
2 | .SH NAME |
3 | raw \- bind a Linux raw character device | |
4 | .SH SYNOPSIS | |
5 | .B raw | |
22853e4a | 6 | .I /dev/raw/raw<N> <major> <minor> |
eb63b9b8 KZ |
7 | .PP |
8 | .B raw | |
22853e4a | 9 | .I /dev/raw/raw<N> /dev/<blockdev> |
eb63b9b8 | 10 | .PP |
449a215f | 11 | .B raw \-q |
22853e4a | 12 | .I /dev/raw/raw<N> |
eb63b9b8 | 13 | .PP |
449a215f | 14 | .B raw \-qa |
eb63b9b8 KZ |
15 | .SH DESCRIPTION |
16 | .B raw | |
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 | |
20 | module later). | |
21 | .PP | |
22 | .B raw | |
23 | is used in two modes: it either sets raw device bindings, or it queries | |
24 | existing bindings. When setting a raw device, | |
22853e4a | 25 | .I /dev/raw/raw<N> |
eb63b9b8 KZ |
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 | |
28 | terms of its | |
29 | .I major | |
30 | and | |
31 | .I minor | |
32 | device numbers, or as a path name | |
33 | .I /dev/<blockdev> | |
34 | to an existing block device file. | |
35 | .PP | |
930f40e3 | 36 | The bindings already in existence can be queried with the |
eb63b9b8 | 37 | .I \-q |
449a215f | 38 | option, which is used either with a raw device filename to query that one |
930f40e3 | 39 | device, or with the |
eb63b9b8 KZ |
40 | .I \-a |
41 | option to query all bound raw devices. | |
42 | .PP | |
df1dddf9 KZ |
43 | Unbinding can be done by specifying major and minor 0. |
44 | .PP | |
eb63b9b8 KZ |
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 | |
52 | I/O. | |
53 | .PP | |
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. | |
60 | .SH OPTIONS | |
61 | .TP | |
4fa491b3 | 62 | \fB\-q\fR, \fB\-\-query\fR |
eb63b9b8 KZ |
63 | Set query mode. |
64 | .B raw | |
65 | will query an existing binding instead of setting a new one. | |
66 | .TP | |
4fa491b3 | 67 | \fB\-a\fR, \fB\-\-all\fR |
eb63b9b8 | 68 | With |
930f40e3 | 69 | .B \-q |
449a215f | 70 | , specify that all bound raw devices should be queried. |
eb63b9b8 | 71 | .TP |
4fa491b3 | 72 | \fB\-h\fR, \fB\-\-help\fR |
b4362b6f | 73 | Display help text and exit. |
4fa491b3 KZ |
74 | .TP |
75 | \fB\-V\fR, \fB\-\-version\fR | |
76 | Display version information and exit. | |
77 | ||
67e63c12 MK |
78 | .SH NOTES |
79 | Rather than using raw devices applications should prefer | |
80 | .BR open (2) | |
81 | devices, such as /dev/sda1, with the O_DIRECT flag. | |
eb63b9b8 | 82 | .SH BUGS |
69616d88 | 83 | The Linux |
449a215f BS |
84 | .BR dd (1) |
85 | command should be used without the \fBbs=\fR option, or the blocksize | |
86 | needs to be a multiple of the sector size of the device (512 bytes usually), | |
87 | otherwise it will fail with "Invalid Argument" messages (EINVAL). | |
69616d88 | 88 | |
eb63b9b8 KZ |
89 | .PP |
90 | Raw I/O devices do not maintain cache coherency with the Linux block | |
91 | device buffer cache. If you use raw I/O to overwrite data already in | |
92 | the buffer cache, the buffer cache will no longer correspond to the | |
93 | contents of the actual storage device underneath. This is deliberate, | |
94 | but is regarded either a bug or a feature depending on who you ask! | |
a8d0d330 | 95 | .SH AUTHORS |
eb63b9b8 | 96 | Stephen Tweedie (sct@redhat.com) |
86d62711 | 97 | .SH AVAILABILITY |
601d12fb | 98 | The raw command is part of the util-linux package and is available from |
d673b74e | 99 | https://www.kernel.org/pub/linux/utils/util-linux/. |