dks(7M)                                                                dks(7M)


NAME
     dks - dksc (SCSI) disk driver

SYNOPSIS
     /dev/dsk/dks*
     /dev/rdsk/dks*
     /dev/dsk/nodename/lun*/c*p*
     /dev/rdsk/nodename/lun*/c*p*

DESCRIPTION
     The dksc driver supports all disk types that use a SCSI command set.
     This includes traditional parallel SCSI, Fibre Channel Arbitrated Loop,
     Fibre Channel Fabric devices (devices connected through a Fibre Channel
     switch), and SBP-2 devices.

     Currently, 8 bit parallel SCSI (also called narrow SCSI) allows up to
     seven SCSI drives attached per SCSI bus, 16 bit parallel SCSI (also
     called wide SCSI) allows 15 drives.  Serial Bus Protocol 2 (SBP-2) allows
     up to 63 drives.  Fibre Channel Arbitrated Loop (FC-AL) allows up to 125
     drives (some implementations limit the number to 110).  The maximum
     number addressable through Fibre Channel Fabric has no theoretical limit.
     However, practical considerations do limit the number to 252 drives for
     current adapters.  Each drive (a RAID controller is considered a "drive"
     for these purposes) can support a number of logical units (luns).  The
     current limit depends on the host adapter.  It varies from 8 to 255.
     Each unit (or lun) can have up to 16 partitions in use, three of which
     (8, 9, and 10) are special (see below).

     Disk devices are named according to the following formats (jaguar drives
     are no longer supported):

     Parallel SCSI and FC-AL

          /dev/rdsk/dkscontroller#ddrive#{spartition#|vh|vol}
          /dev/rdsk/dkscontroller#ddrive#llun#{spartition#|vh|vol}
          /dev/dsk/dkscontroller#ddrive#{spartition#|vol}
          /dev/dsk/dkscontroller#ddrive#llun#{spartition#|vol}


     Fibre Channel Fabric

          /dev/rdsk/nodename/lunlun#{spartition#|vh|vol}/ccontroller#pport#
          /dev/dsk/nodename/lunlun#spartition#/ccontroller#pport#


     SBP-2

          /dev/rdsk/1394/nodeID/lunlun#{spartition#|vh|vol}/ccontroller#pport#
          /dev/dsk/1394/nodeID/lunlun#spartition#/ccontroller#pport#

     Note that the Fabric and SBP-2 device names always specify the lun#, even
     if it is zero.  The rdsk devices use a raw interface to communicate with


     the disk, while the dsk devices use a block interface.  The controller#,
     drive#, and lun# are used to indicate SCSI controller number, target ID,
     and logical unit number, respectively.  The nodename and port# are used
     to indicate the Fibre Channel world wide name (WWN) and the device port
     number (normal Fibre Channel disks have two ports).  The nodeID and port#
     are used to indicate the 1394 GUID of the SBP-2 device and the device
     port number which is always 0.  spartition#, vh, and vol indicate a
     partition of the disk.  The vh device is only found in the rdsk
     directory, since it is normally used only for ioctl and raw access.

     The standard partition allocation by Silicon Graphics has root on
     partition 0, swap on partition 1, and (optionally) /usr on partition 6.
     Some systems, such as the Indy, are shipped from the factory with a
     single filesystem on the system disk for ease of administration.  In this
     case, partition 6 is not used.  Partition 7 (when present), normally maps
     the entire usable portion of the disk (excluding the volume header).
     Partition 8 (vh) maps the volume header (see prtvtoc(1M), dvhtool(1M)).
     Partition 10 (vol) maps the entire drive.  Partition 9 is reserved, but
     is not used for disks with the dksc driver.

     In current releases, these devices are part of the hardware graph
     hwgfs(4), and are created dynamically as the disk partitions are changed.
     Therefore MAKEDEV no longer needs to be run, nor does it need to be
     modified to create additional partition devices.  The partitions will be
     created/updated whenever a disk is opened, such as when a filesystem is
     mounted, or when programs such as fx(1M) and prtvtoc(1M) access the disk.
     For devices that are hot-plugged, the bus that they are plugged into must
     be reprobed and reconfigured (see scsiha(1m) and ioconfig(1M)) in order
     for the partitions to be created.

     For removable media devices, mediad(1M), if running, will cause these
     updates to occur after media changes. In the absence of mediad, the user
     will need to run code or execute commands that will cause an open against
     the volume header. fx(1M) or prtvtoc(1M) are two examples of commands
     that will do this, as well as the DIOCGETVH ioctl (see below) issued by a
     program.

     The standard configuration has /dev/root linked to partition 0 of the
     system disk, with /dev/swap linked to partition 1 of the system disk, and
     /dev/usr linked to partition 6 of the system disk.  Systems that do not
     use partition 6 as shipped, instead using just the s0 and s1 partitions,
     still have a link made.  There is no attempt to make the link to the
     device used for the /usr filesystem in the fstab(4) file, if present,
     even if it uses a different device.  Option disks normally use the s7
     partition as a single filesystem, containing the whole usable portion of
     the disk.

