LinuxCommandLibrary

raw

Bind raw character devices to block devices

TLDR

Bind a raw character device to a block device

$ raw /dev/raw/raw1 /dev/block_device
copy
Query an existing binding
$ raw /dev/raw/raw1
copy
Query all bound raw devices
$ raw -qa
copy

SYNOPSIS

raw /dev/raw/rawN major minor
raw /dev/raw/rawN /dev/blockdev
raw -q [-a] [rawN]

DESCRIPTION

raw binds Linux raw character devices to block devices, allowing direct (unbuffered) I/O access to the underlying storage. Raw devices bypass the kernel's buffer cache, providing direct access to block devices for applications that manage their own caching (like databases).
When a raw device is bound to a block device, reading and writing to the raw device performs synchronous, direct I/O to the underlying storage without kernel buffering.

PARAMETERS

/dev/raw/rawN

Raw device node to bind or query
-q, --query
Query binding for specified raw device
-a, --all
Query all raw devices (with -q)
major minor
Block device specified by major/minor numbers
/dev/blockdev
Block device path to bind to raw device

CAVEATS

Raw devices are largely deprecated in favor of O_DIRECT flag on regular file I/O. Requires the raw driver to be loaded (modprobe raw). Raw device nodes must exist in /dev/raw/ before binding. Only root can bind raw devices.

HISTORY

Raw devices were introduced in Linux 2.4 to support databases like Oracle that required unbuffered I/O. The O_DIRECT flag added in later kernels provides similar functionality without dedicated raw devices, making this interface largely obsolete.

SEE ALSO

losetup(8), dd(1), blockdev(8)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community