|SCSI(8)||System Manager's Manual||SCSI(8)|
scsiprogram 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:
SCIOCCOMMANDioctl(2), so the device being accessed must permit this ioctl. See scsi(4) for full details of which minor devices permit the ioctl.
SCSIDEBUGoption. See /sys/scsi/scsi_debug.h to figure out what to set the kernel debug level to.
EDITORenvironment variable. To store changes permanently, edit page control 3 using the
-icount in_fmt [
-’) to indicate that count bytes of data input should be written to standard output.
SCSI_MODEScan specify a different file to use.
-ocount out_fmt [
-’) to indicate that count bytes of data should be read from standard input.
0 Current Values 1 Changeable Values 2 Default Values 3 Saved Values
-ciooptions specify the command data buffer used to both send and receive information to and from the scsi(4) subsystem. Their format is:
-ccommand [argument ...]
scsicommand be used as the value of the field. Direct hexadecimal (
0-FF) or decimal (0-255) values may be specified. The special value
vcan 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
t, or in bytes by prefixing it with
i. Additionally, character arrays can be specified by prefixing with
cor, 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
ifield is next.
ifields indicate a 1-4 byte integral value that must already be given in SCSI byte order (most significant byte first). Otherwise, the field value specified will be swapped into SCSI byte order. Retrieving data (with
-i) follows similarly but without field values. Besides 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
scharacter 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
0x1Afollowed by another one-byte field with the decimal value 2.
scsiutility exits 0 on success, and >0 if an error occurs. /dev/rsd0c is 0 (direct access device):
# scsi -f /dev/rsd0c -c "12 0 0 0 64 0" -i 0x64 "*b3 b5" 0
# scsi -f /dev/rsd2c -c "12 0 0 0 64 0" -i 0x64 "s8 z8 z16 z4" FUJITSU M2654S-512 010P
# scsi -f /dev/rsd2c -c "1b 0 0 0 0 0"
# scsi -f /dev/rsd2c -m 1 -e -P 3
scsicommand appeared in 386BSD 0.1.2.4/FreeBSD to support the new reprobe and user SCSI commands.
scsi -f /dev/rsd0c -c "4 0 0 0 0 0"permits anyone who can write to /dev/rsd0c to format the disk drive.
|February 28, 2015||OpenBSD-6.1|