Archiving Depot Content Off-line

The depot "copy and obliterate" method

Info & Tags

Article #:
300
Created:
05/18/06
Modified:
06/24/08
Tags:
archiving, p4d

Links

  1. Making Large Depots Smaller
    KB article
  2. Perforce Command Reference
    Documentation
  3. p4 obliterate
    Perforce Command Reference

TASK

How do I remove old data from your Perforce server and store it off-line?

How do I export the contents of a specific depot branch?

SOLUTION

To archive a section of a Perforce Server, do the following:
  1. Copy the entire Perforce Server to a new "archive server" location.
  2. Start the archive server.
  3. Obliterate everything on that archive server that you do not need.
The result is a new server that contains only the content that you want archived.

To reiterate, archiving requires creating a duplicate copy of your server and then obliterating everything that you do not want, leaving you with just the content that you do want.

The most important part of the archiving process is determining which files to obliterate. An efficient method of selecting files to obliterate is by creating a special client workspace dedicated to this purpose.

For example, to archive the "//depot/OldStuff/..." section of the depot, create a client workspace, such as "archive-tmp" below, with a View that maps the entire depot. Then use exclusionary View mappings to exclude the files you wish to save (archive):
Client: archive-tmp
View:
   //depot/... //archive-tmp/...
  -//depot/OldStuff/... //archive-tmp/OldStuff/...
Then you can obliterate everything you do not need by providing the entire client workspace as an argument to the p4 obliterate command. For  example:
p4 obliterate -y //archive-tmp/...
This "depot copy and obliterate" approach to archiving is also discussed in "Making Large Depots Smaller".

Once you have copied your original server content to an archive server instance, you take a checkpoint of the archive server, compress the depot file contents, and store the checkpoint and depot files on a backup medium.

If you need to recover the archived Perforce Server content for future use, you can rebuild the archive server from checkpoint, restore the compressed depot files, and restart the archive server to browse and use it.

The p4 obliterate command can permanently remove contents from your Perforce Server based on depot path, date, or a combination of both. For details on usage, see the Perforce Command Reference.

Notes:
  • The above offline archiving solution is simple and effective, but can also be resource and time intensive. You need enough disk space to duplicate the entire contents of the original server.

  • You may want to modify your production server "p4 protect" table to prevent write access to the obliterated directory name. For example, to prevent anyone from adding the "OldStuff" directory, you can add a line to your protections table similar to this:
    write user * * -//depot/OldStuff...
    This modification can make it easier to merge the archived data back into the production Perforce server by preventing naming conflicts.

  • You might want to restore your Perforce server database after a large obliterate. This may reduce fragmentation in the Perforce meta-data, which can improve performance . More information on restoring the Perforce server database is located in the Perforce System Administrator's Guide.