1SG_VERIFY(8)                       SG3_UTILS                      SG_VERIFY(8)
2
3
4

NAME

6       sg_verify - invoke SCSI VERIFY command(s) on a block device
7

SYNOPSIS

9       sg_verify  [--16]  [--bpc=BPC]  [--count=COUNT] [--dpo] [--ebytchk=BCH]
10       [--group=GN]  [--help]  [--in=IF]  [--lba=LBA]  [--ndo=NDO]   [--quiet]
11       [--readonly] [--verbose] [--version] [--vrprotect=VRP] DEVICE
12

DESCRIPTION

14       Sends one or more SCSI VERIFY (10 or 16) commands to DEVICE. These SCSI
15       commands   are   defined   in   the   SBC-2   (draft)    standard    at
16       http://www.t10.org and SBC-3 drafts.
17
18       When --ndo=NDO is not given then the verify starts at the logical block
19       address given by the --lba=LBA option and continues  for  --count=COUNT
20       blocks.  No more than --bpc=BPC blocks are verified by each VERIFY com‐
21       mand so if necessary multiple VERIFY commands are sent. Medium  verifi‐
22       cation  operations  are  performed  by  the DEVICE (e.g.  assuming each
23       block has additional EEC data, check this  against  the  logical  block
24       contents).  No  news  is  good news (i.e. if there are no verify errors
25       detected then no messages are sent to stderr and the Unix  exit  status
26       is 0).
27
28       When  --ndo=NDO is given then the --bpc=BPC option is ignored. A single
29       VERIFY command is issued and a comparison starts at the  logical  block
30       address  given  by the --lba=LBA option and continues for --count=COUNT
31       blocks. The VERIFY command has an associated data-out  buffer  that  is
32       NDO  bytes  long. The contents of the data-out buffer are obtained from
33       the FN file (if --in=FN is given) or from stdin.   A  comparison  takes
34       place  between data-out buffer and the logical blocks on the DEVICE. If
35       the comparison is good then no messages are sent to stderr and the Unix
36       exit  status  is  0. If the comparison fails then a sense buffer with a
37       sense key of MISCOMPARE is returned; in this case the Unix exit  status
38       will  be 14. Messages will be sent to stderr associated with MISCOMPARE
39       sense buffer unless the --quiet option is given.
40
41       In SBC-3 revision 34 the BYTCHK field in all SCSI VERIFY  commands  was
42       expanded  from  one  to  two  bits.  That  required some changes in the
43       options of this utility, see the section below on OPTION CHANGES.
44

OPTIONS

46       Arguments to long options are mandatory for short options as well.  The
47       options  are  arranged  in  alphabetical order based on the long option
48       name.
49
50       -S, --16
51              uses a VERIFY(16) command  (default  VERIFY(10)).  Even  without
52              this  option,  using an --lba=LBA which is too large, will cause
53              the utility to issue a VERIFY(16) command.
54
55       -b, --bpc=BPC
56              this option is ignored if  --ndo=NDO  is  given.  Otherwise  BPC
57              specifies  the maximum number of blocks that will be verified by
58              a single SCSI VERIFY command. The default value  is  128  blocks
59              which  equates  to 64 KB for a disk with 512 byte blocks. If BPC
60              is less than COUNT then multiple SCSI VERIFY commands  are  sent
61              to  the  DEVICE.  For  the  default VERIFY(10) BPC cannot exceed
62              0xffff  (65,535)  while  for  VERIFY(16)   BPC   cannot   exceed
63              0x7fffffff  (2,147,483,647).  For  recent  block devices (disks)
64              this value may be constrained by  the  maximum  transfer  length
65              field in the block limits VPD page.
66
67       -c, --count=COUNT
68              where  COUNT  specifies  the  number  of  blocks  to verify. The
69              default value is 1 . If  COUNT  is  greater  than  BPC  (or  its
70              default  value of 128) and NDO is not given, 0 or less than mul‐
71              tiple SCSI VERIFY commands are sent  to  the  device.  Otherwise
72              COUNT  becomes  the contents of the verification length field of
73              the SCSI VERIFY command issued. The sg_readcap  utility  can  be
74              used  to  find  the maximum number of blocks that a block device
75              (e.g. a disk) has.
76
77       -d, --dpo
78              disable page out changes the cache retention priority of  blocks
79              read  on  the  device's cache to the lowest priority. This means
80              that blocks read by other commands are more likely to remain  in
81              the device's cache.
82
83       -E, --ebytchk=BCH
84              sets the BYTCHK field to BCH overriding the value (1) set by the
85              --ndo=NDO option. Values of 1, 2 or 3 are accepted for BCH  how‐
86              ever  sbc3r34 reserves the value 2. If this option is given then
87              --ndo=NDO must also be given. If BCH is 3 then COUNT must  be  1
88              and  NDO  should be the size of one logical block (plus the size
89              of some or all of the protection information if VRP  is  greater
90              than 0).
91
92       -g, --group=GN
93              where  GN  becomes the contents of the group number field in the
94              SCSI VERIFY(16) command. It can be from 0 to 63  inclusive.  The
95              default  value for GN is 0. Note that this option is ignored for
96              the SCSI VERIFY(10) command.
97
98       -h, --help
99              output the usage message then exit.
100
101       -i, --in=IF
102              where IF is the name of a file from which NDO bytes will be read
103              and  placed  in  the data-out buffer. This is only done when the
104              --ndo=NDO option is given. If this  option  is  not  given  then
105              stdin is read. If IF is "-" then stdin is also used.
106
107       -l, --lba=LBA
108              where LBA specifies the logical block address of the first block
109              to start the verify operation. LBA  is  assumed  to  be  decimal
110              unless  prefixed  by  '0x'  or  a  trailing 'h' (see below). The
111              default value is 0 (i.e. the start of the device).
112
113       -n, --ndo=NDO
114              NDO is the number of bytes  to  obtain  from  the  FN  file  (if
115              --in=FN  is  given) or from stdin. Those bytes are placed in the
116              data-out buffer associated with the SCSI VERIFY command and  NDO
117              is  placed  in  the  verification  length  field in the cdb. The
118              default value for NDO is 0 and the maximum value is dependent on
119              the OS. If the --ebytchk=BCH option is not given then the BYTCHK
120              field in the cdb is set to 1.
121
122       -q, --quiet
123              suppress the sense buffer messages associated with a  MISCOMPARE
124              sense  key that would otherwise be sent to stderr. Still set the
125              exit status to 14 which is the sense key value indicating a MIS‐
126              COMPARE .
127
128       -r, --readonly
129              opens  the  DEVICE read-only rather than read-write which is the
130              default. The Linux sg driver needs  read-write  access  for  the
131              SCSI  VERIFY  command  but  other  access  methods  may  require
132              read-only access.
133
134       -v, --verbose
135              increase the level of verbosity, (i.e. debug output).
136
137       -V, --version
138              print the version string and then exit.
139
140       -P, --vrprotect=VRP
141              where VRP is the value in the vrprotect field in the VERIFY com‐
142              mand  cdb.  It  must  be  a value between 0 and 7 inclusive. The
143              default value is zero.
144

