Reclaim disk space by obliterating files
P4 Server maintains the history (metadata Information that P4 Server maintains, such as who created file revisions in the depot, whether the file is a 'lazy copy,, the current state of client workspaces, protections, groups, users, labels, streams, and branches. Metadata is stored in the server database and is separate from the 'archive files' that users submit from their client workspace into the depot.) of which operations were performed on which files.
p4 obliterate means permanent removal
Obliteration of a file removes both the file's data and its history from the P4 Server permanently. The p4 archive -p command removes physical file revisions, but retains revision history. The p4 delete command does not remove revisions of the file prior to the delete operation and therefore does not recover disk space.
If certain files and their history are no longer in use, you might want to recover disk space on the central server. You can do one of the following:
- Move them into an archive depot A special depot into which versioned files (also known as archive files) can be transferred. See also 'depot'. by using the
p4 archivecommand. If you later decide you want to use those files and recover their history, use thep4 restorecommand. - Permanently delete the files by using the
p4 obliteratecommand. One use case is to eliminate a submit or a branch that was created by mistake. However, the operations ofp4 obliterateare computationally expensive. - Permanently delete the files but retain the metadata by using the
p4 obliterate -pcommand. This option recovers the disk space of the files, yet reduces the amount of time the command runs because metadata is not processed.
The p4 delete command does not remove revisions of the file prior to the delete operation and therefore does not recover disk space.
readonly, partitioned, and partitioned-jnl, the p4 have command continues to list obliterated files until a subsequent
p4 sync operation. To learn more, see Client workspace types.Test p4 obliterate by excluding the -y option
p4 obliterate filename does not obliterate anything unless the -y option is included. Instead, it returns a report. This lets you test p4 obliterate before running it. For example:
p4 obliterate filename
To obliterate a file, removing it from the P4 Server permanently, use the -y option. For example:
p4 obliterate -y filename
To obliterate only one revision of a file, specify the revision number. For example, to obliterate revision 5 of a file, use:
p4 obliterate -y file#5
To obliterate a range of revisions, specify a revision range. For example:
p4 obliterate -y file#5,7
If you do not specify a revision range, all revisions of the file are obliterated. To learn more, see Using revision ranges in the P4 CLI Reference.
The safest way to use p4 obliterate is to use it
without the -y option until you are certain the files
and revisions are correctly specified.
p4
obliterate during peak usage periods because the amount of metadata to process might be large. Do not use operating system commands (erase,
rm, and their equivalents) to remove files from the
P4 Server
root by hand.