SG_VERIFY(8) | SG3_UTILS | SG_VERIFY(8) |
sg_verify - invoke SCSI VERIFY command(s) on a block device
sg_verify [--0] [--16] [--bpc=BPC] [--count=COUNT] [--dpo] [--ff] [--ebytchk=BCH] [--group=GN] [--help] [--in=IF] [--lba=LBA] [--ndo=NDO] [--quiet] [--readonly] [--verbose] [--version] [--vrprotect=VRP] DEVICE
Sends one or more SCSI VERIFY (10 or 16) commands to DEVICE. These SCSI commands are defined in the SBC-2 and SBC-3 standards at http://www.t10.org and SBC-4 drafts.
When --ndo=NDO is not given then the verify starts at the logical block address given by the --lba=LBA option and continues for --count=COUNT blocks. No more than --bpc=BPC blocks are verified by each VERIFY command so if necessary multiple VERIFY commands are sent. Medium verification operations are performed by the DEVICE (e.g. assuming each block has additional EEC data, check this against the logical block contents). No news is good news (i.e. if there are no verify errors detected then no messages are sent to stderr and the Unix exit status is 0).
When --ndo=NDO is given then the --bpc=BPC option is ignored. A single VERIFY command is issued and a comparison starts at the logical block address given by the --lba=LBA option and continues for --count=COUNT blocks. The VERIFY command has an associated data-out buffer that is NDO bytes long. The contents of the data-out buffer are obtained from the FN file (if --in=FN is given) or from stdin. A comparison takes place between data-out buffer and the logical blocks on the DEVICE. If the comparison is good then no messages are sent to stderr and the Unix exit status is 0. If the comparison fails then a sense buffer with a sense key of MISCOMPARE is returned; in this case the Unix exit status will be 14. Messages will be sent to stderr associated with MISCOMPARE sense buffer unless the --quiet option is given.
In SBC-3 revision 34 the BYTCHK field in all SCSI VERIFY commands was expanded from one to two bits. That required some changes in the options of this utility, see the section below on OPTION CHANGES.
Arguments to long options are mandatory for short options as well. The options are arranged in alphabetical order based on the long option name.
BYTCHK is the name of a field (two bits wide) in the VERIFY(10) and VERIFY(16) commands. When set to 1 or 3 (sbc3r34 reserves the value 2) it indicates that associated with the SCSI VERIFY command, a data-out buffer will be sent for the device (disk) to check. Using the --ndo=NDO option sets the BYTCHK field to 1 and NDO is the number of bytes placed in the data-out buffer. Those bytes are obtained from stdin or IF (from the --in=FN option). The --ebytchk=BCH option may be used to override the BYTCHK field value of 1 with BCH.
The calculation of NDO is left up to the user. Its value depends on the logical block size (which can be found with the sg_readcap utility), the COUNT and the VRP values. If the VRP is greater than 0 then each logical block will contain an extra 8 bytes (at least) of protection information.
When the BYTCHK field is 0 then the verification process done by the device (disk) is vendor specific. It typically involves checking each block on the disk against its error correction codes (ECC) which is additional data also held on the disk.
Many Operating Systems put limits on the maximum size of the data-out (and data-in) buffer. For Linux at one time the limit was less than 1 MB but has been increased somewhat.
Earlier versions of this utility had a --bytchk=NDO option which set the BYTCHK bit and set the cdb verification length field to NDO. The shorter form of that option was -B NDO. For backward compatibility that option is still present but not documented. In its place is the --ndo=NDO whose shorter form of -n NDO. --ndo=NDO sets the BYTCHK field to 1 unless that is overridden by the --ebytchk=BCH.
Various numeric arguments (e.g. LBA) may include multiplicative suffixes or be given in hexadecimal. See the "NUMERIC ARGUMENTS" section in the sg3_utils(8) man page.
The amount of error correction and the number of retries attempted before a block is considered defective are controlled in part by the Verify Error Recovery mode page. A note in the SBC-3 draft (rev 29 section 6.4.9 on the Verify Error Recovery mode page) advises that to minimize the number of checks (and hence have the most "sensitive" verify check) do the following in that mode page: set the EER bit to 0, the PER bit to 1, the DTE bit to 1, the DCR bit to 1, the verify retry count to 0 and the verify recovery time limit to 0. Mode pages can be modified with the sdparm utility.
The SCSI VERIFY(6) command defined in the SSC-2 standard and later (i.e. for tape drive systems) is not supported by this utility.
The exit status of sg_verify is 0 when it is successful. When BCH is other than 0 then a comparison takes place and if it fails then the exit status is 14 which happens to be the sense key value of MISCOMPARE. Otherwise see the EXIT STATUS section in the sg3_utils(8) man page.
Earlier versions of this utility set an exit status of 98 when there was a MISCOMPARE.
Written by Douglas Gilbert.
Report bugs to <dgilbert at interlog dot com>.
Copyright © 2004-2019 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO warranty;
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sdparm(sdparm), sg_modes(sg3_utils), sg_readcap(sg3_utils), sg_inq(sg3_utils)
December 2019 | sg3_utils-1.45 |