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

FreeBSD Manual Pages


home | help
disk(7)		       Miscellaneous Information Manual		       disk(7)

       disk - direct disk access

       This  entry  describes the actions of HP-UX disk	drivers	when referring
       to a disk as either a block-special or character-special	(raw) device.

   Device File Naming Conventions
       Standard	disk device files are named according to the following conven-

	      Block-mode Devices

	      Character-mode Devices

       where component parts of	the filename are constructed as	follows:

		      Identifies the following hexadecimal digits as the ``In-
		      stance'' of the interface	card.

	      x	      Hexadecimal number identifying  controlling  bus	inter-
		      face,  also  known as the	``Instance'' of	this interface
		      card. The	instance value is displayed in the  ioscan(1M)
		      output, column ``I'' for the H/W Type, ``INTERFACE''.

	      Identifies  the  following  hexadecimal digits as	a ``drive num-
		      or ``target''.

	      y	      Hexadecimal number identifying the drive or target  num-
		      ber (bus address).

	      Identifies  the  following  hexadecimal  digits as a ``unit num-

	      n	      Hexadecimal unit number within the device.

	      Optional.	 Defaults to that corresponding	to whole disk.
		      Identifies the following value as	a ``section number''.

	      m	      Required if is specified.	 Defaults to section 0 (zero),
		      whole disk.  Drive section number.

       Assignment  of  controller,  drive, logical unit	and section numbers is
       described in the	system administrator manuals for your system.

   Block-special access
       Block-special device files access disks via the system's	 block	buffer
       cache  mechanism.   Buffering is	done in	such a way that	concurrent ac-
       cess through multiple opens and mounting	the same  physical  device  is
       correctly handled to avoid operation sequencing errors.	The block buf-
       fer cache permits the system to do physical I/O operations when	conve-
       nient.	This  means  that physical write operations may	occur substan-
       tially later in time than their corresponding logical  write  requests.
       This  also  means that physical read operations may occur substantially
       earlier in time than their corresponding	logical	read requests.

       Block-special files can be read and written without regard to  physical
       disk  records.	Block-special file and calls requiring disk access re-
       sult in one or more byte	(typically 2048	byte)  transfers  between  the
       disk  and the block buffer cache.  Applications using the block-special
       device should ensure that they do not read or write  past  the  end  of
       last  sized  block  in  the  device  file.   Because  the  interface is
       buffered, accesses past this point behave unpredictably.

   Character-special access
       Character-special device	files access disks without buffering and  sup-
       port  the  direct  transmission of data between the disk	and the	user's
       read or write buffer.  Disk access through the character	 special  file
       interface  causes  all  physical	 I/O operations	to be completed	before
       control returns from the	call.  A single	read or	write operation	up  to
       bytes  (typically  64 Kbytes or 256 Kbytes) results in exactly one disk
       operation.  Requests larger than	this are broken	 up  automatically  by
       the operating system.  Since large I/O operations via character-special
       files avoid block buffer	cache handling and result in fewer disk	opera-
       tions,  they  are  typically  more efficient than similar block-special
       file operations.

       There may be implementation-dependent restrictions on the alignment  of
       the  user buffer	in memory for character	special	file and calls.	 Also,
       each read and write operation must begin	and end	 on  a	logical	 block
       boundary	 and  must  be	a whole	number of logical blocks in size.  The
       logical block size is a hardware-dependent value	that  can  be  queried
       with the	ioctl call, which is described below.

       In addition to reading and writing data,	the character-special file in-
       terface can used	to obtain device specific information and  to  perform
       special	operations.   These  operations	 are controlled	through	use of
       ioctl calls.  Details related to	these ioctls are contained in

       The ioctl can be	used to	obtain device specific identification informa-
       tion.   The  information	returned includes the disk's model identifica-
       tion, the disk interface	type, and the disk's logical block size.

       The ioctl can be	used to	obtain the capacity of a disk device in	units.
       is defined in

       The  ioctl can be used to obtain	and release exclusive access to	a disk
       device.	Exclusive access is required for some special operations, such
       as  media  reformatting,	 and  may be desirable in other	circumstances.
       The value one specifies that exclusive access is	requested.  The	 value
       zero  specifies the exclusive access should be released.	 Exclusive ac-
       cess causes other open requests to fail.	 Exclusive access can only  be
       granted when the	device is not currently	opened in block-mode and there
       is only one open	file table entry for that disk device (the one	acces-
       sible to	the exclusive access requester).

       The following errors can	be returned by a disk device driver call:

	      [EACCES]	     Required  permission is denied for	the the	device
			     or	operation.

	      [ENXIO]	     If	resulting from an call,	this  indicates	 there
			     is	no device at the specified address.  For other
			     calls, this indicates the	specified  address  is
			     out  of  range or the device can no longer	be ac-

	      [EINVAL]	     From an call: the device is not  a	 disk  device.
			     For other calls: Invalid request or parameter.

	      [EIO]	     I/O  error	(e.g., media defect or device communi-
			     cation problem).

       The interaction of block-special	and character-special file  access  to
       the  same  -sized  block	 is  not  specified,  and in general is	unpre-

       On some systems,	having both a mounted file system and a	block  special
       file  open  on  the  same  device can cause unpredictable results; this
       should be avoided if possible.  This is because it may be possible  for
       some files to have private buffers in some systems.

       Although	 disk devices have historically	had small (typically 512-byte)
       block sizes, some disk devices (such as optical disks and disk  arrays)
       have  relatively	large block sizes.  Applications using direct raw disk
       access should use calls to determine appropriate	 I/O  operation	 sizes
       and alignments.

       Any  disk with removable	media (for example, floppy or CD-ROM) contain-
       ing a mounted file system should	not be	removed	 prior	to  being  un-
       mounted.	  Removal  of  disk  media  containing mounted file systems is
       likely to result	in file	system errors and system panics.

	    Devices whose logical block	size is	less than must be accessed  on
	    boundaries	and  with  transfer  sizes  that are multiples of Disk
	    ``sections'' 0 (zero) and 2	(two) have exchanged meanings with HP-
	    UX Release 10.0 and	beyond.	 Whole disk is section 0.

       was developed by	HP and AT&T.

       mknod(1M), intro(7), ioscan(1M).

       System Administrator manuals included with your system.



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

home | help