SG3UTILS SGRAW(1M)
NAME
sgraw - sends an arbitrary SCSI command (with an optional
data phase) to a device
SYNOPSIS
sgraw [OPTIONS] DEVICE CDB0 CDB1 ...
DESCRIPTION
This utility sends an arbitrary SCSI command (between 6 and
16 bytes) to the DEVICE. For the optional data phase, data
can either be read from a file and sent to the DEVICE or
received from the DEVICE and then displayed or written to a
file.
The SCSI command may be between 6 and 16 bytes long. Each
command byte is specified in plain hex format (00..F)
without a prefix or suffix. See EXAMPLES section below.
The commands pass through a generic SCSI interface which is
implemented for several operating systems including Linux,
FreeBSD and Windows.
OPTIONS
Arguments to long options are mandatory for short options as
well.
-b, --binary
Dump data in binary form, even when writing to stdout.
-h, --help
Display usage information and exit.
-i, --infile=IFILE
Read data from IFILE instead of stdin. This option is
ignored if --send is not specified.
-k, --skip=LEN
Skip the first LEN bytes of the input file or stream.
This option is ignored if --send is not specified.
-n, --nosense
Don't display SCSI Sense information.
-o, --outfile=OFILE
Write data received from the DEVICE to OFILE. The data
is written in binary. By default, data is dumped in hex
format to stdout. If OFILE is '-' then data is dumped
in binary to stdout. This option is ignored if
--request is not specified.
-r, --request=RLEN
Expect to receive up to RLEN bytes of data from the
sg3utils-1.26 Last change: May 2008 1
SG3UTILS SGRAW(1M)
DEVICE. RLEN may be suffixed with 'k' to use kilobytes
(1024 bytes) instead of bytes. This option and --send
are mutually exclusive.
-s, --send=SLEN
Read SLEN bytes of data, either from stdin or from a
file, and send them to the DEVICE. This option and
--request are mutually exclusive.
-t, --timeout=SEC
Wait up to SEC seconds for command completion (default:
20). Note that if a command times out the operating
system may start by aborting the command and if that is
unsuccessful it may attempt to reset the device.
-v, --verbose
Increase level of verbosity. Can be used multiple
times.
-V, --version
Display version and license information and exit.
EXAMPLES
sgraw /dev/scd0 1b 00 00 00 02 00
Eject the medium in CD drive /dev/scd0.
sgraw -r 1k /dev/sg0 12 00 00 00 60 00
Perform an INQUIRY on /dev/sg0 and dump the response
data (up to 1024 bytes) to stdout.
sgraw -s 512 -i i512.bin /dev/sda 3b 02 00 00 00 00 00 02 00 00
Showing an example of writing 512 bytes to a sector on
a disk is a little dangerous. Instead this example will
read i512.bin (assumed to be 512 bytes long) and use
the SCSI WRITE BUFER command to send it to the "data"
buffer (that is mode 2). This is a safe operation.
sgraw -r 512 -o o512.bin /dev/sda 3c 02 00 00 00 00 00 02 00 00
This will use the SCSI READ BUFER command to read 512
bytes from the "data" buffer (i.e. mode 2) then write
it to the o512.bin file. When used in conjunction with
the previous example, if both commands work then 'cmp
i512.bin o512.bin' should show a match.
EXIT STATUS
The exit status of sgraw is 0 when it is successful. Other-
wise see the sg3utils(1M) man page.
AUTHOR
Written by Ingo van Lil
sg3utils-1.26 Last change: May 2008 2
SG3UTILS SGRAW(1M)
REPORTING BUGS
Report bugs to .
COPYRIGHT
Copyright O 2001-2008 Ingo van Lil
This software is distributed under the GPL version 2. There
is NO warranty; not even for MERCHANTABILITY or FITNES FOR
A PARTICULAR PURPOSE.
SEE ALSO
sgopcodes sgvpd(sg3utils), hdparm(hdparm),
sgdiag(scsirastools)
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWsg3utilsu
Interface Stability Committed
NOTES
Source for sg3utils is available on http:/opensolaris.org.
sg3utils-1.26 Last change: May 2008 3
|