[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.8 Verifying Data as It is Stored
This option causes tar
to verify the archive after writing it.
Each volume is checked after it is written, and any discrepancies
are recorded on the standard error output.
Verification requires that the archive be on a back-space-able medium. This means pipes, some cartridge tape drives, and some other devices cannot be verified.
You can insure the accuracy of an archive by comparing files in the
system with archive members. tar
can compare an archive to the
file system as the archive is being written, to verify a write
operation, or can compare a previously written archive, to insure that
it is up to date.
To check for discrepancies in an archive immediately after it is
written, use the ‘--verify’ (‘-W’) option in conjunction with
the ‘--create’ operation. When this option is
specified, tar
checks archive members against their counterparts
in the file system, and reports discrepancies on the standard error.
To verify an archive, you must be able to read it from before the end of the last written entry. This option is useful for detecting data errors on some tapes. Archives written to pipes, some cartridge tape drives, and some other devices cannot be verified.
One can explicitly compare an already made archive with the file system by using the ‘--compare’ (‘--diff’, ‘-d’) option, instead of using the more automatic ‘--verify’ option. See section Comparing Archive Members with the File System.
Note that these two options have a slightly different intent. The
‘--compare’ option checks how identical are the logical contents of some
archive with what is on your disks, while the ‘--verify’ option is
really for checking if the physical contents agree and if the recording
media itself is of dependable quality. So, for the ‘--verify’
operation, tar
tries to defeat all in-memory cache pertaining to
the archive, while it lets the speed optimization undisturbed for the
‘--compare’ option. If you nevertheless use ‘--compare’ for
media verification, you may have to defeat the in-memory cache yourself,
maybe by opening and reclosing the door latch of your recording unit,
forcing some doubt in your operating system about the fact this is really
the same volume as the one just written or read.
The ‘--verify’ option would not be necessary if drivers were indeed able to detect dependably all write failures. This sometimes require many magnetic heads, some able to read after the writes occurred. One would not say that drivers unable to detect all cases are necessarily flawed, as long as programming is concerned.
The ‘--verify’ (‘-W’) option will not work in
conjunction with the ‘--multi-volume’ (‘-M’) option or
the ‘--append’ (‘-r’), ‘--update’ (‘-u’)
and ‘--delete’ operations. See section The Five Advanced tar
Operations, for more
information on these operations.
Also, since tar
normally strips leading ‘/’ from file
names (see section Absolute File Names), a command like ‘tar --verify -cf
/tmp/foo.tar /etc’ will work as desired only if the working directory is
‘/’, as tar
uses the archive’s relative member names
(e.g., ‘etc/motd’) when verifying the archive.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on November 1, 2013 using texi2html 5.0.