]> git.ipfire.org Git - thirdparty/util-linux.git/blame - disk-utils/raw.8.adoc
Merge branch 'vla-alloca' of https://github.com/t-8ch/util-linux
[thirdparty/util-linux.git] / disk-utils / raw.8.adoc
CommitLineData
295b3979 1//po4a: entry man manual
c6a568fc
MB
2= raw(8)
3:doctype: manpage
4:man manual: System Administration
5:man source: util-linux {release-version}
6:page-layout: base
7:command: raw
8
9== NAME
10
11raw - bind a Linux raw character device
12
13== SYNOPSIS
14
15*raw* _/dev/raw/raw<N>_ _<major>_ _<minor>_
16
17*raw* _/dev/raw/raw<N>_ _/dev/<blockdev>_
18
19*raw* *-q* _/dev/raw/raw<N>_
20
21*raw* *-qa*
22
23== DESCRIPTION
24
25*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).
26
27*raw* is used in two modes: it either sets raw device bindings, or it queries existing bindings. When setting a raw device, _/dev/raw/raw<N>_ 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 _major_ and _minor_ device numbers, or as a path name _/dev/<blockdev>_ to an existing block device file.
28
29The bindings already in existence can be queried with the *-q* option, which is used either with a raw device filename to query that one device, or with the *-a* option to query all bound raw devices.
30
31Unbinding can be done by specifying major and minor 0.
32
33Once 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.
34
35Because 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.
36
37== OPTIONS
38
39*-q*, *--query*::
299604dd 40Set query mode. *raw* will query an existing binding instead of setting a new one.
c6a568fc
MB
41
42*-a*, *--all*::
299604dd 43With *-q*, specify that all bound raw devices should be queried.
c6a568fc 44
2b2d3172 45include::man-common/help-version.adoc[]
c6a568fc
MB
46
47== NOTES
48
e6743239 49Rather than using raw devices applications should prefer *open*(2) devices, such as _/dev/sda1_, with the *O_DIRECT* flag.
c6a568fc
MB
50
51== BUGS
52
f37298c2 53The Linux *dd*(1) command should be used without the *bs=* 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*).
c6a568fc
MB
54
55Raw 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 as either a bug or a feature, depending on who you ask!
56
57== AUTHORS
58
59mailto:sct@redhat.com[Stephen Tweedie]
60
625e9c61 61include::man-common/bugreports.adoc[]
c6a568fc 62
625e9c61 63include::man-common/footer.adoc[]
c6a568fc
MB
64
65ifdef::translation[]
625e9c61 66include::man-common/translation.adoc[]
c6a568fc 67endif::[]