1SG_TEST_RWBUF(8) SG3_UTILS SG_TEST_RWBUF(8)
2
3
4
6 sg_test_rwbuf - Tests the SCSI host adapter by issuing write and read
7 operations on a device's buffer and calculating checksums.
8
10 sg_test_rwbuf [--addrd=AR] [--addwr=AW] [--help] [--quick] --size=SZ
11 [--times=NUM] [--verbose] [--version] DEVICE
12
13 or an older deprecated format sg_test_rwbuf DEVICE SZ [AW] [AR]
14
16 sg_test_rwbuf writes and reads back SZ bytes to the internal buffer of
17 DEVICE (e.g. /dev/sda or /dev/sg0). A pseudo random pattern is written
18 to the data buffer on the device then read back. If the same pattern is
19 found 'Success' is reported. If they do not match (checksums unequal)
20 then this is reported and up to 24 bytes from the first point of mis‐
21 match are reported; the first line shows what was written and the sec‐
22 ond line shows what was received. For testing purposes, you can ask it
23 to write AW or read AR additional bytes.
24
26 Arguments to long options are mandatory for short options as well.
27
28 -r, --addrd=AR
29 Read an additional AR bytes (than indicated by SZ) from the data
30 buffer. Checksum is performed over the first SZ bytes.
31
32 -w, --addwr=AW
33 Write an additional AW bytes (than indicated by SZ) of zeros
34 into the data buffer. Checksum is generated over the first SZ
35 bytes.
36
37 -h, --help
38 Print out a usage message the exit.
39
40 -q, --quick
41 Perform a READ BUFFER descriptor command to find out the avail‐
42 able data buffer length and offset, print them out then exit
43 (without testing with write/read sequences).
44
45 -s, --size=SZ
46 where SZis teh size of buffer in bytes to be written then read
47 and checked. This number needs to be less than on equal to the
48 size of the device's data buffer which can be seen from the
49 --quick option. Either this option or the --quick option should
50 be given.
51
52 -t, --times=NUM
53 where NUM is the number of times to repeat the write/read to
54 buffer test. Default value is 1 .
55
56 -v, --verbose
57 increase verbosity of output.
58
59 -V, --version
60 print version number (and data of last change) then exit.
61
63 The microcode in a SCSI device is _not_ modified by doing a WRITE BUF‐
64 FER command with its mode set to "data" (0x2) as done by this utility.
65 Therefore this utility is safe in that respect. [Mode values 0x4, 0x5,
66 0x6 and 0x7 are the dangerous ones :-)]
67
68 WARNING: If you access the device at the same time (e.g. because it's a
69 hard disk with a mounted file system on it) the device's buffer may be
70 used by the device itself for other data at the same time, and over‐
71 writing it may or may not cause data corruption! HOWEVER the SPC-3
72 draft standard does state in its WRITE BUFFER command: "This command
73 shall not alter any medium of the logical unit when data mode ... is
74 specified". This implies that it _is_ safe to use this utility with
75 devices that have mounted file systems on them. Following this theme
76 further, a disk with active mounted file systems may cause the data
77 read back to be different (due to caching activity) to what was written
78 and hence a checksum error.
79
81 The exit status of sg_test_rwbuf is 0 when it is successful. Otherwise
82 see the sg3_utils(8) man page.
83
85 Written by D. Gilbert and K. Garloff
86
88 Copyright © 2000-2006 Douglas Gilbert, Kurt Garloff
89 This software is distributed under the GPL version 2. There is NO war‐
90 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
91 POSE.
92
93
94
95sg3_utils-1.23 January 2007 SG_TEST_RWBUF(8)