Reclaiming disk space by archiving files

Over time, Helix server accumulates many revisions of files from old projects that are no longer in active use. Because p4 delete merely marks files as deleted in their head revisions, it cannot be used to free up disk space on the server.

Archive depots are a solution to this problem. You use archive depots to move infrequently-accessed files to bulk storage. To create one, mount a suitable filesystem, and use the p4 archive (and related p4 restore) commands to populate an archive depot located on this storage.

Note

Archive depots are not a backup mechanism.

Archive depots are merely a means by which you can free up diskspace by reallocating infrequently-accessed files to bulk storage, as opposed to p4 obliterate, which removes file data and history.

Archiving is restricted to files that meet all of the following criteria:

  • By default, files must be stored in full (+F) or compressed (+C) format. To archive text files (or other files stored as deltas), use p4 archive -t, but be aware that the archiving of RCS deltas is computationally expensive.
  • Files must not be copied or branched from other revisions
  • Files must not be copied or branched to other revisions
  • Files must already exist in a local depot.

To create an archive depot and archive files to it:

  1. Create a new depot with p4 depot and set the depot’s Type: to archive. Set the archive depot’s Map: to point to a filesystem for near-line or detachable storage.
  2. Mount the volume to which the archive depot is to store its files.
  3. Use p4 archive to transfer the files from a local depot to the archive depot.
  4. (Optionally), unmount the volume to which the archive files were written.

Disk space is freed up on the (presumably high-performance) storage used for your local depot, and users can no longer access the contents of the archived files, but all file history is preserved.

To restore files from an archive depot:

  1. Mount the volume on which the archive depot’s files are stored.
  2. Use the p4 verify -A command to verify files before you restore them.
  3. Use p4 restore to transfer the files from the archive depot to a local depot.
  4. (Optionally), unmount the volume to which the archive files were restored.

To purge data from an archive depot

  1. Mount the volume on which the archive depot’s files are stored.
  2. Use p4 archive -p to purge the archives of the specified files in the archive depot.

    On completion, the action for affected revisions is set to purge, and the purged revisions can no longer be restored. The data is permanently lost.

  3. (Optionally), unmount the volume from which the archive files were purged.