1
.TH SG_VERIFY "8" "February 2011" "sg3_utils\-1.31" SG3_UTILS
1
.TH SG_VERIFY "8" "December 2012" "sg3_utils\-1.35" SG3_UTILS
3
3
sg_verify \- invoke SCSI VERIFY command(s) on a block device
6
[\fI\-\-bpc=BPC\fR] [\fI\-\-count=COUNT\fR] [\fI\-\-dpo\fR] [\fI\-\-help\fR]
6
[\fI\-\-16\fR] [\fI\-\-bpc=BPC\fR] [\fI\-\-bytchk=NDO\fR]
7
[\fI\-\-count=COUNT\fR] [\fI\-\-dpo\fR] [\fI\-\-ebytchk=BVAL\fR]
8
[\fI\-\-group=GN\fR] [\fI\-\-help\fR] [\fI\-\-in=IF\fR]
7
9
[\fI\-\-lba=LBA\fR] [\fI\-\-readonly\fR] [\fI\-\-verbose\fR]
8
[\fI\-\-version\fR] [\fI\-\-vrprotect=VRP\fR] \fIDEVICE\fR
10
[\fI\-\-version\fR] [\fI\-\-vrprotect=VRP\fR]
10
13
.\" Add any additional description here
12
Sends one or more SCSI VERIFY commands to \fIDEVICE\fR. It is the 10 byte
13
VERIFY command defined for block devices (see SBC\-2 at http://www.t10.org).
14
Verify starts at the logical block address given by the \fI\-\-lba=LBA\fR
15
option and continues for \fI\-\-count=COUNT\fR blocks. No more than
16
\fI\-\-bpc=BPC\fR blocks are verified by each VERIFY command so if necessary
17
multiple VERIFY commands are sent. No news is good news (i.e. if there are
18
no verify errors detected no messages are sent to stderr and the Unix return
15
Sends one or more SCSI VERIFY (10 or 16) commands to \fIDEVICE\fR. These SCSI
16
commands are defined in the SBC\-2 (draft) standard at http://www.t10.org and
19
When \fI\-\-bytchk=NDO\fR is not given then the verify starts at the logical
20
block address given by the \fI\-\-lba=LBA\fR option and continues for
21
\fI\-\-count=COUNT\fR blocks. No more than \fI\-\-bpc=BPC\fR blocks are
22
verified by each VERIFY command so if necessary multiple VERIFY commands are
23
sent. No news is good news (i.e. if there are no verify errors detected then
24
no messages are sent to stderr and the Unix return status is 0).
26
When \fI\-\-bytchk=NDO\fR is given then the \fI\-\-bpc=BPC\fR option is
27
ignored. A single verify command is issued and it starts at the logical block
28
address given by the \fI\-\-lba=LBA\fR option and continues for
29
\fI\-\-count=COUNT\fR blocks. The VERIFY command has an associated data\-out
30
buffer that is \fINDO\fR bytes long. The contents of the data\-out buffer are
31
obtained from the \fIFN\fR file (if \fI\-\-in=FN\fR is given) or from stdin.
21
33
Arguments to long options are mandatory for short options as well.
22
34
The options are arranged in alphabetical order based on the long
37
\fB\-S\fR, \fB\-\-16\fR
38
uses a VERIFY(16) command (default VERIFY(10)). Even without this option,
39
using an \fI\-\-lba=LBA\fR which is too large, will cause the utility
40
to issue a VERIFY(16) command.
25
42
\fB\-b\fR, \fB\-\-bpc\fR=\fIBPC\fR
26
where \fIBPC\fR specifies the maximum number of blocks that will be verified
27
by a single SCSI VERIFY command. The default value is 128 blocks which
28
equates to 64 KB for a disk with 512 byte blocks. If \fIBPC\fR is less than
29
\fICOUNT\fR then multiple SCSI VERIFY commands are sent to the device. For
30
recent block devices (disks) this value may be constrained by the maximum
31
transfer length field in the block limits VPD page.
43
this option is ignored if \fI\-\-bytchk=NDO\fR is given. Otherwise \fIBPC\fR
44
specifies the maximum number of blocks that will be verified by a single SCSI
45
VERIFY command. The default value is 128 blocks which equates to 64 KB for a
46
disk with 512 byte blocks. If \fIBPC\fR is less than \fICOUNT\fR then
47
multiple SCSI VERIFY commands are sent to the device. For the default
48
VERIFY(10) \fIBPC\fR cannot exceed 0xffff (65,535) while for VERIFY(16)
49
\fIBPC\fR cannot exceed 0x7fffffff (2,147,483,647). For recent block
50
devices (disks) this value may be constrained by the maximum transfer length
51
field in the block limits VPD page.
53
\fB\-B\fR, \fB\-\-bytchk\fR=\fINDO\fR
54
sets the BYTCHK field to one in the VERIFY command. \fINDO\fR is the number
55
of bytes to obtain from the \fIFN\fR file (if \fI\-\-in=FN\fR is given) or
56
from stdin. Those bytes are placed in the data\-out buffer associated with
57
the SCSI VERIFY command. The minimum value for \fINDO\fR is 1 and the
58
maximum value is dependant on the OS. The actual value in the BYTCHK field
59
in the VERIFY command may be modified by a \fI\-\-ebytchk=BVAL\fR option.
33
61
\fB\-c\fR, \fB\-\-count\fR=\fICOUNT\fR
34
62
where \fICOUNT\fR specifies the number of blocks to verify. The default value
35
63
is 1 . If \fICOUNT\fR is greater than \fIBPC\fR (or its default value of 128)
36
then multiple SCSI VERIFY commands are sent to the device. The
64
and \fINDO\fR is not given, 0 or less then multiple SCSI VERIFY commands are
65
sent to the device. Otherwise \fICOUNT\fR becomes the contents of the
66
verification length field of the SCSI VERIFY command issued. The
38
68
utility can be used to find the maximum number of blocks that a block
39
69
device (e.g. a disk) has.
43
73
the device's cache to the lowest priority. This means that blocks read by
44
74
other commands are more likely to remain in the device's cache.
76
\fB\-E\fR, \fB\-\-ebytchk\fR=\fIBVAL\fR
77
sets the BYTCHK field to \fIBVAL\fR overriding the value (1) set by the
78
\fI\-\-bytchk=NDO\fR option. Values of 1, 2 or 3 are accepted for \fIBVAL\fR
79
however sbc3r34 reserves the value 2. If this option is given then
80
\fI\-\-bytchk=NDO\fR must also be given. If \fIBVAL\fR is 3 then \fICOUNT\fR
81
must be 1 and \fINDO\fR should be the size of one logical block (plus the
82
size of some or all of the protection infomation if \fIVRP\fR is greater
85
\fB\-g\fR, \fB\-\-group\fR=\fIGN\fR
86
where \fIGN\fR becomes the contents of the group number field in the SCSI
87
VERIFY(16) command. The default value for \fIGN\fR is 0. Note that this
88
option is ignored for the SCSI VERIFY(10) command.
46
90
\fB\-h\fR, \fB\-\-help\fR
47
91
output the usage message then exit.
93
\fB\-i\fR, \fB\-\-in\fR=\fIIF\fR
94
where \fIIF\fR is the name of a file from which \fINDO\fR bytes will be read
95
and placed in the data\-out buffer. This is only done when the
96
\fI\-\-bytchk=NDO\fR option is given. If this option is not given then stdin
97
is read. If \fIIF\fR is "\-" then stdin is also used.
49
99
\fB\-l\fR, \fB\-\-lba\fR=\fILBA\fR
50
100
where \fILBA\fR specifies the logical block address of the first block to
51
101
start the verify operation. \fILBA\fR is assumed to be decimal unless prefixed
66
116
where \fIVRP\fR is the value in the vrprotect field in the VERIFY command
67
117
cdb. It must be a value between 0 and 7 inclusive. The default value is
120
BYTCHK is the name of a field (two bits wide) in the VERIFY(10) and
121
VERIFY(16) commands. When set to 1 or 3 (sbc3r34 reserves the value 2) it
122
indicates that associated with the SCSI VERIFY command, a data\-out buffer
123
will be sent for the device (disk) to check. Using the \fI\-\-bytchk=NDO\fR
124
option sets the BYTCHK field to 1 and \fINDO\fR is the number of bytes
125
placed in the data\-out buffer. Those bytes are obtained from stdin or
126
\fIIF\fR (from the \fI\-\-in=FN\fR option). The \fI\-\-ebytchk=BVAL\fR
127
option may be used to override the BYTCHK field value of 1 with \fIBVAL\fR.
129
The calculation of \fINDO\fR is left up to the user. Its value depends
130
on the logical block size (which cab be found with the sg_readcap utility),
131
the \fICOUNT\fR and the \fIVRP\fR values. If the \fIVRP\fR is greater than
132
0 then each logical block will contain an extra 8 bytes (at least) of
133
protection information.
135
When the BYTCHK field is 0 then the verification process done by the
136
device (disk) is vendor specific. It typically involves checking each
137
block on the disk against its error correction codes (ECC) which is
138
additional data also held on the disk.
140
Many Operating Systems put limits on the maximum size of the
141
data\-out (and data\-in) buffer. For Linux at one time the limit was
142
less than 1 MB but has been increased somewhat.
70
144
Various numeric arguments (e.g. \fILBA\fR) may include multiplicative
71
145
suffixes or be given in hexadecimal. See the "NUMERIC ARGUMENTS" section
72
146
in the sg3_utils(8) man page.
74
The amount of error correction and the number of retries attempted
75
before a block is considered defective are controlled in part by the
76
Verify Error Recovery mode page. A note in the SBC\-2 (draft)
77
standard advises that to minimize the number of checks (and hence
78
have the most "sensitive" verify check) do the following in that
79
mode page. Set the EER bit to 0, the PER bit to 1, the DTE bit to 1,
80
the DCR bit to 1, the verify retry count to 0 and the verify error
81
recovery timeout to 0. Mode pages can be modified with the
148
The amount of error correction and the number of retries attempted before a
149
block is considered defective are controlled in part by the Verify Error
150
Recovery mode page. A note in the SBC\-3 draft (rev 29 section 6.4.9 on the
151
Verify Error Recovery mode page) advises that to minimize the number of
152
checks (and hence have the most "sensitive" verify check) do the following
153
in that mode page: set the EER bit to 0, the PER bit to 1, the DTE bit to 1,
154
the DCR bit to 1, the verify retry count to 0 and the verify recovery time
155
limit to 0. Mode pages can be modified with the
159
The SCSI VERIFY(6) command defined in the SSC\-2 standard and later (i.e.
160
for tape drive systems) is not supported by this utility.
85
162
The exit status of sg_verify is 0 when it is successful. Otherwise see
86
163
the sg3_utils(8) man page.