p4 verify

Verify that the Helix server archives (depot files) are intact (complete and without corruption).

Syntax conventions

p4 [g-opts] verify [-u | -v | -z] [-m max -q -s -X -b batchsize] FileSpec[revRange] ...
p4 [g-opts] verify -t [-U | -A ][-z -m max -q -s -X -b batchsize] FileSpec[revRange] ...
p4 [g-opts] verify -S [-t -m max -q -X -b batchsize] FileSpec...
p4 [g-opts] verify -U [-u | -v | -z] [-m max -q -s -X -b batchsize] unloadFileSpec ...
p4 [g-opts] verify -A [-u | -v | -z] [-m max -q -s -X -b batchsize] archiveFileSpec ...
p4 verify -Z [ -q ] file ...

Description

For each revision of the specified depot files, p4 verify reports the revision-specific information and an MD5 digest (fingerprint) of the revision’s contents.

The verification process involves opening the depot file (sometimes called the depot archive file), reading it, and verifying that its digest matches the expected value.

  • If the file can’t be opened, p4 verify reports MISSING.
  • If the file can be opened, but does not have the expected contents, p4 verify reports BAD.

If invoked without arguments, p4 verify computes and displays the MD5 digest of each revision.

Syntax variants offer the following choices:

  • Verify a given set of file revisions.
  • Verify a given set of shelved file revisions.
  • Verify file revisions in the unload depot.
  • Verify file revisions in the archive depot. (To learn about archive depots for infrequently-accessed files, see "Reclaiming disk space by archiving files" in Helix Core Server Administrator Guide.)

We recommend that you regularly verify the integrity of your depot files. See backup-recovery-ensuring-integrity.html in Helix Core Server Administrator Guide.

Verifying shelved files

The verification of shelved files lets you know whether your shelved archives have been lost or damaged.

If a shelf is local to a specific edge server, you must issue the p4 verify -S command on the edge server where the shelf was created. If the shelf was promoted, run the p4 verify -S on the commit server.

You may also run the p4 verify -S -t command on a replica to request re-transfer of a shelved archive that is missing or bad. Re-transferring a shelved archive from the master only works for shelved archives that are present on the master, that is, a shelf that was originally created on the master or promoted from an edge server.

Verifying archived files

The verification of archived files lets you know whether your archived files have been damaged. It is a good practice to run a command like the following before you restore files with the p4 restore command.

$ p4 verify -A //archive/depot/mysource/...
Note

If p4 verify returns errors, contact Perforce Technical Support.

Options

-A archivefiles

It is possible for files in the archive depot to become corrupted over time. This option allows you to verify these files before you restore them with the p4 restore command.

archivefiles specifies a file, a list of files, or set of files to verify. For example:

//archive/depot/..../source

-b batchsize

By default, p4 verify processes files in batches of 10,000 files at a time.

You can change this batch size with the -b batchsize option, where batchsize represents an integer.

To disable batching, specify -b 0.

If the -z option is specified, the -b option is ignored and all options are processed in a single batch.

-m max

Limit p4 verify to max number of revisions.

Use this option with the -u option to compute and save digests for a limited number of revisions in each invocation of the p4 verify command.

Tip

Depending on the FileSpec, p4 verify -m 10 FileSpec might list 10 files, 10 versions of a single file, or a combination of files and file versions.

-q

Run quietly and report only errors from mismatched digests or unreproducible revisions.

-s

Verify file size as well as digest. The -v implies the -s option.

-S

Verify shelved files. If you specify this option, the only valid revision specifier is @=change, specifying a single shelf. Use file patterns to restrict verification to a specific set of shelved files.

In a multi-server installation, this command should be run on the edge server where the shelf was created. If the shelf has been promoted, this command may also be run on the commit server.

-t

For use on replicas only: p4 verify -t causes the replica to schedule a transfer of the contents of any damaged or missing revisions. (This option also works on a replica with lbr.replication=cache.)

The -t option cannot be used with the -v or -u options.

In replicated environments, p4 verify -t reports BAD! or MISSING! files with (transfer scheduled) at the end of the line.

-u

Store the filesize and MD5 digest of each file in the Helix server database if no filesize and/or digest has been previously stored. Subsequent uses of p4 verify will compare the computed version against this stored version.

-U unloadfile

Verify files in the unload depot. See p4 unload for details.

-v

Store the MD5 digest of each file in the Helix server database, even if there’s already a digest stored for that file, overwriting the existing digest. (The -v option is used only to update the saved digests of archive files that have been deliberately altered outside of Helix server control by a Helix server system administrator.)

The -v and -u options are mutually exclusive.

-X

Skip files of filetype +X (for which the service runs an archive trigger.)

-z

Optimizes performance by skipping revisions that have already been computed in the current pass. This option speeds verifications for files that exist via lazy copies. The resulting output might report a lazy copy revision if it is the first revision in the sort order to access a common archive file.

This option cannot be used with the -v or -u options.

-Z

Specifies that the digest and file length check use the storage table as opposed to the revision table. This is generally faster because the lazy copied files are only checked one time. The output displays the reference count instead of the action and change fields.

The file argument is different because a lazy copied depot file is not be selectable. For example, consider file //x/x with a lazy copy at the path //y/y. Calling p4 verify -Z //y/... does not verify any files because there is no storage record that matches the //y path. However, without the -Z option, p4 verify //y/... uses the revision table to find and check the //x/x file. The -Z option can be combined solely with the -q option.

g-opts

See Global options.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

Yes

Yes

admin

Examples

p4 verify -S //depot/main/p4/...

Verifies all shelved files matching the specified path.

p4 verify -q -S //[email protected]=1023548

Verifies the shelved files in shelf 1023548 only.

p4 verify -q //...#head,#head

Verifies only the head revision of all files in the depot, reporting only on files with problems.

Related Commands

To get information about how you can specify revisions.

p4 help revisions