BYTCHK

146       BYTCHK is the name of a field (two bits wide)  in  the  VERIFY(10)  and
147       VERIFY(16)  commands. When set to 1 or 3 (sbc3r34 reserves the value 2)
148       it indicates that associated with the SCSI VERIFY command,  a  data-out
149       buffer will be sent for the device (disk) to check. Using the --ndo=NDO
150       option sets the BYTCHK field to 1 and NDO is the number of bytes placed
151       in the data-out buffer. Those bytes are obtained from stdin or IF (from
152       the --in=FN option). The --ebytchk=BCH option may be used  to  override
153       the BYTCHK field value of 1 with BCH.
154
155       The calculation of NDO is left up to the user. Its value depends on the
156       logical block size (which can be found with  the  sg_readcap  utility),
157       the  COUNT  and  the VRP values. If the VRP is greater than 0 then each
158       logical block will contain an extra 8 bytes (at  least)  of  protection
159       information.
160
161       When  the  BYTCHK  field is 0 then the verification process done by the
162       device (disk) is vendor specific. It typically involves  checking  each
163       block  on  the  disk  against its error correction codes (ECC) which is
164       additional data also held on the disk.
165
166       Many Operating Systems put limits on the maximum size of  the  data-out
167       (and  data-in)  buffer. For Linux at one time the limit was less than 1
168       MB but has been increased somewhat.
169

OPTION CHANGES

171       Earlier versions of this utility had a --bytchk=NDO  option  which  set
172       the  BYTCHK  bit and set the cdb verification length field to NDO.  The
173       shorter form of that option was -B NDO. For backward compatibility that
174       option  is  still  present  but  not  documented.  In  its place is the
175       --ndo=NDO whose shorter form of -n  NDO.   --ndo=NDO  sets  the  BYTCHK
176       field to 1 unless that is overridden by the --ebytchk=BCH.
177

NOTES

179       Various  numeric  arguments  (e.g. LBA) may include multiplicative suf‐
180       fixes or be given in hexadecimal. See the "NUMERIC  ARGUMENTS"  section
181       in the sg3_utils(8) man page.
182
183       The  amount  of  error  correction  and the number of retries attempted
184       before a block is considered defective are controlled in  part  by  the
185       Verify Error Recovery mode page. A note in the SBC-3 draft (rev 29 sec‐
186       tion 6.4.9 on the Verify Error Recovery mode page) advises that to min‐
187       imize  the number of checks (and hence have the most "sensitive" verify
188       check) do the following in that mode page: set the EER bit  to  0,  the
189       PER  bit  to  1,  the  DTE bit to 1, the DCR bit to 1, the verify retry
190       count to 0 and the verify recovery time limit to 0. Mode pages  can  be
191       modified with the sdparm utility.
192
193       The  SCSI  VERIFY(6)  command  defined  in the SSC-2 standard and later
194       (i.e.  for tape drive systems) is not supported by this utility.
195

EXIT STATUS

197       The exit status of sg_verify is 0 when it is successful.  When  BCH  is
198       other  than  0  then  a comparison takes place and if it fails then the
199       exit status is 14 which happens to be the sense key  value  of  MISCOM‐
200       PARE.   Otherwise  see  the EXIT STATUS section in the sg3_utils(8) man
201       page.
202
203       Earlier versions of this utility set an exit status of  98  when  there
204       was a MISCOMPARE.
205

AUTHORS

207       Written by Douglas Gilbert.
208

REPORTING BUGS

210       Report bugs to <dgilbert at interlog dot com>.
211
213       Copyright © 2004-2018 Douglas Gilbert
214       This  software is distributed under a FreeBSD license. There is NO war‐
215       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
216       POSE.
217

SEE ALSO

219       sdparm(sdparm),       sg_modes(sg3_utils),       sg_readcap(sg3_utils),
220       sg_inq(sg3_utils)
221
222
223
224sg3_utils-1.43                   January 2018                     SG_VERIFY(8)
Impressum