Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
RAW(8)			    System Manager's Manual			RAW(8)

       raw - bind a Linux raw character	device

       raw /dev/raw/raw_N_ _major_ _minor_

       raw /dev/raw/raw_N_ /dev/_blockdev_

       raw -q /dev/raw/raw_N_

       raw -qa

       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_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.

       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  de-
       vice, or	with the -a option to query all	bound raw devices.

       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  en-
       tirely:	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

       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.

       Use  the	/etc/sysconfig/rawdevices file to define the set of raw	device
       mappings	automatically created during the system	startup	sequence.  The
       format of the file is the same used in the command line with the	excep-
       tion that the "raw" command itself is omitted.

       -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

       -h     provides a usage summary.

       The Linux dd (1)	command	does not  currently  align  its	 buffers  cor-
       rectly, and so cannot be	used on	raw devices.

       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!

       Stephen Tweedie (

Version	0.1			   Aug 1999				RAW(8)


Want to link to this manual page? Use this URL:

home | help