Reclaim disk space by removing orphaned archive files

You can save disk space by removing orphaned archive files and their associated metadata records. By "orphan", we mean a file that exists in the server depot's archive storage but that lacks a reference. Archives with a reference count of 0 are rare, but can be created by incomplete p4 submit or p4 shelve commands, system crashes, or other similar errors.

To reclaim that disk space:

  1. Run p4 storage -l because it spawns a background process that looks for files in the specified //depotdirectory and its subdirectories that match the naming convention for the server's archive file format. Each file that is found along with its revision is checked for a matching entry in the db.storage table. If no such entry is found, a new record is created that describes the file and revision combination with a reference count of 0.
  2. Run p4 storage -d to delete those 0 references records along with the associated archive file.

For more details, see p4 storage in Helix Core Command-Line (P4) Reference.