1RAW(8) System Administration RAW(8)
2
3
4
6 raw - bind a Linux raw character device
7
9 raw /dev/raw/raw<N> <major> <minor>
10
11 raw /dev/raw/raw<N> /dev/<blockdev>
12
13 raw -q /dev/raw/raw<N>
14
15 raw -qa
16
18 raw is used to bind a Linux raw character device to a block device.
19 Any block device may be used: at the time of binding, the device driver
20 does not even have to be accessible (it may be loaded on demand as a
21 kernel module later).
22
23 raw is used in two modes: it either sets raw device bindings, or it
24 queries existing bindings. When setting a raw device, /dev/raw/raw<N>
25 is the device name of an existing raw device node in the filesystem.
26 The block device to which it is to be bound can be specified either in
27 terms of its major and minor device numbers, or as a path name
28 /dev/<blockdev> to an existing block device file.
29
30 The bindings already in existence can be queried with the -q option,
31 which is used either with a raw device filename to query that one
32 device, or with the -a option to query all bound raw devices.
33
34 Unbinding can be done by specifying major and minor 0.
35
36 Once bound to a block device, a raw device can be opened, read and
37 written, just like the block device it is bound to. However, the raw
38 device does not behave exactly like the block device. In particular,
39 access to the raw device bypasses the kernel's block buffer cache
40 entirely: all I/O is done directly to and from the address space of the
41 process performing the I/O. If the underlying block device driver can
42 support DMA, then no data copying at all is required to complete the
43 I/O.
44
45 Because raw I/O involves direct hardware access to a process's memory,
46 a few extra restrictions must be observed. All I/Os must be correctly
47 aligned in memory and on disk: they must start at a sector offset on
48 disk, they must be an exact number of sectors long, and the data buffer
49 in virtual memory must also be aligned to a multiple of the sector
50 size. The sector size is 512 bytes for most devices.
51
53 -q, --query
54 Set query mode. raw will query an existing binding instead of
55 setting a new one.
56
57 -a, --all
58 With -q , specify that all bound raw devices should be queried.
59
60 -h, --help
61 Display help text and exit.
62
63 -V, --version
64 Display version information and exit.
65
66
68 Rather than using raw devices applications should prefer open(2)
69 devices, such as /dev/sda1, with the O_DIRECT flag.
70
72 The Linux dd(1) command should be used without the bs= option, or the
73 blocksize needs to be a multiple of the sector size of the device (512
74 bytes usually), otherwise it will fail with "Invalid Argument" messages
75 (EINVAL).
76
77
78 Raw I/O devices do not maintain cache coherency with the Linux block
79 device buffer cache. If you use raw I/O to overwrite data already in
80 the buffer cache, the buffer cache will no longer correspond to the
81 contents of the actual storage device underneath. This is deliberate,
82 but is regarded either a bug or a feature depending on who you ask!
83
85 Stephen Tweedie (sct@redhat.com)
86
88 The raw command is part of the util-linux package and is available from
89 https://www.kernel.org/pub/linux/utils/util-linux/.
90
91
92
93util-linux August 1999 RAW(8)