p4 cachepurge


Reclaim disk space on a replicated server.


p4 [g-opts] cachepurge -a [-n -R -O] [-i n] [-S n] [-D file …]
p4 [g-opts] cachepurge -f n [-n -R -O] [-i n] [-S n] [-D file …]
p4 [g-opts] cachepurge -m n [-n -R -O] [-i n] [-S n] [-D file …]
p4 [g-opts] cachepurge -s n [-n -R -O] [-i n] [-S n] [-D file …]


A replica used as a standby spare or for disaster recovery maintains a complete copy of the master server's versioned file archives. Replicas that are used for other purposes might not need to hold a copy of the content of every version of every file. If a replica is not needed for disaster recovery, you can reclaim disk space on it by periodically deleting versioned files. This is only safe to do if you have a backup of these files.

The p4 cachepurge command allows an administrator to reclaim disk space for those replicated servers that are not used for disaster recovery. File content is deleted only from the replica, not from the master server nor from any other replica. If a command that accesses purged file content is issued to this replica, the file is retrieved from the master server.

Each time the p4 cachepurge command runs, it attempts to delete enough file content from the replica to achieve the goal set by the values specified for the command parameters.



Delete all file content. This option reclaims the maximum amount of disk space, but any file content must be retrieved from the master. If the -O option is not specified, file names are used to determine order of deletion.

-D file …

Limit action of command to the specified set of files.

-f n

Delete sufficient file content to leave n number of bytes of free space for the file system.

-i n

Repeat the command every n seconds. If you omit this option, the command runs only once.

-m n

Delete n file revisions. The amount of space this frees up depends on the size of the files.


Display a preview of the cachepurge operation without deleting any files.


Delete the files from the oldest to the newest; that is, delete older files before deleting newer files.


Delete files in the order specified by the -O option. If the -O option is not specified, file names are used to determine order of deletion.

-s n

Delete n bytes of file data. This can be helpful in those cases when you can predict the growth rate of file system resources.

-S n

Do not delete the n most recent revisions of each file. For example, specifying -S 1, means that the head revision of each file is retained in the replica's cache if it is already there.


See “Global Options”.

Usage Notes

Can File Arguments Use Revision Specifier?

Can File Arguments Use Revision Range?

Minimal Access Level Required