dks(7M) dks(7M)
NAME
dks, jag - dksc (SCSI) disk driver
SYNOPSIS
/dev/dsk/dks*
/dev/rdsk/dks*
DESCRIPTION
There can be up to seven SCSI drives attached per SCSI bus (15 for
controllers that support wide SCSI), each of which can support a number
of logical units (luns). The current limit is eight luns. 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):
/dev/rdsk/dkscontroller-#ddrive-#{spartition-#|vh|vol}
/dev/rdsk/dkscontroller-#ddrive-#llun-#{spartition-#|vh|vol}
/dev/dsk/dkscontroller-#ddrive-#spartition-#
/dev/dsk/dkscontroller-#ddrive-#llun-#spartition-#
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. spartition-#, vh, and vol indicate a
partition of the disk. The vh and vol devices are only in the rdsk
directory, since they are 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 removeable media devices, mediad(1M), if running, will cause these
updates to occur after media changes. In the absense of mediad, the user
will need to run code or execute commands that will cause an open against
Page 1
dks(7M) dks(7M)
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 SCSIDEVICENAMESIZE 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
Page 2
dks(7M) dks(7M)
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
Page 3
dks(7M) dks(7M)
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.
FILES
/dev/dsk/dks*
/dev/rdsk/dks*
/dev/root
/dev/usr
/dev/swap
SEE ALSO
dvhtool(1M), fx(1M), prtvtoc(1M), scsiha(1M), ioconfig(1M).
Page 4