rawのヘルプ・マニュアル
日本語 英語
raw --help
man raw
RAW(8) RAW(8)
名前
raw - Linux raw キャラクタデバイスをバインドする
書式
raw /dev/raw/raw
raw /dev/raw/raw /dev/
raw -q /dev/raw/raw
raw -qa
説明
raw は Linux raw キャラクタデバイスをブロックデバイスにバインドするため
に用いられる。どんなブロックデバイスでも利用できる。またバインドする 時
に デバイスドライバがアクセス可能でなくてもかまわない (つまりオンデマン
ドでロードされるカーネルモジュールであってもかまわない)。
raw の利用法には 2 つのモードがある。一つは raw デバイスのバインドを 設
定 する動作であり、もう一つは存在しているバインドに対する問合わせをする
動作である。 raw デバイスの設定をするときは、 /dev/raw/raw はファ イ
ルシステム中に存在している raw デバイスのノードのデバイス名である。バイ
ンド先のブロックデバイスは、 major と minor 番号で示しても良いし、存 在
しているブロックデバイスファイルのパス名 /dev/ で示しても良い
。
既に存在しているバインドに対して、 -q オプションによって問合わせを行 う
ことができる。この際には、問合わせる raw デバイスのファイル名を指定して
も良いし、 -a オプションを用いればバインド済みの全ての raw デバイスが対
象となる。
major と minor を 0 に指定することにより、アンバインドすることができる
。
いったん raw デバイスをブロックデバイスにバインドすると、その raw デ バ
イスはバインド先のブロックデバイスと同じようにオープンしたり read/write
できる。しかし raw デバイスの動作はブロックデバイスと全く同じではない。
特に違う点としては、 raw デバイスへのアクセスは、カーネルのブロックバッ
ファキャッシュを全く用いない。全ての I/O は、その I/O を行ったプロセ ス
の アドレス空間に対して直に行われる。もし下層にあるブロックデバイスドラ
イバが DMA をサポートしていると、データコピーを全く行わなくても I/O を
完了することができる。
raw I/O では、プロセスのアドレス空間が割り付けられた物理メモリに直接的
なハードウェアアクセスを行うので、例外的な制限がいくつか存在する。全 て
の I/O はメモリやディスク上で正しくアラインされていなければならない。す
なわちディスク上のセクタ先頭から始まり、セクタ長の整数倍で、かつ仮想 メ
モ リ上のデータバッファもセクタ長の整数倍でなければならない。ほとんどの
デバイスでは、セクタのサイズは 512 バイトである。
オプション
-q 問合わせモード。 raw は新たなバインドを設定する代わりに、既存 の
バインドに対する問合わせを行う。
-a -q オプションとともに用い、既存のバインド済み raw デバイスすべて
に対して問合わせを行う。
-h 使用方法の要約を表示する。
バグ
Linux の dd(1) コマンドは、現在のところバッファを正しくアラインしない。
したがって raw デバイスには用いることができない。
raw I/O デバイスは、 Linux ブロックデバイスのバッファキャッシュとのキャ
ッシュの整合性を管理しない。バッファキャッシュに既に存在するデ ー タ を
raw I/O を用いて上書きすると、そのバッファキャッシュの指す記憶装置のデ
バイスの実際の内容との不整合が発生する。これは恣意的なものであるが、 質
問した人によって、回答はバグであったり仕様であったりするだろう!
著者
Stephen Tweedie (sct@redhat.com)
Version 0.1 Aug 1999 RAW(8)
RAW(8) RAW(8)
NAME
raw - bind a Linux raw character device
SYNOPSIS
raw /dev/raw/raw
raw /dev/raw/raw /dev/
raw -q /dev/raw/raw
raw -qa
DESCRIPTION
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).
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
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/ to an existing block device file.
The bindings already in existence can be queried with the -q option,
with is used either with a raw device filename to query that one
device, or with the -a option to query all bound raw devices.
Unbinding can be done by specifying major and minor 0.
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.
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.
OPTIONS
-q Set query mode. raw will query an existing binding instead of
setting a new one.
-a With -q , specifies that all bound raw devices should be
queried.
-h provides a usage summary.
BUGS
The Linux dd (1) command should be used without 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).
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!
AUTHOR
Stephen Tweedie (sct@redhat.com)
AVAILABILITY
The raw command is part of the util-linux-ng package and is available
from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
Version 0.1 Aug 1999 RAW(8)