aboutsummaryrefslogtreecommitdiff
path: root/sg_test_rwbuf.8
blob: 08b12d8e3bfb71eb4a06da041e2a5a18d73cd7a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.TH SG_TEST_RWBUF "8" "June 2006" "sg3_utils-1.21" SG3_UTILS
.SH NAME
sg_test_rwbuf \- Tests the SCSI host adapter by issuing write and read 
operations on a device's buffer and calculating checksums.
.SH SYNOPSIS
.B sg_test_rwbuf
[\fI--addrd=<n>\fR] [\fI--addwr=<n>\fR] [\fI--help\fR]
[\fI--quick\fR] \fI--size=<sz>\fR [\fI--times=<n>\fR] [\fI--verbose\fR]
[\fI--version\fR] \fI<scsi_device>\fR
.br
or (an older deprecated format)
.br
.B sg_test_rwbuf
\fI<scsi_device>\fR \fI<sz>\fR [\fI<addwr>\fR] [\fI<addrd>\fR]
.SH DESCRIPTION
.\" Add any additional description here
.PP
sg_test_rwbuf writes and reads back sz bytes to the internal buffer of
<\fIscsi_device\fR> (e.g. /dev/sda or /dev/sg0). A pseudo random pattern is
written to the data buffer on the device then read back. If the same pattern
is found 'Success' is reported. If they do not match (checksums unequal) then
this is reported and up to 24 bytes from the first point of mismatch are
reported; the first line shows what was written and the second line shows
what was received. For testing purposes, you can ask it to write <addwr> or
read <addrd> additional bytes.
.TP
--addrd=<n> | -r <n>
Read an additional <n> bytes (than indicated by <sz>) from the data buffer.
Checksum is performed over the first <sz> bytes.
.TP
--addwr=<n> | -w <n>
Write an additional <n> bytes (than indicated by <sz>) of zeroes into the
data buffer.  Checksum is generated over the first <sz> bytes.
.TP
--help | -h
Print out a usage message the exit.
.TP
--quick | -q
Perform a READ BUFFER descriptor command to find out the available data
buffer length and offset, print them out then exit (without testing
with write/read sequences).
.TP
--size=<sz> | -s <sz>
Size of buffer in bytes to be written then read and checked. This number
needs to be less than on equal to the size of the device's data buffer
which can be seen from the '--quick' option. Either this option or
the '--quick' option should be given.
.TP
--times=<n> | -t <n>
Number of times to repeat the write/read to buffer test. Default value
is 1 .
.TP
--verbose | -v
increase verbosity of output.
.TP
--version | -V
print version number (and data of last change) then exit.
.PP
The microcode in a SCSI device is _not_ modified by doing a WRITE BUFFER
command with its mode set to "data" (0x2) as done by this utility. Therefore
this utility is safe in that respect. [Mode values 0x4, 0x5, 0x6 and 0x7
are the dangerous ones :-)]
.PP
\fBWARNING\fR: If you access the device at the same time (e.g. because it's
a hard disk with a mounted file system on it) the device's buffer may be
used by the device itself for other data at the same time, and overwriting
it may or may not cause data corruption! \fBHOWEVER\fR the SPC-3 draft
standard does state in its WRITE BUFFER command: "This command shall not
alter any medium of the logical unit when data mode ... is specified". This
implies that it _is_ safe to use this utility with devices that have mounted
file systems on them.
Following this theme further, a disk with active mounted file systems may cause
the data read back to be different (due to caching activity) to what was written
and hence a checksum error.
.SH EXIT STATUS
The exit status of sg_test_rwbuf is 0 when it is successful. Otherwise see
the sg3_utils(8) man page.
.SH AUTHORS
Written by D. Gilbert and K. Garloff
.SH COPYRIGHT
Copyright \(co 2000-2005 Douglas Gilbert, Kurt Garloff
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.