MirOS Manual: scsi(8)

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


     scsi - program to assist with SCSI devices


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


     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:

     -c cmd_fmt [arg ...]
             Send a user-level SCSI command to a device. The command format is
             described below and the command is sent using the SCIOCCOMMAND
             ioctl(2), so the device being accessed must permit this ioctl.
             See scsi(4) for full details of which minor devices permit the

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

     -e      Permits edit of the fields. It will use the editor specified by
             the EDITOR environment variable. To store changes permanently,
             edit page control 3 using the -P flag.

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

     -i count in_fmt [arg ...]
             Indicates that this is an input 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 and is
             displayed on standard output. in_fmt can be specified as a hyphen
             ('-') to indicate that count bytes of data input should be writ-
             ten to standard output.

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

     -o count out_fmt [arg ...]
             Indicates that this is an output command (i.e., data will be sent
             from the system to the device) with count bytes of data. The data
             is built up using the provided arguments to fill in any integer
             variables. out_fmt can be specified as a hyphen ('-') to indicate
             that count bytes of data should be read from standard input.

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

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

     -r      Reprobe a specific SCSI device at a given bus, target, and lun.
             This is not needed since opening a fixed SCSI device has the side
             effect of reprobing it. See scsi(4) for a description of fixed
             SCSI devices.

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

     -v      Turns on more verbose information.

SCSI commands

     The command arguments to the -cio options specify the command data buffer
     used to both send and receive information to and from the scsi(4) subsys-
     tem. Their format is:

           -c command [argument ...]

     The commands are composed of a list of field specifiers. The specifiers
     denote the field name, the field value, and the length of the field. Ex-
     amples are given below.

     Whitespace and text following a '#' character in the command string are

     The first part of a field specifier is the field name and is surrounded
     by curly braces ('{}'). This part is optional and may be left out.

     The second part is the value of the field. The value may be given direct-
     ly or may arrange that the next argument to the scsi command be used as
     the value of the field. Direct hexadecimal (0-FF) or decimal (0-255)
     values may be specified. The special value v can be used to arrange that
     the next integer argument be taken from the argument list. For retrieving
     output (with -i), this part of the field cannot be used.

     The third part specifies the length of the field. This is optional and
     defaults to one byte if not specified. The length may be specified in
     bits by prefixing it with b or t, or in bytes by prefixing it with i. Ad-
     ditionally, character arrays can be specified by prefixing with c or,
     with zeroed trailing spaces, with z. Bits are packed together tightly and
     begin with the high bit. New bytes are started when a byte fills or an i
     field is next. i fields indicate a 1-4 byte integral value that must al-
     ready be given in SCSI byte order (most significant byte first). Other-
     wise, the field value specified will be swapped into SCSI byte order.

     Retrieving data (with -i) follows similarly but without field values. Be-
     sides field specifiers, the command can also include control operations,
     which currently includes seeking operations used to ignore returned data.
     Seek operations are composed of the s character followed by the absolute
     position to skip to. If the position is prefixed with a +, the position
     is interpreted relative to the current position.

     Entire fields can be suppressed from being returned with the * modifier
     prepended to the field width.

     Here are some examples:

     s8 z8 z16 z4
          Seek to position 8 and specify three fields of lengths 8 bytes, 16
          bytes, and 4 bytes.

     1A 2
          Specify a one-byte field with the hexadecimal value 0x1A followed by
          another one-byte field with the decimal value 2.

          Specify a one-byte field whose value will be determined from the
          next argument in the argument list.

     0:7  Specify a 7-bit field with a value of zero.

     *b3 b5
          Specify a three-bit field that will be suppressed from being re-
          turned and a five-bit field that will be returned.


     SU_DEBUG_OUTPUT    This variable can be set to a file to send debugging
                        output to that file.

     SU_DEBUG_LEVEL     This variable can be set to a non-zero integer to in-
                        crease the level of debugging. Currently this is an 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.

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

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




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

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

     To do an inquiry to /dev/rsd2c:

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

     To spin down /dev/rsd2c:

           # scsi -f /dev/rsd2c -c "1b 0 0 0 0 0"

     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):

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


     ioctl(2), scsi(4)


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


     Some devices respond to an inquiry for all LUNs. This will cause them to
     come online up 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.

MirOS BSD #10-current          October 11, 1993                              2

Generated on 2017-04-03 16:26:17 by $MirOS: src/scripts/roff2htm,v 1.88 2017/01/29 00:51:06 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002–2017 The MirOS Project, Germany.
This product includes material provided by mirabilos.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.