SCSI(8)                 OpenBSD System Manager's Manual                SCSI(8)

NAME
     scsi - program to assist with SCSI devices

SYNOPSIS
     scsi -f device -d debug_level
     scsi -f device [-v] -z seconds
     scsi -f device -m page [-P pc] [-e]
     scsi -f device -p [-b bus] [-l lun]
     scsi -f device -r [-b bus] [-t targ] [-l lun]
     scsi -f device [-v] [-s seconds] -c cmd_fmt [arg ...] -o count out_fmt
          [arg ...] -i count in_fmt

DESCRIPTION
     The scsi program is used to send commands to a SCSI device.  It is also a
     sample usage of the user-level SCSI commands.  out_fmt can be `-' to read
     output data from stdin; in_fmt can be `-' to write input data to stdout.

     The options are as follows:

     -f device
             Specifies the device that should be opened, i.e., /dev/rsd0c.

     -d debug_level
             Sets the SCSI kernel debug level.  The kernel must have been com-
             piled with the SCSIDEBUG option.  See /sys/scsi/scsi_debug.h to
             figure out what to set the kernel debug level to.

     -z seconds
             Freezes all activity on all SCSI busses for a given number of
             seconds.  If -v is also specified, a BEL character is sent to the
             standard output at the start and finish of the bus freeze.  This
             requires that the kernel be built with the SCSI_FREEZE kernel op-
             tion.  This kernel code is not committed yet.

     -m page
             Read a device mode page.  The file /usr/share/misc/scsi_modes is
             read to discover how to interpret the mode data.  The environment
             variable SCSI_MODES can specify a different file to use.

     -P pc   Specify a page control field.  The page control fields are

             0 Current Values
             1 Changeable Values
             2 Default Values
             3 Saved Values

     -e      Permits you to edit the fields.  It will use the editor specified
             by your EDITOR environment variable.  To store changes permanent-
             ly, edit page control 3 using the -P flag.

     -p      Can be used against the "super scsi" device /dev/scsi/super to
             probe all devices with a given SCSI lun on a given SCSI bus.  The
             bus can be selected with the -b option and the default is 0.  The
             lun can be selected with the -l option and the default is 0.  See
             scsi(4) for a description of the "super scsi" device.

     -r      Can be used in FreeBSD 1.1 to reprobe a specific SCSI device at a
             given Bus, Target and Lun.  This is not needed in FreeBSD 2.1,
             since opening a fixed SCSI device has the side effect of reprob-
             ing it, and probing with the bus with the -p option should bring
             on line any newly found devices.  See scsi(4) for a description
             of fixed SCSI devices.



     -c      Permits you to send user-level SCSI commands specified on the
             command line to a device.  The command is sent using the
             SCIOCCOMMAND ioctl, so the device you are accessing must permit
             this ioctl.  See scsi(4) for full details of which minor devices
             permit the ioctl, and scsi(3) for the full details on how to
             build up the commands and data phases using the format arguments.

     -v      Turns on more verbose information.

     -s seconds
             Sets the command timeout to seconds. The default is two seconds.

     -c cmd_fmt
             Specifies the command as described in scsi(3). The additional ar-
             guments provide values for any variables specified in the command
             format.

     -o count out_fmt arg ...
             Indicates that this is a data out command (i.e., data will be
             sent from the system to the device) with count bytes of data.
             The data out is built up using the facilities described in sc-
             si(3) using the provided arguments to fill in any integer vari-
             ables.  out_fmt can be specified as a hyphen (`-') to indicate
             that the count bytes of data should be read from the standard in-
             put.

     -i count in_fmt arg ...
             Indicates that this is a data in command (i.e., data will be read
             from the device into the system) with count bytes of data read
             in.  The information is extracted according to in_fmt using the
             facilities described in scsi(3) and displayed on the standard
             output.  in_fmt can be specified as a hyphen (`-') to indicate
             that the count bytes of data input should be written to the stan-
             dard output.

EXAMPLES
     To verify that the device type for the disk /dev/rsd0c is 0 (direct ac-
     cess device):

     root# scsi -f /dev/rsd0c -c "12 0 0 0 64 0" -i 64 "*b3 b5"
     0

     To do an inquiry to /dev/rsd2c:

     root# scsi -f /dev/rsd2c -c "12 0 0 0 64 0" -i 64 "s8 z8 z16 z4"
     FUJITSU M2654S-512 010P

     To edit mode page 1 on /dev/rsd2c and store it permanently on the
     drive (set AWRE and ARRE to 1 to enable bad block remapping):

     root# scsi -f /dev/rsd2c -m 1 -e -P 3

ENVIRONMENT
     The SU_DEBUG_OUTPUT variable can be set to a file to send debugging out-
     put to that file.

     The SU_DEBUG_LEVEL variable can be set to a non-zero integer to increase
     the level of debugging.  Currently this is a on or off thing; it should
     perhaps use the ioctl to set the debug level in the kernel and then set
     it back to zero at program exit.

     The SU_DEBUG_TRUNCATE variable can be set to an integer to limit the
     amount of data phase output sent to the debugging file.

     The EDITOR variable determines the editor to use for the mode editor.

SEE ALSO
     scsi(3), scsi(4)

BUGS
     Some devices respond to an inquiry for all LUNS.  This will cause them to
     come on line to 8 times during reprobe to different logical units.  "scsi
     -f /dev/rsd0c -c "4 0 0 0 0 0" permits anyone who can write to /dev/rsd0c
     to format the disk drive.

HISTORY
     The scsi command appeared in 386BSD 0.1.2.4/FreeBSD to support the new
     reprobe and user SCSI commands.

OpenBSD 2.9                    October 11, 1993                              3