IOCTL FUNCTIONS
     As well as normal read and write operations, the driver supports a number
     of special ioctl(2) operations when opened via the character special file
     in /dev/rdsk.  Command values for these are defined in the system include
     file <sys/dkio.h>, with data structures in <sys/dksc.h>.


     These ioctl operations are intended for the use of special-purpose disk
     utilities.  Many of them can have drastic or even fatal effects on disk
     operation if misused; they should be invoked only by the knowledgeable
     and with extreme caution!

     A list of the ioctl commands supported by the dks driver is given below.

     DIOCADDBB
          Adds a block to the badblock list.  The argument is the logical
          block number (not a pointer) on the drive.  For some makes of
          drives, the spared block must be written before the sparing takes
          effect.  Only programs running with superuser permissions can use
          this ioctl.

     DIOCDRIVETYPE
          The first SCSI_DEVICE_NAME_SIZE bytes (currently 28) of the SCSI
          inquiry data for the drive is returned to the caller.  The argument
          is a pointer to a char array of at least this size.  This contains
          vendor and drive specific information such as the drive name and
          model number.  See a SCSI command specification for details on the
          structure of this buffer.

     DIOCFORMAT
          Formats the entire drive.  Any information on the drive is lost.
          The grown defect list (blocks spared with DIOCADDBB) is empty after
          formatting is complete, blocks previously in the grown defect list
          are no longer spared.

     DIOCGETVH
          Reads the disk volume header from the driver into a buffer in the
          calling program.  The argument in the ioctl call must point to a
          buffer of size at least 512 bytes.  The structure of the volume
          header is defined in the include file <sys/dvh.h>.  The
          corresponding call DIOCSETVH sets the drivers idea of the volume
          header; in particular, the drivers idea of the partition sizes and
          offsets is changed.

     DIOCPREVREM
          Issues a PREVENT ALLOW MEDIA REMOVAL command to the opened device.
          The first bit of the arg is or'd into byte 4 of the SCSI command.
          See a SCSI command specification for details on this command.

     DIOCRDEFECTS
          The argument is a pointer to a struct dk_ioctl_data.  The i_addr
          field points to a structure like:


               structure defect_list {
                    struct defect_header defhdr;
                    struct defect_entry defentry[NENTS];
               };


          The i_len field is set to the total length of the structure, which
          must be less than NBPP from <sys/param.h>; at most NENTS defects are
          returned.  The actual number of defects can be determined by
          examining the defhdr.defect_listlen value, which is the number of
          bytes returned.  This must be divided by the size of the applicable
          data structure for the type requested.  The i_page field should be
          set to the bits identifying the badblock reporting type.  These bits
          request the combination of manufacturer's and grown defects; and one
          of bytes from index, physical cyl/head/sec, vendor unique.  The only
          combination that works with all currently supported SCSI disks is
          type cyl/head/sec; and either combined manufacturer's and grown
          defects, or just manufacturer's defects.

     DIOCREADCAPACITY
          The arg is a pointer to an unsigned integer.  The value returned is
          the number of usable sectors on the drive (as read from the drive).

     DIOCSCSIINQ
          The arg is a pointer to a char array at least SCSI_INQUIRY_LEN bytes
          long.  The SCSI inquiry data from the device is copied to this
          buffer.  See a SCSI command specification for details on the
          structure of this buffer.

     DIOCSENSE / DIOCSELECT
          The argument is a pointer to a struct dk_ioctl_data.  This allows
          sending SELECT and SENSE commands to the drive.  See the ANSI SCSI
          specification and individual manufacturer's manuals for allowed page
          numbers and valid values.  Only programs running with superuser
          permissions can use the DIOCSELECT ioctl.

     DIOCSTARTSTOP
          This command issues a SCSI STARTSTOP command to the opened device.
          The first two bits of the arg are or'd into byte 4 of the SCSI
          command.  See a SCSI command specification for details on this
          command.

     DIOCTEST
          issues the SCSI "Send Diagnostic" command to the drive.  The exact
          tests done are manufacturer specific.  The ioctl call returns 0 upon
          success, or sets errno to EIO and returns -1 upon failure.

NOTES
     Fibre Channel fabric device names are meant to separate three concepts;
     device specification, portion of device, and path to device.  Thus the
     nodename specifies a unique device, such as a disk drive or a RAID
     controller.  The lun# and partition# specify which portion of the disk or
     RAID is accesses, and the controller# and port# specify the path the data
     and commands travel to and from the device.  The port number will usually
     be something that represents the difference between the 64 bit world wide
     node name and the 64 bit world wide port name.  For non-SGI devices, and
     some SGI devices that were released after a given release of IRIX, the
     driver may not be able to determine a short port number.  In such cases,


     the port number will be the 64 bit world wide port name.

FILES
     /dev/dsk/dks*
     /dev/rdsk/dks*
     /dev/dsk/*/lun*/c*p*
     /dev/rdsk/*/lun*/c*p*
     /dev/root
     /dev/usr
     /dev/swap

SEE ALSO
     dvhtool(1M), fx(1M), prtvtoc(1M), scsiha(1M), ioconfig(1M).


                                                                        Page 5