The Server Deployment Package (SDP) is the implementation of Perforce’s recommendations for operating and managing a production Perforce Helix Core Version Control System. It is intended to provide the Helix Core administration team with tools to help:

  • Simplify Management

  • High Availability (HA)

  • Disaster Recovery (DR)

  • Fast and Safe Upgrades

  • Production Focus

  • Best Practice Configurables

  • Optimal Performance, Data Safety, and Simplified Backup

This guide is intended to provide instructions of setting up the SDP to help provide users of Helix Core with the above benefits.

This guide assumes some familiarity with Perforce and does not duplicate the basic information in the Perforce user documentation. This document only relates to the Server Deployment Package (SDP). All other Helix Core documentation can be found here: Perforce Support Documentation.

Please Give Us Feedback

Perforce welcomes feedback from our users. Please send any suggestions for improving this document or the SDP to

1. Overview

The SDP has four main components:

  • Hardware and storage layout recommendations for Perforce.

  • Scripts to automate critical maintenance activities

  • Scripts to aid the setup and management of replication (including failover for DR/HA)

  • Scripts to assist with routine administration tasks.

Each of these components is covered, in detail, in this guide.

1.1. Using this Guide

Chapter 2, Setting up the SDP describes concepts and re-requisites

Chapter 3, Installing the SDP on Unix / Linux consists of what you need to know to setup Helix Core sever on a Unix platform.

Chapter 4, Backup, Replication, and Recovery gives information around the Backup, Restoration and Replication of Helix Core, including some guidance on planning for HA (High Availability) and DR (Disaster Recovery)

Chapter 5, Server Upgrades also covers upgrades of p4d and related executables as well as the SDP itself.

Chapter 6, Maximizing Server Performance covers optimizations and proactive actions.

Chapter 7, Tools and Scripts covers all the scripts used within the SDP in detail.

Appendix A, SDP Package Contents address details of the SDP package.

Appendix C, Starting and Stopping Services gives on overview of starting and stopping services with common init mechanisms, systemd and SysV.

1.2. Getting the SDP

The SDP is downloaded as a single zipped tar file the latest version can be found at:

The file to download containing the latest SDP is consistently named sdp.Unix.tgz. A copy of this file also exists with a version-identifying name, e.g. sdp.Unix.2019.3.26571.tgz.

The direct download link to use with curl or wget is illsustated with this command:

curl -k -O

2. Setting up the SDP

This section tells you how to configure the SDP to setup a new Helix Core server.

The SDP can be installed on multiple server machines, and each server machine can host one or more Helix Core server instances.

The SDP implements a standard logical directory structure which can be implemented fleixbly on one or many physical server machines.

Additional relevant information is available in the System Administrator Guide.

2.1. Terminology and pre-requisites

  1. The term server refers to a Helix Core server instance, unless otherwise specified.

  2. The term metadata refers to the Helix Core database files.

  3. Instance: a separate Helix Core instantiation, with its own data set, set of users, files and changelists managed by a p4d service.


  1. The Helix Core binaries (p4d, p4, p4broker, p4p) have been downloaded (see Chapter 3, Installing the SDP on Unix / Linux)

  2. sudo access is required

  3. System administrator available for configuration of drives / volumes (especially if on network or SAN or similar)

  4. Supported Linux version, currently these versions are fully supported - for other versions please speak with Perforce Support.

    • Ubuntu 18.04 LTS (bionic)

    • Ubuntu 20.04 LTS (focal fossa)

    • CentOS or Red Hat (RHEL) 7.x

    • CentOS or Red Hat (RHEL) 8.x

    • SUSE Linux Enterprise Server 12

We have seen CentOS/RHEL perform noticably better than Ubuntu with the same storage (e.g. All Flash arrays, and SAN drives) - and thus recommend it.

2.2. Volume Layout and Hardware

As can be expected from a version control system, good disk (storage) management is key to maximising data integrity and performance. Perforce recommend using multiple physical volumes for each server instance. Using three or four volumes per instance reduces the chance of hardware failure affecting more than one instance. When naming volumes and directories the SDP assumes the "hx" prefix is used to indicate Helix volumes (your own naming conventions/standards can be used instead). For optimal performance on UNIX machines, the XFS file system is recommended but not mandated.

  • Depot data, archive files, scripts, and checkpoints: Use a large volume, with RAID 6 on its own controller with a standard amount of cache or a SAN or NAS volume (NFS access is fine).

This volume is the only volume that must be backed up. The SDP backup scripts place the metadata snapshots on this volume.

+ This volume is normally called /hxdepots.

  • Perforce metadata (database files), 1 or 2 volumes: Use the fastest volume possible, ideally SSD or RAID 1+0 on a dedicated controller with the maximum cache available on it. Typically a single volume is used, /hxmetadata. In some sites with exceptionally large metadata, 2 volumes are used for metadata, /hxmetadata and /hxmetadata2

Do not run anti-virus tools or back up tools against the hxmetadata volume(s) or hxlogs volume(s), because they can interfere with the operation of the Perforce server.
  • Journals and logs: a fast volume, ideally SSD or RAID 1+0 on its own controller with the standard amount of cache on it. This volume is normally called /hxlogs and can optionally be backed up.

    If a separate logs volume is not available, put the logs on the /hxmetadata or /hxmetadata1 volume, as metdata and logs have similar performance needs that differ from /hxdepots.

Storing metadata and logs on the same volume is discouraged, since the redundancy benefit of the P4JOURNAL (stored on /hxlogs) is greatly reduced if P4JOURNAL is on the same volume as the metadata in the P4ROOT directory.
If multiple controllers are not available, put the /hxlogs and /hxdepots volumes on the same controller.

The SDP will create a "convenience" directory containing links to the volumes for each instance named /p4. The volume layout is shown in Appendix A, SDP Package Contents. This convenience directory enables easy access to the different parts of the file system for each instance.

For example:

  • /p4/1/root contains the database files for instance 1

  • /p4/1/logs contains the log files for instance 1

  • /p4/1/bin contains the binaries and scripts for instance 1

  • /p4/common/bin contains the binaries and scripts common to all instances

3. Installing the SDP on Unix / Linux

3.1. Automated Install

If you are doing a "green field" install, a first-time installation on a new machine that does not yet have any Perforce Helix data, then the Helix Installer should be used.

3.2. Manual Install

The following documentation covers internal details of how the SDP can be deployed manually. Many of the steps below are performed by the Helix Installer.

To install Perforce Server and the SDP, perform the steps laid out below:

  • Set up a user account, file system, and configuration scripts.

  • Run the configuration script.

  • Start the server and configure the required file structure for the SDP.

  1. If it doesn’t already exist, create a group called perforce:

    sudo groupadd perforce
  2. Create a user called perforce and set the user’s home directory to /p4 on a local disk.

    sudo useradd -d /p4 -s /bin/bash -m perforce -g perforce
  3. Allow the perforce user sudo access

    sudo echo "perforce ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/perforce
  4. Create or mount the server file system volumes (per layout in previous section)

    • /hxdepots

    • /hxlogs

      and either:

    • /hxmetadata


    • /hxmetadata1

    • /hxmetadata2

  5. These directories should be owned by: perforce:perforce

    sudo chown -R perforce:perforce /hx*
  6. (Optional) if you have different root directories, or are putting all files into one mounted filesystem (only recommended for small repositories), then do something like the following:

    Option 1, all under a single directory /data:

    cd /data
    mkdir hxmetadata hxlogs hxdepots
    sudo chown -R perforce:perforce /data/hx*
    cd /
    ln -s /data/hx* .
    sudo chown -h perforce:perforce /hx*

    Option 2, different mounted root folders, e.g. /P4metadata, /P4logs, /P4depots:

    sudo chown -R perforce:perforce /P4metadata /P4logs /P4depots
    cd /
    ln -s /P4Medata hxmetadata
    ln -s /P4logs hxlogs
    ln -s /P4depots hxdepots
    sudo chown -h perforce:perforce /hx*
  7. Extract the SDP tarball.

    cd /hxdepots
    tar -xzf /WhereYouDownloaded/sdp.Unix.tgz
  8. Set environment variable SDP.

    export SDP=/hxdepots/sdp
  9. Make the entire $SDP (/hxdepot/sdp) directory writable:

    chmod -R +w $SDP
  10. Download the appropriate p4, p4d and p4broker binaries for your release and platform:

    cd /hxdepots/sdp/helix_binaries

    If you want to ensure a particular release:

    cd /hxdepots/sdp/helix_binaries
    ./ r20.2

3.2.1. Manual Install Initial setup

The next steps highlight the setup and configuration of a new Helix Core instance using the script included in the SDP.

USAGE for v4.2.0: <instance> [-s <ServerID>] [-t <server_type>] [-MDD /bigdisk] [-MLG /jnl] [-MDB1 /db1] [-MDB2 /db2 ] [-f] [-p] [-test [-clean]] [-n] [-L <log>] [-d|-D]

or [-h|-man]


This script initializes an SDP instance on a single machine.

This script is intended to support two scenarios:

* First time SDP installation on a given machine.
* Adding new SDP instances (separate Helix Core data sets) to an existing
  SDP installation on a given machine.

And SDP instance is a single Helix Core data set, with its own unique
set of one set of users, changelist numbers, jobs, labels, versioned
files, etc. An organization may run a single instance or multiple

This is intended to be run either as root or as the operating system
user account (OSUSER) that p4d is configured to run as, typically
'perforce'.  It should be run as root for the initial install.
Subsequent additions of new instances do not require root.

If an initial install as done by a user other than root, various
directories must exist and be writable and owned by 'perforce' before starting:

* /p4
* /hxdepots
* /hxlogs
* /hxmetadata

This script creates an init script in the /p4/N/bin directory.

After running this script, set up the crontab based on templates
generated in /p4/common/etc/cron.d.  For convenience, a sample cronat
is generated for the current machine in /p4/common/etc/cron.d named


where <osuser> is the user that services run as (typically 'perforce'),
and <host> is the short hostname (as returned by a 'hostname -s' command).

Next, put the license file in place in the P4ROOT dir, and launch the server
with the init script.

Then run /p4/common/bin/p4master_run instance /p4/common/bin/
and then run both the and to
make sure everything is working before setting up the crontab.

Also run /p4/common/bin/p4master_run <instance> /p4/common/bin/ <instance>
to make sure the review script is working properly.  If you intend to use
Swarm, you can skip configuration of the review daemon, and instead configure
Swarm to handle review-style email notifications.

	Specify the SDP instance name to add.  This is a reference to the Perforce
	Helix Core data set.

 -s <ServerID>
	Specify the ServerID, overriding the REPLICA_ID setting in the configuration

 -S <TargetServerID>
	Specify the ServerID of the P4TARGET of the server being installed.
	Use this when setting up an edge server.

 -t <server_type>
	Specify the server type, overriding the SERVER_TYPE setting in the config
	file.  Valid values are:
	* p4d_master - A master/commit server.
	* p4d_replica - A replica with all metadata from the master (not filtered in any way).
	* p4d_filtered_replica - A filtered replica or filtered forwarding replica.
	* p4d_edge - An edge server.
	* p4d_edge_replica - Replica of an edge server. If used, '-S <TargetServerID>'
	  is required.
	* p4broker - An SDP host running only a broker, with no p4d.
	* p4proxy - An SDP host running a proxy (maybe with a broker in front), with no p4d.

 -MDD /bigdisk
 -MLG /jnl
 -MDB1 /db1
 -MDB2 /db2
	Specify the '-M*' to specify mount points, overriding DD/LG/DB1/DB2
	settings in the config file.  Sample:

	-MDD /bigdisk -MLG /jnl -MDB1 /fast

	If -MDB2 is not specified, it is set the the same value as -MDB1 if
	that is set, or else it defaults to the same default value as DB1.

 -f	Specify -f 'fast mode' to skip chown/chmod commands on depot files.
	This should only be used when you are certain the ownership and
	permissions are correct, and if you have large amounts of existing
	data for which the chown/chmod of the directory tree would be

 -p	Specify '-p' to halt processing after preflight checks are complete,
	and before actual processing starts. By default, procesing starts
	immediately upon successful completion of preflight checks.

 -L <log>
	Specify the path to a log file, or the special value 'off' to disable
	logging.  By default, all output (stdout and stderr) goes to this file
	in the current directory:


	NOTE: This script is self-logging.  That is, output displayed on the screen
	is simultaneously captured in the log file.  Do not run this script with
	redirection operators like '> log' or '2>&1', and do not use 'tee.'

 -test	Specify '-test' to execute a simulated install to /tmp/p4 as the install
	root (rather than /p4), and with the mount point directories specifed in
	the configuration file prefixed with /tmp/hxmounts, defaulting to:
	* /tmp/hxmounts/hxdepots
	* /tmp/hxmounts/hxlogs
	* /tmp/hxmounts/hxmetadata

	Specify '-clean' with '-test' to clean up from prior test installs,
	which will result in removal of files/folders installed under /tmp/hxmounts
	and /tmp/p4.

 	Do not specify '-clean' if you want to test a series of installs.

 -n	No-Op.  In No-Op mode, no actions that affect data or structures are taken.
	Instead, commands that would be run are displayed.  This is an alternative
	to -test. Unlike '-p' which stops after the preflight checks, with '-n' more
	processing logic can be exercised, with greater detail about what commands
	that would be executed without '-n'.

 -d     Increase verbosity for debugging.

 -D     Set extreme debugging verbosity, using bash '-x' mode. Also implies -d.

 -h	Display short help message
 -man	Display man-style help message

	The script uses a configuration file for many settings.  A
	sample file, mkdirs.cfg, is included with the SDP.  After determining
	your SDP instance name (e.g. '1' or 'abc'), create a configuration
	file for it named mkdirs.<N>.cfg, replacing 'N' with your instance.

	Running ' N' will load configuration settings from mkdirs.N.cfg.

	This script can be useful in testing and upgrading to new versions of the SDP,
	when the '-test' flag is used.

	Example 1: Setup of first instance

	Setup of the first instance on a machine using the default instance name,
	'1', executed after using sudo to become root:
	$ sudo su -
	$ cd /hxdepots/sdp/Server/Unix/setup
	$ vi mkdirs.cfg

	# Adjust settings as desired, e.g P4PORT, P4BROKERPORT, etc.

	$ ./

	A log will be generated, mkdirs.1.<timestamp>.log

	Example 2: Setup of additional instance named 'abc'.

	Setup a second instanced on the machine, which will be a seprate Helix Core
	instantce with its own P4ROOT, its own set of users and changelists, and
	its own license file (copied from the master instance).

	Note that while the first run of on a given machine should be done
	as root, but subsequent instane additions should be done as the 'perforce'
	user (or whatever operating system user accounts Perforce Helix services run

	$ sudo su - perforce
	$ cd /hxdepots/sdp/Server/Unix/setup
	$ cp -p mkdirs.cfg
	$ vi

	# Adjust settings in as desired, e.g P4PORT, P4BROKERPORT, etc.

	$ ./ abc

	A log will be generated,<timestamp>.log
If you use a "name" for the instance (not an integer) you MUST modify the P4PORT variable in the file.
The instance name must map to the name of the cfg file or the default file will be used with potentially unexpected results.

For example, 1 requires mkdirs.1.cfg, or lon requires mkdirs.lon.cfg

  1. Put the Perforce license file for the server into /p4/1/root

if you have multiple instances and have been provided with port-specific licenses by Perforce, the appropriate license file must be stored in the appropriate /p4/<instance>/root folder.
the license file must be renamed to license

Your Helix Core instance is now setup, but not running. The next steps detail how to make the Helix Core server a system service.

You are then free to start up the p4d instance as documented Section, “Starting/Stopping Perforce Server Products”

Please note that if you have configured SSL, then refer to Section, “Use of SSL” Use of SSL

As documented in the comments in mkdirs.cfg, if you are planning to use SSL you need to set the value of:


Then you need to put certificates in /p4/ssl after the SDP install or you can generate a self signed certificate as follows:

Edit /p4/ssl/config.txt to put in the info for your company. Then run:

/p4/common/bin/p4master_run <instance> /p4/<instance>/p4d_<instance> -Gc

For example using instance 1:

/p4/common/bin/p4master_run 1 /p4/1/bin/p4d_1 -Gc

In order to validate that SSL is working correctly:

source /p4/common/bin/p4_vars 1

Check that P4TRUST is appropriately set in the output of:

p4 set

Update the P4TRUST values:

p4 trust -y
p4 -p $P4MASTERPORT trust -y

Check the stored P4TRUST values:

p4 trust -l

Check you are not prompted for trust:

p4 login
p4 info Configuration script mkdirs.cfg

The script executed above resides in $SDP/Server/Unix/setup. It sets up the basic directory structure used by the SDP. Carefully review the config file mkdirs.instance.cfg for this script before running it, and adjust the values of the variables as required. The important parameters are:

Parameter Description


Name of the hxmetadata1 volume (can be same as DB2)


Name of the hxmetadata2 volume (can be same as DB1)


Name of the hxdepots volume


Name of the hxlogs volume


Volume for /p4/common


Path to SDP distribution file tree


TRUE or FALSE - whether sharing the /hxdepots volume with a replica - normally this is FALSE


P4USER value of a Perforce super user that operates SDP scripts, typically perforce or p4admin.


Operating system user that will run the Perforce instance, typically perforce.


Operating system group that OSUSER belongs to, typically perforce.


Indicates if server has special case sensitivity settings


Set if SSL is required so either "ssl:" or blank for no SSL



Password to use for Perforce superuser account - can be edited later in /p4/common/config/.p4password.p4_1.admin

Service User’s password for replication - can be edited later - same dir as above.


Fully qualified DNS name of the Perforce master server machine for this instance. If an HA for an edge server this should refer to the edge server. Otherwise refer to the commit server.

For a detailed description of this config file it is fully documented with in-file comments, or see

3.2.2. Configuring (Automatic) Service Start on Boot

You normally want to configure your host such that the Helix Core Server (and/or Proxy or Broker) will autostart when the machine boots.

This is done using Systemd or Init scripts as covered below. For Systems using systemd

RHEL 7 or 8, CentOS 7 or 8, SuSE 12, Ubuntu (>= v16.04) (and other) distributions utilize systemd / systemctl as the mechanism for controlling services, replacing the earlier init process. At present does not generate the systemd configuration file(s) automatically, but a sample is included in the SDP distribution in ($SDP/Server/Unix/setup/systemd), along with a file that describes the configuration process, including for multiple instances.

We recommend that you give the OS user (perforce) sudo access, so that it can run the commands below prefixing them with sudo.

For simple installation run these commands as the root user (or prefix with sudo):

cp $SDP/Server/Unix/setup/system/p4d_1.system /etc/systemd/system/
sudo systemctl enable p4d_1

|The above enables service for auto-start on boot. The following show management commands:

sudo systemctl status p4d_1
sudo systemctl start p4d_1
sudo systemctl stop p4d_1
If you are using systemd and you have configured systemctl services, then it is vital you ALWAYS use systemctl to start/stop etc. Otherwise you risk database corruption if systemd does not think the service is running when it actually is running (for example - on shutdown systemd will just kill processes without doing it cleanly and waiting for them, because it thinks the service is not running). For (older) systems using the SysV init mechanism (init.d)

The script creates a set of startup scripts in the instance-specific bin folder:

/p4/1/bin/p4broker_1_init     # only created if a p4broker executable found
/p4/1/bin/p4p_1_init          # only created if a p4p executable found

Run these commands as the root user (or sudo): Repeat this step for all init scripts you wish to add.

cd /etc/init.d
ln -s /p4/1/bin/p4d_1_init
chkconfig --add p4d_1_init
chkconfig p4d_1_init on Starting/Stopping Perforce Server Products

The SDP includes templates for initialization (start/stop) scripts, "init scripts," for a variety of Perforce server products, including:

  • p4d

  • p4broker

  • p4p

  • p4dtg

The init scripts are named /p4/<instance>/bin/<service>_<instance>_init, e.g. /p4/1/bin/p4d_1_init or /p4/1/bin/p4broker_1_init.

For example, the init script for starting p4d for Instance 1 is /p4/1/bin/p4d_1_init. All init scripts accept at least start, stop, and status arguments. The perforce user can start p4d by calling:

p4d_1_init start

And stop it by calling:

p4d_1_init stop

Once logged into Perforce as a super user, the p4 admin stop command can also be used to stop p4d.

All init scripts can be started as the perforce user or the root user. The application runs as the perforce user in any case. If the init scripts are configured as system services (non-systemd distributions), they can also be called by the root user using the service command, as in this example to start p4d:

service p4d_1_init start

Templates for the init scripts used by are stored in:


There are also basic crontab templates for a Perforce master and replica server in:


These define schedules for routine checkpoint operations, replica status checks, and email reviews.

The Perforce should have a super user defined as named by the P4USER setting in mkdir.

To configure and start instance 1, follow these steps:

  1. Start the Perforce server by calling

    p4d_1_init start

    or use sudo systemctl start p4d_1 if using sytemd

3.2.3. Completing Your Server Configuration

  1. Ensure that the admin user configured above has the correct password defined in /p4/common/config/.p4passwd.p4_1.admin, and then run the p4login1 script (which calls the p4 login command using the .p4passwd.p4_1.admin file).

  2. For new servers, run this script, which sets several recommended configurables:

    cd /p4/sdp/Server/setup/ 1

For existing servers, examine this file, and manually apply the p4 configure command to set configurables on your Perforce server.

Initialize the perforce user’s crontab with one of these commands:

crontab /p4/p4.crontab

and customise execution times for the commands within the crontab files to suite the specific installation.

The SDP uses wrapper scripts in the crontab:,, We suggest you ensure these are working as desired, e.g.

/p4/common/bin/ 1 echo yes
/p4/common/bin/ 1 echo yes
/p4/common/bin/ 1 echo yes

The above should output yes if you are on the master (commit) machine (or replica/edge as appropriate), but otherwise nothing. Any issues with the above indicate incorrect values for $MASTER_ID, or for other values within /p4/common/config/p4_1.vars (assuming instance 1). You can debug this with:

bash -xv /p4/common/bin/ 1 echo yes

If in doubt contact support.

3.2.4. Validating your SDP installation

Source your SDP environment variables and check that they look appropriate - for <instance> 1:

source /p4/common/bin/p4_vars 1

The output of p4 set should be something like:

P4CONFIG=/p4/1/.p4config (config 'noconfig')

There is a script /p4/common/bin/ Run this specifying the <instance> id, e.g.

/p4/common/bin/ 1

The output should be something like: v5.6.1 Starting SDP verification on host helixcorevm1 at Fri 2020-08-14 17:02:45 UTC with this command line:
/p4/common/bin/ 1
If you have any questions about the output from this script, contact
Doing preflight sanity checks.
Preflight Check: Ensuring these utils are in PATH: date ls grep awk id head tail
Verified: Essential tools are in the PATH.
Preflight Check: cd /p4/common/bin
Verified: cd works to: /p4/common/bin
Preflight Check: Checking current user owns /p4/common/bin
Verified: Current user [perforce] owns /p4/common/bin
Preflight Check: Checking /p4 and /p4/<instance> are local dirs.
Verified: P4HOME has expected value: /p4/1
Verified: This P4HOME path is not a symlink: /p4/1
Verified: cd to /p4 OK.
Verified: Dir /p4 is a local dir.
Verified: cd to /p4/1 OK.
Verified: P4HOME dir /p4/1 is a local dir.

Finishing with:

Verifications completed, with 0 errors and 0 warnings detected in 57 checks.

If it mentions something like:

Verifications completed, with 2 errors and 1 warnings detected in 57 checks.

then review the details. If in doubt contact Perforce Support:

3.3. Setting your login environment for convenience

Consider adding this to your .bashrc for the perforce user as a convenience for when you login:

echo "source /p4/common/bin/p4_vars 1" >> ~/.bashrc

Obviously if you have multiple instances on the same machine you might want to setup an alias or two to quickly switch between them.

3.4. Configuring protections, file types, monitoring and security

After the server is installed and configured, either with the Helix Installer or a manual installation, wmost sites will want to modify server permissions ("Protections") and security settings. Other common configuration steps include modifying the file type map and enabling process monitoring. To configure permissions, perform the following steps:

  1. To set up protections, issue the p4 protect command. The protections table is displayed.

  2. Delete the following line:

    write user * * //depot/...
  3. Define protections for your server using groups. Perforce uses an inclusionary model. No access is given by default, you must specifically grant access to users/groups in the protections table. It is best for performance to grant users specific access to the areas of the depot that they need rather than granting everyone open access, and then trying to remove access via exclusionary mappings in the protect table even if that means you end up generating a larger protect table.

  4. To set the server’s default file types, run the p4 typemap command and define typemap entries to override Perforce’s default behavior.

  5. Add any file type entries that are specific to your site. Suggestions:

    • For already-compressed file types (such as .zip, .gz, .avi, .gif), assign a file type of binary+Fl to prevent the server from attempting to compress them again before storing them.

    • For regular binary files, add binary+l to make so that only one person at a time can check them out.

    A sample file is provided in $SDP/Server/config/typemap

If you are doing things like games development with Unreal Engine or Unity, then there are specific recommended typemaps to add in KB articles: Search the Knowledge Base

  1. To make your changelists default to restricted (for high security environments):

    p4 configure set defaultChangeType=restricted

3.5. Operating system configuration

Check Chapter 6, Maximizing Server Performance for detailed recommendations.

3.6. Other server configurables

There are various configurables that you should consider setting for your server.

Some suggestions are in the file: $SDP/Server/setup/

Review the contents and either apply individual settings manually, or edit the file and apply the newly edited version. If you have any questions, please see the configurables section in Command Reference Guide appendix (get the right version for your server!). You can also contact support regarding questions.

3.7. Archiving configuration files

Now that the server is running properly, copy the following configuration files to the hxdepots volume for backup:

  • Any init scripts used in /etc/init.d or any systemd scripts to /etc/systemd/system

  • A copy of the crontab file, obtained using crontab -l.

  • Any other relevant configuration scripts, such as cluster configuration scripts, failover scripts, or disk failover configuration files.

4. Backup, Replication, and Recovery

Perforce servers maintain metadata and versioned files. The metadata contains all the information about the files in the depots. Metadata resides in database (db.*) files in the server’s root directory (P4ROOT). The versioned files contain the file changes that have been submitted to the server. Versioned files reside on the hxdepots volume.

This section assumes that you understand the basics of Perforce backup and recovery. For more information, consult the Perforce System Administrator’s Guide and failover.

4.1. Typical Backup Procedure

The SDP’s maintenance scripts, run as cron tasks, periodically back up the metadata. The weekly sequence is described below.

Seven nights a week, perform the following tasks:

  1. Truncate the active journal.

  2. Replay the journal to the offline database. (Refer to Figure 2: SDP Runtime Structure and Volume Layout for more information on the location of the live and offline databases.)

  3. Create a checkpoint from the offline database.

  4. Recreate the offline database from the last checkpoint.

Once a week, perform the following tasks:

  1. Verify all depot files.

Once every few months, perform the following tasks:

  1. Stop the live server.

  2. Truncate the active journal.

  3. Replay the journal to the offline database. (Refer to Figure 2: SDP Runtime Structure and Volume Layout for more information on the location of the live and offline databases.)

  4. Archive the live database.

  5. Move the offline database to the live database directory.

  6. Start the live server.

  7. Create a new checkpoint from the archive of the live database.

  8. Recreate the offline database from the last checkpoint.

  9. Verify all depots.

This normal maintenance procedure puts the checkpoints (metadata snapshots) on the hxdepots volume, which contains the versioned files. Backing up the hxdepots volume with a normal backup utility like robocopy or rsync provides you with all the data necessary to recreate the server.

To ensure that the backup does not interfere with the metadata backups (checkpoints), coordinate backup of the hxdepots volume using the SDP maintenance scripts.

The preceding maintenance procedure minimizes server downtime, because checkpoints are created from offline or saved databases while the server is running.

With no additional configuration, the normal maintenance prevents loss of more than one day’s metadata changes. To provide an optimal Recovery Point Objective (RPO), the SDP provides additional tools for replication.

4.2. Planning for HA and DR

The concepts for HA (High Availability) and DR (Disaster Recovery) are fairly similar - they are both types of Helix Core replica.

When you have servers with Services of commit-server, standard, or edge-server - see deployment architectures you should consider your requirements for how to recover from a failure to any such servers.

The key issues are around ensuring that you have have appropriate values for the following measures for your Helix Core installation:

  • RTO - Recovery Time Objective - how long will it take you to recover to a backup?

  • RPO - Recovery Point Objective - how much data are you prepared to risk losing if you have to failover to a backup server?

We need to consider planned vs unplanned failover. Planned may be due to upgrading the core Operating System or some other dependency in your infrastructure, or a similar activity.

Unplanned covers risks you are seeking to mitigate with failover:

  • loss of a machine, or some machine related hardware failure (e.g. network)

  • loss of a VM cluster

  • failure of storage

  • loss of a data center or machine room

  • etc…​

So, if your main commit-server fails, how fast should be you be able to be up and running again, and how much data might you be prepared to lose? What is the potential disruption to your organisation if the Helix Core repository is down? How many people would be impacted in some way?

You also need to consider the costs of your mitigation strategies. For example, this can range from:

  • taking a backup once per 24 hours and requiring maybe an hour or two to restore it. Thus you might lose up to 24 hours of work for an unplanned failure, and require several hours to restore.

  • having a high availability replica which is a mirror of the server hardware and ready to take over within minutes if required

Having a replica for HA or DR is likely to reduce your RPO and RTO to well under an hour (<10 minutes if properly prepared for) - at the cost of the resources to run such a replica, and the management overhead to monitor it appropriately.

Typically we would define:

  • An HA replica is close to its upstream server, e.g. in the same Data Center - this minimises the latency for replication, and reduces RPO

  • A DR replica is in a more remote location, so maybe risks being further behind in replication (thus higher RPO), but mitigates against catastrophic loss of a data center or similar. Note that "further behind" is still typically seconds for metadata, but can be minutes for submits with many GB of files.

4.2.1. Further Resources

4.2.2. Creating a Failover Replica for Commit or Edge Server

A commit server is the ultimate store for submitted data, and also for any workspace state (WIP - work in progress) for users directly working with the commit server.

An edge server maintains its own copy of workspace state (WIP). If you have people connecting to an edge server, then any workspaces they create (and files they open for some action) will be only stored on the edge server. Thus it is normally recommended to have an HA backup server, so that users don’t lose their state in case of failover.

There is a concept of a "build edge" which is an edge server which only supports build farm users. In this scenario it may be deemed acceptable to not have an HA backup server, since in the case of failure of the edge, it can be re-seeded from the commit server. All build farm clients would be recreated from scratch so there would be no problems.

4.2.3. What is a Failover Replica?

As of 2018.2 release, p4d supports a standby replica (replica with Services set to standby or forwarding-standby). Such a replica performs a journalcopy replication of metadata, with a local pull thread to update its db.* files.

On Unix the SDP script Section 4.3.4, “Using” does all you require.

4.2.4. Mandatory vs Non-mandatory Standbys

When defining a standby server, you run p4 server commit-standby for example, to get:

ServerID:     commit-standby
Type:         server
Address:      {standbyserver host}:{port number}
Services:     standby
Options:      nomandatory
ReplicatingFrom:     {commit-server-ID}
Description:    Standby server for {commit-server-ID}.

The Options field can be nomandatory or mandatory.

In the case of mandatory, the upstream commit server will wait until this server confirms it has processed and journal entries before responding to other downstream replicas. This allows easy failover, since it is guaranteed that no downstream servers is ahead of the replica.

Thus downstream servers can simply be re-directed to point to the standby and will carry on working without problems.

If a server which is marked as mandatory goes offline for any reason, the replication to other replicas will STOP - and it may not be obvious why it has stopped! Thus it is very important to monitor very carefully your "mandatory" replicas!

If set to nomandatory then there is no risk of delaying dowsntream replicas, however there is equally no guarantee that they will be able to switch seamlessly over to the new server.

We recommend creating mandatory replica(s) if the server is local to its commit server, and also if you have good monitoring in place to quickly detect replication lag or other issues.

4.2.5. Server host naming conventions

This is recommended, but not a requirement for SDP scripts to implement failover.

  • Use a name that does not indicate switchable roles, e.g. don’t indicate in the name whether a host is a master/primary or backup, or edge server and it’s backup. This might otherwise lead to confusion once you have performed a failover and the host name is no longer appropriate.

  • Use names ending numeric designators, e.g. -01 or -05. The goal is to avoid being in a post-failover situation where a machine with master or primary is actually the backup. Also, the assumption is that host names will never need to change.

  • While you don’t want switchable roles baked into the hostname, you can have static roles, e.g. use p4d vs. p4p in the host name (as those generally don’t change). The p4d could be primary, standby, edge, edge’s standby (switchable roles).

  • Using a short geographic site is sometimes helpful/desirable. If used, use the same site tag used in the ServerID, e.g. aus.

    Valid site tags should be listed in: /p4/common/config/SiteTags.cfg - see Section, “SiteTags.cfg”

  • Using a short tag to indicate the major OS version is sometimes helpful/desirable, eg. c7 for CentOS 7, or r8 for RHEL 8. This is based on the idea that when the major OS is upgraded, you either move to new hardware, or change the host name (an exception to the rule above about never changing the hostname). This option maybe overkill for many sites.

  • End users should reference a DNS name that may include the site tag, but would exclude the number, OS indicator, and server type (p4d/p4p/p4broker), replacing all that with just perforce or optionally just p4. General idea is that users needn’t be bothered by under-the-covers tech of whether something is a proxy or replica.

  • For edge servers, it is advisable to include edge in both the host and DNS name, as users and admins needs to be aware of the functional differences due to a server being an edge server.


  • p4d-aus-r7-03, a master in Austin on RHEL 7, pointed to by a DNS name like p4-aus.

  • p4d-aus-03, a master in Austin (no indication of server OS), pointed to by a DNS name like p4-aus.

  • p4d-aus-r7-04, a standby replica in Austin on RHEL 7, not pointed to by a DNS until failover, at which point it gets pointed to by p4-aus.

  • p4p-syd-r8-05, a proxy in Sydney on RHEL 8, pointed to by a DNS name like p4-syd.

  • p4d-syd-r8-04, a replica that replaced the proxy in Sydney, on RHEL 8, pointed to by a DNS name like p4-syd (same as the proxy it replaced).

  • p4d-edge-tok-s12-03, an edge in Tokyo running SuSE12, pointed to by a DNS name like p4edge-tok.

  • p4d-edge-tok-s12-04, a replica of an edge in Tokyo running SuSE12, not pointed to by a DNS name until failover, at which point it gets pointed to by p4edge-tok.

FQDNs (fully qualified DNS names) of short DNS names used in these examples would also exist, and would be based on the same short names.

4.3. Full One-Way Replication

Perforce supports a full one-way replication of data from a master server to a replica, including versioned files. The p4 pull command is the replication mechanism, and a replica server can be configured to know it is a replica and use the replication command. The p4 pull mechanism requires very little configuration and no additional scripting. As this replication mechanism is simple and effective, we recommend it as the preferred replication technique. Replica servers can also be configured to only contain metadata, which can be useful for reporting or offline checkpointing purposes. See the Distributing Perforce Guide for details on setting up replica servers.

If you wish to use the replica as a read-only server, you can use the P4Broker to direct read-only commands to the replica or you can use a forwarding replica. The broker can do load balancing to a pool of replicas if you need more than one replica to handle your load.

4.3.1. Replication Setup

To configure a replica server, first configure a machine identically to the master server (at least as regards the link structure such as /p4, /p4/common/bin and /p4/instance/*), then install the SDP on it to match the master server installation. Once the machine and SDP install is in place, you need to configure the master server for replication.

Perforce supports many types of replicas suited to a variety of purposes, such as:

  • Real-time backup,

  • Providing a disaster recovery solution,

  • Load distribution to enhance performance,

  • Distributed development,

  • Dedicated resources for automated systems, such as build servers, and more.

We always recommend first setting up the replica as a read-only replica and ensuring that everything is working. Once that is the case you can easily modify server specs and configurables to change it to a forwarding replica, or an edge server etc.

4.3.2. Replication Setup for Failover

This is just a special case of replication, but implementing Section 4.2.3, “What is a Failover Replica?”

Please note the section below Section 4.3.4, “Using” which implements many details.

4.3.3. Pre-requisites for Failover

These are vital as part of your planning.

  • Obtain and install a license for your replica(s)

    Your commit or standard server has a license file (tied to IP address), while your replicas do not require one to function as replicas.

    However, in order for a replica to function as a replacement for a commit or standard server, it must have a suitable license installed.

    This should be requested when the replica is first created. See the form:

  • Review your authentication mechanism (LDAP etc) - is the LDAP server contactable from the replica machine (firewalls etc configured appropriately).

  • Review all your triggers and how they are deployed - will they work on the failover host?

    Is the right version of Perl/Python etc correctly installed and configured on the failover host with all imported libraries?

TEST, TEST, TEST!!! It is important to test the above issues as part of your planning. For peace of mind you don’t want to be finding problems at the time of trying to failover for real, which may be in the middle of the night!

On Linux:

4.3.4. Using

The SDP script should be used to expand your Helix Topology, e.g. adding replicas and edge servers.

When creating server machines to be used as Helix servers, the server machines should be named following a well-designed host naming convention. The SDP has no dependency on the convetion used, and so any existing local naming convetion can be applied. The SDP includes a suggesetd naming convention in Section 4.2.5, “Server host naming conventions”
USAGE for v2.5.1: -i <SDP_Instance> -t <Type> -s <Site_Tag> -r <Replica_Host> [-f <From_ServerID>] [-p] [-L <log>] [-v<n>] [-n] [-D]

or [-h|-man|-V]

	This script simplifies the task of creating Helix Core replicas and
	edge servers, and helps ensure they are setup with best practices.

	This script does all the metadata configuration to be executed on the
	master server that must be baked into a seed checkpoint for creating
	the replica/edge. It also provides enough information to create,
	transfer, and load seed checkpoints into the replica/edge.

	Before using this script, a set of geograpic site tags must be defined.
	See the FILES: below for details on a site tags.

	This script adheres to the these SDP Standards:
	* Server Spec Naming Standard:
	* Journal Prefix Standard:

	When creating a replica or edge server, this script does the following:
	* Generates the server spec for the the replica.
	* Generates a server spec for master server (if needed).
	* Sets configurables ('p4 configure' settings) for replication.
	* Selects the correct 'Services' based on replica type.
	* Creates service user for the replica, and sets a password.
	* Creates service user for the master (if needed), and sets a password.
	* Addes newly created service users to the group 'ServiceUsers'.
	* Verifies the group ServiceUsers is granted super access in the
	protections table (and with the '-p', updations Protections).

	After these steps are completed, detailed instructions are presented
	to the user through the remaining steps needed to complete the
	deployment of the replica.  This starts with creating a new
	checkpoint to capture all the metadata changes made by this

	Service users created by this type are always of type 'service',
	and so will not consume a licensed seat.

	Service users also have an 'AuthMethod' of 'perforce' (not
	'ldap') as is required by 'p4d' for 'service' users.  Passwords
	set for service users are long 32 character random strings
	that are not stored, as they are never needed.  Login tickets for
	service users are generated using: p4login -service -v

 -i <SDP_Instance>
	Specify the SDP Instance.

 -t <Type>
	Specify the replica type tag. The type corresponds to the 'Type:' and
	'Services:' field of the server spec, which describes the type of services
	offered by a given replica.

	Valid values are:
	* ha:   High Availability standby replica, for 'p4 failover' (P4D 2018.2+)
	* ham:  High Availability metadata-only mandatory standby replica, for 'p4 failover' (P4D 2018.2+)
	* ro:   Read-Only standby replica.
	* rom:  Read-Only standby replica, Metadata only.
	* fr:   Forwarding Replica (Unfiltered).
	* fs:   Forwarding Standby (Unfiltered).
	* frm:  Forwarding Replica (Unfiltered, Metadata only).
	* fsm:  Forwarding Standby (Unfiltered, Metadata only).
	* ffr:  Filtered Forwarding Replica.  Not a valid failover target.
	* edge: Edge Server. Filtered by definition.

	Replicas with 'standby' are always unfiltered, and use the 'journalcopy'
	method of replication, which copies a byte-for-byte verbatim journal file
	rather than one that is merely logically equivalent.

	The tag has several purposes:
	1. Short Hand. Each tag represents a combination of 'Type:' and fully
	qualified 'Services:' values used in server specs.

	2. Distillation. Only the most useful Type/Services combinations have a
	shorthand form.

	3. For forwarding replicas, the name includes the critical distinction of
	whether any replication filtering is used; as filtering of any kind disqualifies
	a replica from being a potential failover target. (No such distinction is
	needed for edge servers, which are filtered by definition).

 -s <Site_Tag>
	Specify a geographic site tag indicating the location and/or data center where
	the replica will physically be located. Valid site tags are defined in the site
	tags file:


 -r <Replica_Host>
	Specify the target replica host.

 -f <From_ServerID>
	Specify ServerID of the P4TARGET server from which we are replicating.
	This is used to populate the 'ReplicatingFrom' field of the server
	spec. The value must be a valid ServerID.

	By default, this is determined dynamically by checking the ServerID
	of the master server. This option should be used if the target is
	something other than the master. For example, to create an HA replica
	of an edge server, you might specify something like '-f p4d_edge_syd'.

 -p	This script performs a check to ensure that the Protections table grants
	super access to the group ServiceUsers.

	By default, an error is displayed if the check fails, i.e. if super user
	access for the group ServiceUsers cannot be verified. This is
	because, by default, we want to avoid making changes to the Protections
	table. Some sites have local policies or custom automation that requires
	site-specific procedures to update the Protections table.

	If '-p' is specified, an attempt is made to append the Protections table
	an entry like:

	super group ServiceUsers * //...

 -v<n>	Set verbosity 1-5 (-v1 = quiet, -v5 = highest).

 -L <log>
	Specify the path to a log file, or the special value 'off' to disable
	logging. By default, all output (stdout and stderr) goes in the logs
	directory referenced by $LOGS environment variable, in a file named

	NOTE: This script is self-logging. That is, output displayed on the screen
	is simultaneously captured in the log file. Do not run this script with
	redirection operators like '> log' or '2>&1', and do not use 'tee.'

 -n	No-Op. Prints commands instead of running them.

 -D	Set extreme debugging verbosity.

 -h	Display short help message
 -man	Display man-style help message
 -V	Dispay version info for this script and its libraries.

	This Site Tags file defines the list of valid geographic site tags:

	The contains one-line entries of the form:

	<tag>: <description>

	where <tag> is a short alphanumeric tag name for a geographic location,
	data center, or other useful distinction. This tag is incorporated into
       	the ServerID of replicas or edge servers created by this script.  Tag
	names should be kept short, ideally no more than about 5 characters in

	The <description> is a one-line text description of what the tag
	refers to, which may contain spaces and ASCII punctuation.

	Blank lines and lines starting with a '#' are considered comments
	and are ignored.

	Example 1 - Set up a High Availability Replica

	Add an HA replica to instance 1 to run on host bos-helix-02: -i 1 -t ha -s bos -r bos-helix-02

	Example 2 - Edge Server

	Add an Edge server to instance acme to run on host syd-helix-04: -i acme -t edge -s syd -r syd-helix-04 SiteTags.cfg

The documentation references a SiteTags.cfg file used to register short tag names for geographic sites. Location is: /p4/common/config/SiteTags.cfg

# Valid Geographic site tags.

# Each is intended to indciate a geography, and optionally a specific Data
# Center (or Computer Room, or Computer Closet) within a given geographic
# location.
# The format is:
# Name:Description
# The Name must be alphanumeric only. The Description may contain spaces.
# Lines starting with # and blank lines are ignored.

bej: Beijing, China
bos: Boston, MA, USA
blr: Bangalore, India
chi: Chicago greater metro area
cni: Chennai, India
pune: Pune, India
lv: Las Vegas, NV, USA
mlb: Melbourne, Australia
syd: Sydney, Australia Output of

The output of (which is also written to a log file in /p4/<instance>/logs/mkrep.*) describes a number of steps required to continue setting up the replica after the metadata configuration performed by the script is done.

4.3.5. Addition Replication Setup

In addition to steps recommended by, there are other steps to be aware of to prepare a replica server machine.

4.3.6. SDP Installation

The SDP must first be installed on the replica server machine. If SDP already exists on the machine but not for the current instance, then must be used to add a new instance to the machine. SSH Key Setup

SSH keys for the perforce operating system user should be setup to allow the perforce user to ssh and rsync among the Helix server machines in the topoolgy. If no ~perforce/.ssh directory exist on a machine, it can be created with this command:

4.4. Recovery Procedures

There are three scenarios that require you to recover server data:

Metadata Depotdata Action required

lost or corrupt


Recover metadata as described below


lost or corrupt

Call Perforce Support

lost or corrupt

lost or corrupt

Recover metadata as described below.

Recover the hxdepots volume using your normal backup utilities.

Restoring the metadata from a backup also optimizes the database files.

4.4.1. Recovering a master server from a checkpoint and journal(s)

The checkpoint files are stored in the /p4/instance/checkpoints directory, and the most recent checkpoint is named p4_instance.ckp.number.gz. Recreating up-to-date database files requires the most recent checkpoint, from /p4/instance/checkpoints and the journal file from /p4/instance/logs.

To recover the server database manually, perform the following steps from the root directory of the server (/p4/instance/root).

Assuming instance 1:

  1. Stop the Perforce Server by issuing the following command:

    /p4/1/bin/p4_1 admin stop
  2. Delete the old database files in the /p4/1/root/save directory

  3. Move the live database files (db.*) to the save directory.

  4. Use the following command to restore from the most recent checkpoint.

    /p4/1/bin/p4d_1 -r /p4/1/root -jr -z /p4/1/checkpoints/p4_1.ckp.####.gz
  5. To replay the transactions that occurred after the checkpoint was created, issue the following command:

    /p4/1/bin/p4d_1 -r /p4/1/root -jr /p4/1/logs/journal
  1. Restart your Perforce server.

If the Perforce service starts without errors, delete the old database files from /p4/instance/root/save.

If problems are reported when you attempt to recover from the most recent checkpoint, try recovering from the preceding checkpoint and journal. If you are successful, replay the subsequent journal. If the journals are corrupted, contact Perforce Technical Support. For full details about backup and recovery, refer to the Perforce System Administrator’s Guide.

4.4.2. Recovering a replica from a checkpoint

This is very similar to creating a replica in the first place as described above.

If you have been running the replica crontab commands as suggested, then you will have the latest checkpoints from the master already copied across to the replica through the use of Section 7.5.30, “”.

See the steps in the script Section 7.5.30, “” for details (note that it deletes the state and rdb.lbr files from the replica root directory so that the replica starts replicating from the start of a journal).

Remember to ensure you have logged the service user in to the master server (and that the ticket is stored in the correct location as described when setting up the replica).

4.4.3. Recovering from a tape backup

This section describes how to recover from a tape or other offline backup to a new server machine if the server machine fails. The tape backup for the server is made from the hxdepots volume. The new server machine must have the same volume layout and user/group settings as the original server. In other words, the new server must be as identical as possible to the server that failed.

To recover from a tape backup, perform the following steps (assuming instance 1):

  1. Recover the hxdepots volume from your backup tape.

  2. Create the /p4 convenience directory on the OS volume.

  3. Create the directories /metadata/p4/1/root/save and /metadata/p4/1/offline_db.

  4. Change ownership of these directories to the OS account that runs the Perforce processes.

  5. Switch to the Perforce OS account, and create a link in the /p4 directory to /depotadata/p4/1.

  6. Create a link in the /p4 directory to /hxdepots/p4/common.

  7. As a super-user, reinstall and enable the init.d scripts

  8. Find the last available checkpoint, under /p4/1/checkpoints

  9. Recover the latest checkpoint by running:

    /p4/1/bin/p4d_1 -r /p4/1/root -jr -z <last_ckp_file>
  10. Recover the checkpoint to the offline_db directory (assuming instance 1):

    /p4/1/bin/p4d_1 -r /p4/1/offline_db -jr -z <last_ckp_file>
  11. Reinstall the Perforce server license to the server root directory.

  12. Start the perforce service by running 1/p4/1/bin/p4d_1_init start`

  13. Verify that the server instance is running.

  14. Reinstall the server crontab or scheduled tasks.

  15. Perform any other initial server machine configuration.

  16. Verify the database and versioned files by running the script. Note that files using the +k file type modifier might be reported as BAD! after being moved. Contact Perforce Technical Support for assistance in determining if these files are actually corrupt.

4.4.4. Failover to a replicated standby machine

5. Server Upgrades

This section describes typical maintenance tasks and best practices for administering server machines.

5.1. Upgrading an existing SDP installation

If you have an earlier version of the Server Deployment Package (SDP) installed, you’ll want to be aware of the new -test flag to the SDP setup script, e.g.

sudo 1 -test

This will install into /tmp and allow you to recursively diff the installed files with your existing installation and manually update as necessary.

See the instructions in the file / README.html in the root of the SDP directory.

5.2. P4D Server upgrades

Upgrading a Helix Core server instance in the SDP framework is a simple process involving a few steps.

5.2.1. Get Latest Helix Binaries

Acquire the latest Perforce Helix binaries to stage them for upgrade using the script.

If you have mulitple server machines with SDP, staging can be done with this script on one machine first, and then the /hxdepots/sdp/helix_binaries folder can be rsync’d to other machines.

Alternately, this script can be run on the each machine, but as patches can be released at any time, running it once and then distributing the helix_binaries directory internally via rsync is preferred to ensure all machines at your site deploy with the same binaries.

5.2.2. Upgrade Each Instance

Use the SDP script to upgrade each instance of Helix on the current machine, using the staged binaries. The upgrade process handles all aspects of upgrading, including adjusting the database structure, excuting commands to upgrade the p4d database schema, and managing the SDP symlinks in /p4/common/bin.

Instances can be upgraded independently of each other.

5.2.3. Global Topology Upgrades - Outer to Inner

For any given instance, be aware of the Helix topology when performing upgrades, specifically whether that instance has replicas and/or edge servers. When replicas and edge servers exist (and are active), the order in which must be run on different server machines matters. Perform upgrades following an "outer to inner" strategy.

For example, say for SDP instance 1, your site has the following server machines:

  • bos-helix-01 - The master (in Boston, USA)

  • bos-helix-02 - Replica of master (in Boston, USA)

  • nyc-helix-03 - Replica of master (in New York, USA)

  • syd-helix-04 - Edge Server (in Sydney, AU)

  • syd-helix-05 - Replica of Sydney edge (in Sydney)

Envision the above topology with the master server in the center, and two concentric circles.

The Replica of the Sydney edge would be done first, as it is by itself in the outermost.

The Edge server and two Replicas of the master are all at the next inner circle. So bos-helix-02, nyc-helix-03, and syd-helix-04 could be upgraded in any order with respect to each other, or even simultaneously, as they are in the same circle.

The master is the innermost, and would be upgraded last.

If the user were logged in as as the perforce operating system user on a machine with properly configured SSH keys, the global topology could be done somethin like this (after distributing /hxddepots/sdp/helix_binaries to all machines):

ssh syd-helix-05
ssh syd-helix-04
ssh nyc-helix-03
ssh bos-helix-02
ssh bos-helix-01

5.3. Database Modifications

Occasionally modifications are made to the Perforce database from one release to another. For example, server upgrades and some recovery procedures modify the database.

When upgrading the server, replaying a journal patch, or performing any activity that modifies the db.* files, you must restart the offline checkpoint process so that the files in the offline_db directory match the ones in the live server directory. The easiest way to restart the offline checkpoint process is to run the live_checkpoint script after modifying the db.* files, as follows:

/p4/common/bin/ 1

This script makes a new checkpoint of the modified database files in the live root directory, then recovers that checkpoint to the offline_db directory so that both directories are in sync. This script can also be used anytime to create a checkpoint of the live database.

This command should be run when an error occurs during offline checkpointing. It restarts the offline checkpoint process from the live database files to bring the offline copy back in sync. If the live checkpoint script fails, contact Perforce Consulting at

6. Maximizing Server Performance

The following sections provide some guidelines for maximizing the performance of the Perforce Server, using tools provided by the SDP. More information on this topic can be found in the Knowledge Base.

6.1. Ensure Transparent Huge Pages (THP) is turned off

This is reference KB Article on Platform Notes

There is a script in the SDP which will do this:


It needs to be run as root or using sudo. This will not persist after system is rebooted.

We recommend the usage of tuned

Install as appropriate for your Linux distribution (so as root):

yum install tuned


apt-get install tuned
  1. Create a customized tuned profile with disabled THP. Create a new directory in /etc/tuned directory with desired profile name:

    mkdir /etc/tuned/nothp_profile
  2. Then create a new tuned.conf file for nothp_profile, and insert the new tuning info:

    cat <<EOF > /etc/tuned/nothp_profile/tuned.conf
    include= throughput-performance
  3. Make the script executable

    chmod +x /etc/tuned/nothp_profile/tuned.conf
  4. Enable nothp_profile using the tuned-adm command.

    tuned-adm profile nothp_profile
  5. This change will immediately take effect and persist after reboots. To verify if THP are disabled or not, run below command:

    cat /sys/kernel/mm/transparent_hugepage/enabled
    always madvise [never]

6.2. Putting server.locks directory into RAM

The server.locks directory is maintained in the $P4ROOT (so /p4/1/root) for a running server. This directory contains a tree of 17 byte long files which is used for lock co-ordination amongst p4d processes.

This directory can be removed every time the p4d instance is restarted, so it is safe to put it into a tmpfs filesystem.

Even on a large installation with many hundreds or thousands of users, this directory will be unlikely to exceed 1GB, so a 2GB filesystem will be ample.

Instructions (as user root):

  1. Create directory to mount, and change ownership to perforce user (or $OSUSER if SDP config specifies a different name)

    mkdir /hxserverlocks
    chown perforce:perforce /hxserverlocks
  2. Add a line to /etc/fstab:

    tmpfs /hxserverlocks tmpfs size=1G,mode=0755 0 0
  3. Mount the drive:

    mount -a
  4. Check it is looking correct:

    df -h

As user perforce, set the configurable, specifying the serverid of your server (to ensure it is not set globally and picked up by all replicas):

p4 configure set <serverid>#server.locks.dir=<serverlocks dir>
p4 configure set master.1#server.locks.dir=/p4serverlocks

This will take effect immediately - it does not require a server restart.

If you set this globally (without servid# prefix), then you should ensure that all replicas have a similarly named directory availab.e
Consider failover options - so review your HA failover server configuration and create a similar entry - otherwise if you failover then performance will be reduced.

6.3. Optimizing the database files

The Perforce Server’s database is composed of b-tree files. The server does not fully rebalance and compress them during normal operation. To optimize the files, you must checkpoint and restore the server. This normally only needs to be done very few months.

To minimize the size of back up files and maximize server performance, minimize the size of the db.have and db.label files.

6.4. P4V Performance Settings

6.5. Proactive Performance Maintenance

This section describes some things that can be done to proactively to enhance scalability and maintain performance.

6.5.1. Limiting large requests

To prevent large requests from overwhelming the server, you can limit the amount of data and time allowed per query by setting the maxresults, maxscanrows and maxlocktime parameters to the lowest setting that does not interfere with normal daily activities. As a good starting point, set maxscanrows to maxresults * 3; set maxresults to slightly larger than the maximum number of files the users need to be able to sync to do their work; and set maxlocktime to 30000 milliseconds. These values must be adjusted up as the size of your server and the number of revisions of the files grow. To simplify administration, assign limits to groups rather than individual users.

To prevent users from inadvertently accessing large numbers of files, define their client view to be as narrow as possible, considering the requirements of their work. Similarly, limit users' access in the protections table to the smallest number of directories that are required for them to do their job.

Finally, keep triggers simple. Complex triggers increase load on the server.

6.5.2. Offloading remote syncs

For remote users who need to sync large numbers of files, Perforce offers a proxy server. P4P, the Perforce Proxy, is run on a machine that is on the remote users' local network. The Perforce Proxy caches file revisions, serving them to the remote users and diverting that load from the main server.

P4P is included in the Windows installer. To launch P4P on Unix machines, copy the /p4/common/etc/init.d/p4p_1_init script to /p4/1/bin/p4p_1_init. Then review and customize the script to specify your server volume names and directories.

P4P does not require special hardware but it can be quite CPU intensive if it is working with binary files, which are CPU-intensive to attempt to compress. It doesn’t need to be backed up. If the P4P instance isn’t working, users can switch their port back to the main server and continue working until the instance of P4P is fixed.

7. Tools and Scripts

This section describes the various scripts and files provided as part of the SDP package.

7.1. General SDP Usage

This section presents an overview of the SDP scripts and tools, with details covered in subsequent sections.

7.1.1. Linux

Most scripts and tools reside in /p4/common/bin. The /p4/<instance>/bin directory (e.g. /p4/1/bin) contains scripts or links that are specific to that instance such as wrappers for the p4d executable.

Older versions of the SDP required you to always run important administrative commands using the p4master_run script, and specify fully qualified paths. This script loads environment information from /p4/common/bin/p4_vars, the central environment file of the SDP, ensuring a controlled environment. The p4_vars file includes instance specific environment data from /p4/common/config/p4_instance.vars e.g. /p4/common/config/p4_1.vars. The p4master_run script is still used when running p4 commands against the server unless you set up your environment first by sourcing p4_vars with the instance as a parameter (for bash shell: source /p4/common/bin/p4_vars 1). Administrative scripts, such as, no longer need to be called with p4master_run however, they just need you to pass the instance number to them as a parameter.

When invoking a Perforce command directly on the server machine, use the p4_instance wrapper that is located in /p4/instance/bin. This wrapper invokes the correct version of the p4 client for the instance. The use of these wrappers enables easy upgrades, because the wrapper is a link to the correct version of the p4 client. There is a similar wrapper for the p4d executable, called p4d_instance.

This wrapper is important to handle case sensitivity in a consistent manner, e.g. when running a Unix server in case-insensitive mode. If you just execut p4d directly when it should be case-insenstive, then you may cause problems, or commands will fail.

Below are some usage examples for instance 1.

Example Remarks

/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 admin stop

Run p4 admin stop on instance 1

/p4/common/bin/ 1

Take a checkpoint of the live database on instance 1

/p4/common/bin/p4login 1

Log in as the perforce user (superuser) on instance 1.

Some maintenance scripts can be run from any client workspace, if the user has administrative access to Perforce.

7.1.2. Monitoring SDP activities

The important SDP maintenance and backup scripts generate email notifications when they complete.

For further monitoring, you can consider options such as:

  • Making the SDP log files available via a password protected HTTP server.

  • Directing the SDP notification emails to an automated system that interprets the logs.

7.2. Upgrade Scripts


USAGE for v1.2.0: [-r <HelixMajorVersion>] [-b <Binary1>,<Binary2>,...]

   or -h|-man

	This script acquires Perforce Helix binaries from the Perforce FTP server.

	The four Helix binaries that can be acquired are:

	* p4, the command line client
	* p4d, the Helix Core server
	* p4p, the Helix Proxy
	* p4broker, the Helix Broker

	This script gets the latest patch of binaries for the current major Helix
	version.  It is intended to acquire the latest patch for an existing install,
	or to get initial binaries for a fresh new install.  It must be run from
	the /hxdepots/sdp/helix_binaries directory (or simiar; the /hxdepots directory
	is the default but is subject to local configuration).

	The helix_binaries directory is used for staging binaries for later upgrade
	with the SDP '' script (documented separately).  This helix_binaries
	directory is used to stage binaries on the current machine, while the
	'' script updates a single SDP instance (of which there might be
	several on a machine).

	The helix_binaries directory may not be in the PATH. As a safety feature,
	the '' will report an error if the 'p4d' binary is found outside
	/p4/common/bin in the PATH. The SDP '' check uses ''
	as part of its preflight checks, and will refuse to upgrade if any 'p4d' is
	found outside /p4/common/bin.

	When a newer major version of Helix binares is needed, this script should not
	be modified directly. Instead, the recommended approach is to upgrade the SDP
	to get the latest version of SDP first, which will included a newer version of
	this script, as well as the latest ''.  The '' script
	is updated with each major SDP version to be aware of any changes in
	the upgrade procedure for the corresponding p4d version.  Upgrading SDP first
	ensures you have a version of the SDP that works with newer versions of p4d
	and other Helix binaries.

 -r <HelixMajorVersion>
	Specify the Helix Version, using the short form.  The form is rYY.N, e.g. r20.1
	to denote the 2020.1 release. The default: is r20.1

 -b <Binary1>[,<Binary2>,...]
	Specify a comma-delimited list of Helix binaries. The default is: p4 p4d p4broker p4p

 -n	Specify the '-n' (No Operation) option to show the commands needed
	to fetch the Helix binaries from the Perforce FTP server without attempting
	to execute them.

 -D	Set extreme debugging verbosity using bash 'set -x' mode.

 -h	Display short help message
 -man	Display this manual page

	Note: All examples assume the SDP is in the standard location, /hxdepots/sdp.

	Example 1 - Typical Usage with no arguments:

	cd /hxdepots/sdp/helix_binaries

	This acquires the latest patch of all 4 binaries for the r20.1
	release (aka 2020.1).

	Example 2 - Specifying the major version:

	cd /hxdepots/sdp/helix_binaries
	./ -r r19.2

	This gets the latest patch of for the 2019.2 release of all 4 binaries.

	Note: Only supported Helix binares are guaranteed to be available from the
	Perforce FTP server.

	Note: Only the latest patch of any given binary is available from the Perforce
	FTP server.

	Example 3 - Sample getting r20.1 and skipping the proxy binary (p4p):

	cd /hxdepots/sdp/helix_binaries
	./ -r r20.1 -b p4,p4d,p4broker

	This script requires outbound internet access. Depending on your environment,
	it may also require HTTPS_PROXY to be defined, or may not work at all.

	If this script doesn't work due to lack of outbound internet access, it is
	still useful illustrating the locations on the Perforce FTP server where
	Helix Core binaries can be found.  If outbound internet access is not
	available, use the '-n' flag to see where on the Peforce FTP server the
	files must be pulled from, and then find a way to get the files from the
	Perforce FTP server to the correct directory on your local machine,
	/hxdepots/sdp/helix_binaries by default.

	An exit code of 0 indicates no errors were encounted. An
	non-zero exit code indicates errors were encounterd.


The script is used to upgrade p4d and other Perforce Helix binaries on a given server machine.

The links for different versions of p4d are described in Section A.1.3, “P4D versions and links”

USAGE for v4.2.0: <instance> [-c] [-p] [-n] [-L <log>] [-d|-D]

or [-h|-man]


This script upgrades the following Helix Core software:

* p4d, the Perforce Helix Core server
* p4broker, the Helix Broker server
* p4p, the Helix Proxy server
* p4, the command line client

Details of each upgrade are described below. Prior to executing any upgrades, a
preflight check is done to help ensure upgrades will go smoothly.  Also, checks
are done to determine what (if any) of the above software products need to be

To prepare for an upgrade, new binaries must be placed in the /p4/sdp/helix_binaries
directory.  Binaries in this directory are not referenced by live running
servers, and so it is safe to ugprade files in this directory to stage for a
future upgrade at any time. The SDP PATH does not include this directory.

Upgrading p4d, the Perforce Helix Core Server

Upgrading p4broker and p4p (P4Proxy)

Upgrading p4, the command line client

	If your server can reach the Perforce FTP server over the public
	internet, a script can be used from the /p4/sdp/helix_binaries
	directory to get the latest binaries:

	cd /p4/sdp/helix_binaries

	Specify the SDP instance name to add.  This is a reference to the Perforce
	Helix Core data set. This defaults to the current instance based on the
	$SDP_INSTANCE shell environment variable. If the SDP shell environment is
	not loaded, this option is required.

 -c	Specify '-c' to execute a command to upgrade the Protections table comment
	format after the p4d upgrade, by using a command like:

        p4 protect --convert-p4admin-comments -o | p4 -s protect -i

	By default, this Protections table conversion is not performed.  In some
	environments with custom policies related to update of the protections
	table, this command may not work.

 -p	Specify '-p' to halt processing after preflight checks are complete,
	and before actual processing starts. By default, procesing starts
	immediately upon successful completion of prelfight checks.

 -L <log>
	Specify the path to a log file, or the special value 'off' to disable
	logging.  By default, all output (stdout and stderr) goes to this file
	in the /p4/N/logs directory (where N is the SDP instance name):


	NOTE: This script is self-logging.  That is, output displayed on the screen
	is simultaneously captured in the log file.  Do not run this script with
	redirection operators like '> log' or '2>&1', and do not use 'tee.'

	NOTE: Logging can only be disabled with '-L off' if the '-n' or '-p' flags
	are used. Disabling logging for actual upgrades is not allowed.

 -n	No-Op.  In No-Op mode, no actions that affect data or structures are taken.
	Instead, commands that would be run are displayed.

 -d     Increase verbosity for debugging.

 -D     Set extreme debugging verbosity, using bash '-x' mode. Also implies -d.

 -h	Display short help message
 -man	Display man-style help message

	Typical usage is with just the SDP instance name as an argument, e.g.
	instance '1' in this example:

	$ cd /p4/common/bin
	$ ./ 1

	This executes the upgrade after successful completion of preflight checks,
	and aborts if preflight checks detected any issues.  Alternately, to see
	if an upgrade is needed without starting, use the '-p' flag to execute only
	the preflight checks, as in this example:

	$ cd /p4/common/bin
	$ ./ 1 -p

7.3. Core Scripts

The core SDP scripts are those related to checkpoints and other scheduled operations, and all run from /p4/common/bin.

If you source /p4/common/bin/p4_vars <instance> then the /p4/common/bin directory will be added to your $PATH.

7.3.1. p4_vars

This script defines the environment variables required by the Perforce server. This script uses a specified instance number as a basis for setting environment variables. It will look for and open the respective p4_<instance>.vars file (see next section).

This script also sets server logging options and configurables.

It is intended to be used by other scripts for common environment settings, and also by users for setting the environment of their Bash shell.

source /p4/common/bin/p4_vars 1

7.3.2. p4_<instance>.vars

Defines the environment variables for a specific instance, including P4PORT etc.

This script is called by Section 7.3.1, “p4_vars” - it is not intended to be called directly by a user.

For instance 1:


For instance art:


Location: /p4/common/config

7.3.3. p4master_run

This script is the wrapper script to other SDP scripts. This ensures that the shell environment is loaded from p4_vars. It provides a '-c' flag for silent operation, used in many crontab so that email is sent from the scripts themselves.

It is somewhat historical, in that most scripts now directly source the p4_vars script directly. It is still occasionally useful.


This script is configured to run six days a week using crontab. The script:

  • truncates the journal

  • replays it into the offline_db directory

  • creates a new checkpoint from the resulting database files

  • recreates the offline_db databsae from the new checkpoint.

This procedure rebalances and compresses the database files in the offline_db directory. These are rotated into the live (root) databse, by the script Section 7.3.10, “”

/p4/common/bin/ <instance>
/p4/common/bin/ 1


This script recovers the offline_db database from the latest checkpoint and replays any journals since then. If you have a problem with the offline database then it is worth running this script first before running Section 7.3.6, “”, as the latter will stop the server while it is running, which can take hours for a large installation.

Run this script if an error occurs while replaying a journal during daily checkpoint process.

This script recreates offline_db files from the latest checkpoint. If it fails, then check to see if the most recent checkpoint in the /p4/<instance>/checkpoints directory is bad (ie doesn’t look like the right size compared to the others), and if so, delete it and rerun this script. If the error you are getting is that the journal replay failed, then the only option is to run Section 7.3.6, “” script.

/p4/common/bin/ <instance>
/p4/common/bin/ 1


This script is a fallback option for use when you suspect that the offline_db has become corrupt.

This performs the following actions:

  • Stops the server

  • Creates a checkpoint from the live database files

  • Recovers the offline_db database from that checkpoint to rebalance and compress the files

Run this script when creating the server and if an error occurs while replaying a journal during the off-line checkpoint process.

Be aware it locks live database for the duration of the checkpoint which can take hours for a large installation (please check the /p4/1/logs/checkpoint.log for the most recent output of to see how long checkpoints take to create/restore).
/p4/common/bin/ <instance>
/p4/common/bin/ 1


This script verifies the integrity of the depot files. This script is run by crontab on a regular basis.

Any errors in the log file (e.g. /p4/1/logs/p4verify.log) should be handled according to KB articles:

If in doubt contact

Our recommendation is that you should expect this to be without error, and you should address errors sooner rather than later. This may involve obliterating unrecoverable errors.

when run on replicas, this will also append the -t flag to the p4 verify command to ensure that MISSING files are scheduled for transfer. This is useful to keep replicas (including edge servers) up-to-date.
/p4/common/bin/ <instance>
/p4/common/bin/ 1
USAGE for  v5.2.3: [<instance>] [-nu] [-nr] [-ns] [-nS] [-a] [-recent] [-L <log>] [-v] [-D]

   or -h|-man


	This script performs a 'p4 verify' of all submitted and shelved versioned
	files in depots of all types except 'remote' and 'archive' type depots.

	If run on a replica, it schedules archive failures for transfer to the

	Specify the SDP instances.  If not specified, the SDP_INSTANCE
	environment variable is used instead.  If the instance is not
	defined by a parameter and SDP_INSTANCE is not defined,
	exists immediately with an error message.

 -nu	Specify '-nu' (No Unload) to skip verification of the singleton depot
	of type 'unload' (if created).  The 'unload' depot is verified
	by default.

 -nr	Specify '-nr' (No Regular) to skip verification of regular submitted
	archive files.  The '-nr' option is not compatible with '-recent'.
	Regular submitted archive files are verified by default.

 -ns	Specify '-ns' (No Spec Depot) to skip verification of singleton depot
	of type 'spec' (if created). The 'spec' depot is verified by default.

 -nS	Specify '-nS' (No Shelves) to skip verification of shelved archive
	files, i.e. to skip the 'p4 verify -qS'.

 -a	Specify '-a' (Archive Depots) to do verification of depots of type
	'archive'.  Depots of type 'archive' are not verified by default, as
	archive depots are often physicially removed from the server's
	storage subsystem for long-term cold storage.

	Specify that only recent changelists should be verified.
	The $SDP_RECENT_CHANGES_TO_VERIFY variable defines how many
	changelists are considered recent; the default is 200.

	If the default is not appropriate for your site, add
	"export SDP_RECENT_CHANGES_TO_VERIFY" to /p4/common/config/p4_N.vars to
	change the default for an instance, or to /p4/common/bin/p4_vars to
	change it globally.  If $SDP_RECENT_CHANGES_TO_VERIFY is unset, the
	default is 200.

	When -recent is used, neither shelves nor files in the unload depot
	are verified.

 -v     Verbose.  Show output of verify attempts, which is suppressed by default.
	Setting SDP_SHOW_LOG=1 in the shell environment has the same effect as -v.

	The default behavior of this script is to generate no terminal outpout,
	but instead to write output into a log file -- see LOGGING below.  If
	'-v' is specified, the generated log is sent to stdout at the end of
	processing.  This flag is not recommended for routine cron operation or
	for large data sets.

 -L <log>
	Specify the log file to use.  The default is /p4/N/logs/p4verify.log

	Log rotation and old log cleanup logic does not apply to log files
	specified with -L.  Thus, using -L is not recommended for routine scheduled
	operation, e.g. via crontab.

 -D     Set extreme debugging verbosity.

 -h	Display short help message
 -man	Display man-style help message

	This script is typically called via cron with only the instance
	paramter as an argument, e.g.: N

	This script generates no output by default.  All (stdout and stderr) is
	logged to /p4/N/logs/p4verify.log.

	The exception is usage errors, which result an error being sent to
	stderr followed usage info on stdout, followed by an immediate exit.

	If the '-v' flag is used, the contents of the log are displayed to
	stdout at the end of processing.

	An exit code of 0 indicates no errors were encounted attempting to
	perform verifications, AND that all verifications attempted
	reported no problems.

	A exit status of 1 indicates that verifications could not be
	attempted for some reason.

	A exit status of 2 indicates that verifications were successfully
	performed, but that problems such as BAD or MISSING files
	were detected, or else system limits prevented verification.

7.3.8. p4login

This script is a convenience wrapper to execute a p4 login command, using the administration password configured in mkdirs.cfg and subsequently stored in a text file: /p4/common/config/.p4passwd .p4_<instance>.admin

USAGE for p4login v4.4.1:

p4login [<instance>] [-p <port> | -service] [-automation] [-all]


p4login -h|-man


	In its simplest form, this script simply logs in P4USER to P4PORT
	using the defined password access mechanism.

	It generates a login ticket for the SDP super user, defined by
	P4USER when sourcing the SDP standard shell environment.  It is
	called from cron scripts, and so does not normally generate any

	If run on a replica with the -service option, the serviceUser defined
	for the given replica is logged in.

	The $SDP_AUTOMATION_USERS variable can be defined in
	/p4_N.vars. If defined, this should contain a
	comma-delimited list of automation users to be logged in when the
	-automation option is used.  A definition might look like:

	export SDP_AUTOMATION_USERS=builder,trigger-admin,p4review

	Login behaviour is affected by external factors:
	1. P4AUTH, if defined, affects login behavior on replicas.

	2. The setting, if defined, affects login behaviors (and
	generally simplifies them).

	3. The $SDP_ALWAYS_LOGIN variable.  If set to 1, this causes p4login
	to always execute a 'p4 login' command to generate a login ticket,
	even if a 'p4 login -s' test indicates none is needed.  By default,
	the login is skipped if a 'p4 login  -s' test indicates a long-term
	ticket is available that expires 31+days in the future.
	Add "export SDP_ALWYAYS_LOGIN=1" to /p4_N.vars to
	change the default for an instance, or to /p4/common/bin/p4_vars to
	change it globally.  If unset, the default is 0.

	4. If the P4PORT contains an ssl: prefix, the P4TRUST relationship
	is checked, and if necessary, a p4 trust -f -y is done to establish

	Specify the SDP instances.  If not specified, the SDP_INSTANCE
	environment variable is used instead.  If the instance is not
	defined by a parameter and SDP_INSTANCE is not defined, p4login
	exists immediately with an error message.

	Specify -service when run on a replica or edge server to login
	the super user and the replication service user.

	This option is not compatible with '-p <port>'.

 -p <port>
	Specify a P4PORT value to login to, overriding the default
	defined by P4PORT setting in the environment.  If operating
	on a host other than the master, and is set, this
	flag is ignored; the P4TARGET for the replica is used

	This option is not compatible with '-service'.

	Specify -automation to login external automation users defined
	by the $SDP_AUTOMATION_USERS variable.

 -v     Show ouptput of login attempts, which is suppressed by default.
	Setting SDP_SHOW_LOG=1 in the shell environment has the same
	effect as -v.

 -L <log>
	Specify the log file to use.  The default is /p4/N/logs/p4login.log

 -d     Set debugging verbosity.

 -D     Set extreme debugging verbosity.

 -h	Display short help message
 -man	Display man-style help message

	1. Typical usage for automation, with instance SDP_INSTANCE defined
	in the environment by sourcing p4_vars, and logging in only the super
	user P4USER to P4PORT:
	source /p4/common/bin/p4_vars abc

	Login in only P4USER to the specified port, P4MASTERPORT in this example:
	p4login -p $P4MASTERPORT

	Login the super user P4USER, and then login the replication serviceUser
	for the current ServerID:
	p4login -service

	Login external automation users (see SDP_AUTOMATION_USERS above):
	p4login -automation

	Login all users:
	p4login -all

	Or: p4login -service -automation

	This script generates no output by default.  All (stdout and stderr) is
	logged to /p4/N/logs/p4login.log.

	The exception is usage errors, which result an error being sent to
	stderr followed usage info on stdout, followed by an immediate exit.

	If the '-v' flag is used, the contents of the log are displayed to
	stdout at the end of processing.

	An exit code of 0 indicates a valid login ticket exists, while a
	non-zero exit code indicates a failure to login.

7.3.9. p4d_<instance>_init

Starts the Perforce server. Can be called directly or as describe in Section 3.2.2, “Configuring (Automatic) Service Start on Boot” - it is created by when SDP is installed.

Do not use directly if you have configured systemctl for systemd Linux distributions such as CentOS 7.x. This risks database corruption if systemd does not think the service is running when it actually is running (for example on shutdown systemd will just kill processes without waiting for them).

This script sources /p4/common/bin/p4_vars, then runs /p4/common/bin/p4d_base (Section 7.5.10, “p4d_base”).

/p4/<instance>/bin/p4d_<instance>_init [ start | stop | status | restart ]
/p4/1/bin/p4d_1_init start


This script is intended to be used every 1-3 months to ensure that your live (root) database files are defragmented.

It will:

  • stop p4d

  • truncate/rotate live journal

  • replay journals to offline_db

  • switch the links between root and offline_db

  • restart p4d

It also knows how to do similar processes on edge servers and standby servers or other replicas.

/p4/common/bin/ <instance>
/p4/common/bin/ 1




7.3.14. run_if_master/edge/

The SDP uses wrapper scripts in the crontab:,, We suggest you ensure these are working as desired, e.g.

/p4/common/bin/ 1 echo yes
/p4/common/bin/ 1 echo yes
/p4/common/bin/ 1 echo yes

It is important to ensure these are returning the valid results for the server machine you are on.

Any issues with these scripts are likely configuration issues with /p4/common/config/p4_1.vars (for instance 1)

7.4. More Server Scripts

These scripts are helpful components of the SDP that run on the server, but are not included in the default crontab schedules.

7.4.1. p4.crontab

Contains crontab entries to run the server maintenance scripts.

Location: /p4/sdp/Server/Unix/p4/common/etc/cron.d


This script does basic verification of SDP setup.

USAGE for v5.9.0: [<instance>] [-online] [-skip <test>[,<test2>,...]] [-si] [-L <log>|off ] [-D]

   or -h|-man


	This script verifies the current SDP setup for the specified instance.

	Useful if you change anything, particularly after an SDP upgrade.

	Specify the SDP instances.  If not specified, the SDP_INSTANCE
	environment variable is used instead.  If the instance is not
	defined by a parameter and SDP_INSTANCE is not defined,
	exits immediately with an error message.

	Online mode.  Does additional checks that require P4D to be online.

 -skip <test>[,<test2>,...]

	Specify a comma-delimited list of test names to skip.

	Valid test names:

	* crontab: Skip crontab check. Use this if you do not expect crontab to
	be configured, perhaps if you use a different scheduler.
	* license: Skip license related checks.
	* version: Skip version checks.
	* excess: Skip checks for excess copies of p4d/p4p/p4broker in PATH.

	As an alternative to using the '-skip' command, the shell environment
	variable VERIFY_SDP_SKIP_TEST_LIST can be set to a comma-separated
	list of test names to skip.  Using the command line parameter is the
	best choice for temporarily skipping tests, while specifying the
	environment variable is better for making permament exceptions (e.g.
	always exclusing the crontab check if crontabs are not used at this
	site).  The variable should be set in /p4/common/config/p4_N.vars.

	If the '-skip' option is provided, the VERIFY_SDP_SKIP_TEST_LIST
	variable is ignored (not appended to). So it may make sense to
	reference the variable on the command line. For example, if the
	value of the variable is 'crontab', to skip crontab and license
	checks, you could specify:


 -si	Silent mode, useful for cron operation.  Both stdout and stderr
	are still captured in the log.  The '-si' option cannot be used
	with '-L off'.

 -L <log>
	Specify the log file to use.  The default is /p4/N/logs/verify_sdp.log
	The special value 'off' disables logging to a file.

	Note that '-L off' and '-si' are mutually exclusive.

 -D	Set extreme debugging verbosity.

 -h	Display short help message
 -man	Display man-style help message

	Example 1: Typical usage:

	This script is typically called after SDP update with only the instance
	name or number as an argument, e.g.: 1

	Example 2: Skipping some checks. 1 -skip crontab

	Example 3: Automation Usage

	If used from automation already doing its own logging, use -L off: 1 -L off

	This script generates a log file and also displays it to stdout at the
	end of processing.  By default, the log is:

	The exception is usage errors, which result an error being sent to
	stderr followed usage info on stdout, followed by an immediate exit.

	If the '-si' (silent) flag is used, the log is generated, but its
	contents are not displayed to stdout at the end of processing.

	An exit code of 0 indicates no errors were encounted attempting to
	perform verifications, and that all checks verified cleanly.

7.5. Other Scripts and Files

The following table describes other files in the SDP distribution. These files are usually not invoked directly by you; rather, they are invoked by higher-level scripts.


This script contains lots of standard Bash functions which are used in other scripts.

It is sourced (source /p4/common/bin/ by most of the other scripts in order to use the common shared functions and to avoid duplication.

It is not intendend to be called directly by the user.


This script rotates the broker log file on an instance that only has the broker running.

It can be added to a crontab for e.g. daily log rotation.

/p4/common/bin/ <instance>
/p4/common/bin/ 1


This script is designed to create a seed checkpoint for an Edge server.

An edge server is naturally filtered, with certain database tables (e.g. db.have) excluded. In addition to implicit filtering, the server spec may specify additional tables to be excluded, e.g. by using the ArchiveDataFilter field of the server spec.

The script requires the SDP instance and the edge ServerID.

/p4/common/bin/ <instance> <edge server id>
/p4/common/bin/ 1 p4d_edge_syd

It will output the full path of the checkpoint to be copied to the edge server and used with Section 7.5.23, “”

7.5.4. edge_vars

This file is sourced by scripts that work on edge servers.

It sets the correct list db.* files that are edge-specific in the federated architecture. This version is dependent on the version of p4d in use.

It is not intended for users to call directly.


This script is intended to be run on an edge server and will ensure that all shelves are replicated to that edge server (by running p4 print on them).

Only use if directed to by support/consulting.


This script loads a checkpoint for commit/edge/replica instance.

USAGE for v2.3.5: <checkpoint> [-i <instance>] [-s <ServerID>] [-c] [-l] [-r] [-b] [-y] [-L <log>] [-si] [-v<n>] [-D]

or [-h|-man|-V]

	This script loads a specified checkpoint into /p4/N/root and /p4/N/offline_db,
	where 'N' is the SDP instance name.

	At the start of processing, preflight checks are done. Preflight checks
	* The specified checkpoint and corresponding *.md5 file must exist.
	* The $P4ROOT/ file must exist, unless '-s' is specified.
	* The $P4ROOT/license file must exist, unless '-l' is specified.
	* Basic SDP structure and key files must exist.

  	If the preflight passes, the p4d_N service is shutdown, and also the
	p4broker_N service is shutdown if configured.

	Next, the specified checkpoint is loaded. Upon completion, the Helix Core
	server process, p4d_N, is started.

	If the server to be started is a replica, the serviceUser configured for
	the replica is logged into the P4TARGET server.  Any needed 'p4 trust' and
	'p4 login' commands are done to enable replication.

	Note that this part of the processing will fail if the correct super user
	password is not stored in the standard SDP password file,


	After starting the server, a local 'p4 trust' is done if needed, and then
	a 'p4login -service -v' and 'p4login -v'.

	By default, the p4d_N service is started, but the p4broker_N service is not.
	Specify '-b' to restart both services.

	Specify the path to the checkpoint file to load.

	The file may be a compressed or uncompressed checkpoint, and it may bea case
	sensitive or case-insensitive checkpoint.  The checkpoint file must have a
	corresponding *.md5 checksum file in the same directory, with one of two name
	variations: If the checkpoint file is /somewhere/foo.gz, the checksum file may
	be named /somewhere/foo.gz.md5 or /somewhere/foo.md5.

 -i <instance>
	Specify the SDP instance. This can be omitted if SDP_INSTANCE is already

 -s <ServerID>
	Specify the ServerID.  This value is written into $P4ROOT/ file.

	If no $P4ROOT/ file exists, this flag is required.

	If the $P4ROOT/ file exists, this argument is not needed. If this
	'-s <ServerID>' is given and a $P4ROOT/ file exists, the value in
	the file must match the value specified with this argument.

 -c	Specify that SSL certificates are required, and not to be generated with
	'p4d_N -Gc'.

	By default, if '-c' is not supplied and SSL certs are not availalbe, certs
	are generated automatically with 'p4d_N -Gc'.

 -l	Specify that the server is to start without a license file. By default, if
	there is no $P4ROOT/license file, this script will abort.  Note that if '-l'
	is specified and a license file is actually needed, the attempt this script makes
	to start the server after loading the checkpoint will fail.

 -r	Specify '-r' to replay only to P4ROOT.  By default, this script replays both
	to P4ROOT and the offline_db.

 -b	Specify '-b' to start the a p4broker process (if configured).  By default
	the p4d process is started after loading the checkpoint, but the p4broker
	process is not. This can be useful to ensure the human administrator has
	an opportunity to do sanity checks before enabling the broker to allow
	access by end users (if the broker is deployed for this usage).

 -y	Use the '-y' flag to bypass an interactive warning and confirmation

 -v<n>	Set verbosity 1-5 (-v1 = quiet, -v5 = highest).  The default is 5.

 -L <log>
	Specify the path to a log file.  By default, all output (stdout and stderr)
	goes to:

	NOTE: This script is self-logging.  That is, output displayed on the screen
	is simultaneously captured in the log file.  Do not run this script with
	redirection operators like '> log' or '2>&1', and do not use 'tee.'

 -si	Operate silently.  All output (stdout and stderr) is redirected to the log
	only; no output appears on the terminal.

 -D     Set extreme debugging verbosity.

 -h	Display short help message
 -man	Display man-style help message
 -V	Dispay version info for this script and its libraries.

	Sample non-interactive usage (bash syntax):
	nohup / /p4/1/checkpoints/p4_1.ckp.4025.gz -i 1 -y -si < /dev/null > /dev/null 2>&1 &

	Then, monitor with:
	tail -f $(ls -t $LOGS/load_checkpoint.*.log|head -1)


This script generates an SDP instance-specific variant of the generic P4Broker config file. Display to standard output.


cd /p4/common/bin 1 > /tmp/p4broker.cfg.ToBeReviewed

The final p4broker.cfg should end up here:



This script will check diskspace available to P4JOURNAL and trigger a journal rotation based on specified thresholds. This is useful in case you are in danger of running out of disk space and your rotated journal files are stored on a separate partition than the active journal.

This script is using the following external variables:

  • SDP_INSTANCE - The instance of Perforce that is being backed up. If not set in environment, pass in as argument to script.

  • P4JOURNALWARN - Amount of space left (K,M,G,%) before min journal space where an email alert is sent

  • P4JOURNALWARNALERT - Send an alert if warn threshold is reached (true/false, default: false)

  • P4JOURNALROTATE - Amount of space left (K,M,G,%) before min journal space to trigger a journal rotation

  • P4OVERRIDEKEEPJNL - Allow script to temporarily override KEEPJNL to retain enough journals to replay against oldest checkpoint (true/false, default: false)


Run from CLI that will warn via email if less than 20% is available and rotate journal when less than 10% is available

./ 20% TRUE 10% TRUE

Cron job that will warn via email if less than 20% is available and rotate journal when less than 10% is available

30 * * * * [ -e /p4/common/bin ] && /p4/common/bin/ ${INSTANCE} /p4/common/bin/ ${INSTANCE} 20\% TRUE 10\% TRUE


This script runs p4 monitor terminate on all processes showing in the output of p4 monitor show that are in the IDLE state.

/p4/common/bin/ <instance>
/p4/common/bin/ 1

7.5.10. p4d_base

This script is the script to start/stop/restart the p4d instance.

It is called by p4d_<instance>_init script (and thus also systemctl on systemd Linux distributions)

It ensures appropriate parameters are specified for journal/log and other variables.

/p4/common/bin/p4d_base <instance> [ start|stop|admin_stop|status|restart|force_start ]
/p4/common/bin/p4d_base 1 start

7.5.11. p4broker_base

This script is very similar to Section 7.5.10, “p4d_base” but for the p4broker service instance.

7.5.12. p4ftpd_base

This script is very similar to Section 7.5.10, “p4d_base” but for the p4ftp service instance.

This product is very seldom used these days!

7.5.13. p4p_base

This script is very similar to Section 7.5.10, “p4d_base” but for the p4p (P4 Proxy) service instance.


This script is a utility to remove files in the proxy cache if the amount of free disk space falls below the low threshold.

Usage: [-d "proxy cache dir"] [-tlow <low_threshold>] [-thigh <high_threshold>] [-n]
or -h

This utility removes files in the proxy cache if the amount of free disk space
falls below the low threshold (default 10GB).  It removes files (oldest first)
until the high threshold is (default 20GB) is reached. Specify the thresholds
in kilobyte units (kb).

The '-d "proxy cache dir"' argument is required unless $P4PCACHE is defined,
in which case it is used.

The log is $LOGS/p4pcm.log if $LOGS is defined, else p4pcm.log in the current

Use '-n' to show what files would be removed.


This script sends out email containing the change descriptions to users who are configured as reviewers for affected files (done by setting the Reviews: field in the user specification). This script is a version of the script that is available on the Perforce Web site, but has been modified to use the server instance number. It relies on a configuration file in /p4/common/config, called p4_<instance>.p4review.cfg.

This is not required if you have installed Swarm which also performs notification functions and is easier for users to configure.

/p4/common/bin/  # Uses config file as above


  1. Run --sample-config > p4review.conf

  2. Edit the file p4review.conf

  3. Add a crontab similar to this:

    • * * * * python2.7 /path/to/ -c /path/to/p4review.conf


  • Prevent multiple copies running concurrently with a simple lock file.

  • Logging support built-in.

  • Takes command-line options.

  • Configurable subject and email templates.

  • Use P4Python when available and use P4 (the CLI) as a fallback.

  • Option to send a single email per user per invocation instead of multiple ones.

  • Reads config from a INI-like file using ConfigParser

  • Have command line options that overrides environment variables.

  • Handles unicode-enabled server and non-ASCII characters on a non-unicode-enabled server.

  • Option to opt-in (--opt-in-path) reviews globally (for migration from old review daemon).

  • Configurable URLs for changes/jobs/users (for swarm).

  • Able to limit the maximum email message size with a configurable.

  • SMTP auth and TLS (not SSL) support.

  • Handles P4 auth (optional, not recommended!).


This script is a simple script to run:

  • p4 set

  • p4 info

  • p4 changes -m 10

/p4/common/bin/ <instance>
/p4/common/bin/ 1


This script is a trouble-shooting script for use when directed by support, e.g. in situations such as server hanging, major locking problems etc.

It is an "SDP-aware" version of the standard so that it only requires the SDP instance to be specified as a parameter (since the location of logs etc are defined by SDP).

sudo /p4/common/bin/ <instance>
sudo /p4/common/bin/ 1


This script contains common functions for using 'ps' to check on process ids. Not intended to be called directly but just to be sourced by other scripts.

get_pids ($exe)
Call with an exe name, e.g. /p4/1/bin/p4web_1
p4web_pids=$(get_pids $P4WEBBIN)
p4broker_pids=$(get_pids $P4BROKERBIN)


It is a fast content transfer mechanism using Aspera (and can be adapted to other similar UDP based products.) An Edge server uses this trigger to pull files from its upstream Commit server. It replaces or augments the built in replication archive pull and is useful in scenarios where there are lots of large (binary) files and commit/edge are geographically distribbuted with high latency and/or low bandwidth between them.

See also companion trigger Section 7.5.28, “”

It is based around getting a list of files to copy from commit to edge. Do the copy using ascp (Aspera file copy)

Configurable pull.trigger.dir should be set to a temp folder like /p4/1/tmp

Startup commands look like:

startup.2=pull -i 1 -u --trigger --batch=1000

The trigger entry for the pull commands looks like this:

pull_archive pull-archive pull "/p4/common/bin/triggers/ %archiveList%"

There are some pull trigger options, but the are not necessary with Aspera. Aspera works best if you give it the max batch size of 1000 and set up 1 or more threads. Note, that each thread will use the max bandwidth you specify, so a single pull-trigger thread is probably all you will want.

The ascp user needs to have ssl public keys set up or export ASPERA_SCP_PASS.

The ascp user should be set up with the target as / with full write access to the volume where the depot files are located. The easiest way to do that is to use the same user that is running the p4d service.

ensure ascp is correctly configured and working in your environment: (search for "ascp connectivity testing")

Standard SDP environment is assumed, e.g P4USER, P4PORT, OSUSER, P4BIN, etc. are set, PATH is appropriate, and a super user is logged in with a non-expiring ticket.

Read the trigger comments for any customization requirements required for your environment.

See also the test version of the script: Section 7.5.21, “”

See script for details and to customize for your environment.


This script is a test script.

THIS IS A TEST SCRIPT - it substitutes for Section 7.5.20, “” which uses Aspera’s ascp and replaces that with Linux standard scp utility. IT IS NOT INTENDED FOR PRODUCTION USE!!!!

If you don’t have an Aspera license, then you can test with this script to understand the process.

See script for details.

There is a demonstrator project showing usage:


This script will allow you to archive files and optionally purge files based on a configurable number of days and minimum revisions that you want to keep. This is useful if you want to keep a certain number of days worth of files instead of a specific number of revisions.

Note: If you run this script with purge mode disabled, and then enable it after the fact, all previously archived files specified in the configuration file will be purged if the configured criteria is met.

Prior to running this script, you may want to disable server locks for archive to reduce impact to end users.


  • SDP_INSTANCE - The instance of Perforce that is being backed up. If not set in environment, pass in as argument to script.

  • P4_ARCHIVE_CONFIG - The location of the config file used to determine retention. If not set in environment, pass in as argument to script. This can be stored on a physical disk or somewhere in perforce.

  • P4_ARCHIVE_DEPOT - Depot to archive the files in (string)

  • P4_ARCHIVE_REPORT_MODE - Do not archive revisions; report on which revisions would have been archived (bool - default: true)

  • P4_ARCHIVE_TEXT - Archive text files (or other revisions stored in delta format, such as files of type binary+D) (bool - default: false)

  • P4_PURGE_MODE - Enables purging of files after they are archived (bool - default: false)

Config File Format

The config file should contain a list of file paths, number of days and minimum of revisions to keep in a tab delimited format.



//test/1.txt	10	1
//test/2.txt	1	3
//test/3.txt	10	10
//test/4.txt	30	3
//test/5.txt	30	8

Run from CLI that will archive files as defined in the config file

./ 1 /p4/common/config/p4_1.p4purge.cfg archive FALSE

Cron job that will will archive files as defined in the config file, including text files

30 0 * * * [ -e /p4/common/bin ] && /p4/common/bin/ ${INSTANCE} /p4/common/bin/ $NSTANCE} /p4/common/config/p4_1.p4purge.cfg archive FALSE FALSE


This script is designed to rebuild an Edge server from a seed checkpoint from the master WHILE KEEPING THE EXISTING EDGE SPECIFIC DATA.

You have to first copy the seed checkpoint from the master, created with Section 7.5.3, “”, to the edge server before running this script. (Alternately, a full checkpoint from the master can be used so long as the edge server spec does not specify any filtering, e.g. does not use ArchiveDataFilter.)

Then run this script on the Edge server host with the instance number and full path of the master seed checkpoint as parameters.

/p4/common/bin/ <instance> <absolute path to checkpoint>
/p4/common/bin/ 1 /p4/1/checkpoints/p4_1.edge_syd.seed.ckp.9188.gz


This script performs the following actions for a replica:

  • rotate logs

  • remove old checkpoints and journals

  • remove old logs

It is a convenenience script for occasional use.

/p4/common/bin/ <instance>
/p4/common/bin/ 1


This script is regularly run by crontab on a replica or edge (using Section 7.3.13, “”)

0 8 * * * [ -e /p4/common/bin ] && /p4/common/bin/ ${INSTANCE} /p4/common/bin/ ${INSTANCE} > /dev/null
0 8 * * * [ -e /p4/common/bin ] && /p4/common/bin/ ${INSTANCE} /p4/common/bin/ ${INSTANCE} > /dev/null

It performs a p4 pull -lj command on the replica to report current replication status, and emails this to the standard SDP administrator email on a daily basis. This is useful for monitoring purposes to detect replica lag or similar problems.

If you are using enhance monitoring such as p4prometheus then this script may not be required.

/p4/common/bin/ <instance>
/p4/common/bin/ 1


This script is intended to be run on a standby replica. It essentially just calls 'p4 admin checkpoint -Z' to reqeust a checkpoint and exits. The actual checkpoint is created on the next journal rotation on the master.

/p4/common/bin/ <instance>
/p4/common/bin/ 1


This script is a convenience script to perform the following actions for the specified instance (single parameter):

  • rotate live journal

  • replay it to the offline_db

  • rotate logs files according to the settings in p4_vars for things like KEEP_LOGS

It is not often used.

/p4/common/bin/ <instance>
/p4/common/bin/ 1


This is a reference edge-content trigger for use with an Edge/Commit server topology - the Edge server uses this trigger to transmit files which are being submitted to the Commit instead of using its normal file transfer mechanism. This trigger uses Aspera for fast file transfer, and UDP, rather than TCP and is typically much faster, especially with high latency connections.

Companion trigger/script to Section 7.5.20, “”

Uses fstat -Ob with some filtering to generate a list of files to be copied. Create a temp file with the filename pairs expected by ascp, and then perform the copy.

This configurable must be set:


The edge-content trigger looks like this:

EdgeSubmit edge-content //... "/p4/common/bin/triggers/ %changelist%"

The ascp user needs to have ssl public keys set up or export ASPERA_SCP_PASS. The ascp user should be set up with the target as / with full write access to the volume where the depot files are located. The easiest way to do that is to use the same user that is running the p4d service.

ensure ascp is correctly configured and working in your environment: (search for "ascp connectivity testing")

Standard SDP environment is assumed, e.g P4USER, P4PORT, OSUSER, P4BIN, etc. are set, PATH is appropriate, and a super user is logged in with a non-expiring ticket.

See the test version of this script below: Section 7.5.29, “”

See script for details and to customize for your environment.


This script is a test script.

THIS IS A TEST SCRIPT - it substitutes for Section 7.5.28, “” (which uses Aspera) - and replaces ascp with Linux standard scp. IT IS NOT INTENDED FOR PRODUCTION USE!!!!

If you don’t have an Aspera license, then you can test with this script to understand the process.

See script for details.

There is a demonstrator project showing usage:


This script is included in the standard crontab for a replica.

It runs rsync to mirror the /p4/1/checkpoints (assumings instance 1) directory to the replica machine.

It then uses the latest checkpoint in that directory to update the local offline_db directory for the replica.

This ensures that the replica can be quickly and easily reseeded if required without having to first copy checkpoints locally (which can take hours over slow WAN links).

/p4/common/bin/ <instance>
/p4/common/bin/ 1

7.5.31. templates directory

This sub-directory of /p4/common/bin contains some files which can be used as templates for new commands if you wish:

  • - Perl

  • - Python

  • - config file for python

  • - Bash

They are not intended to be run directly.


This script is a Python script which is intended to be called from a crontab entry one per hour.

It ensures that all current users are added to the limits group. This makes it easy for an administrator to configure global limits on values such as MaxScanRows, MaxSearchResults etc. This can reduce load on a heavily loaded instance.

For more information:

/p4/common/bin/ <instance>
/p4/common/bin/ 1

8. Upgrading the SDP

This section defines the procedure for ugprading the SDP itself.

8.1. Upgrade Order: SDP first, then Helix P4D

Starting with the r20.1 release of SDP, the released versions of SDP match released versions of P4D. So SDP r20.1 will be guaranteed to work with P4D r20.1.

The SDP should normally be upgraded prior to the upgrade of Helix Core (P4D). If you are upgrading P4D to or beyond P4D 2019.1 from a prior version of P4D, you must upgrade the SDP first. If you run multiple instances of P4D on a given machine (potentially each running different versions of P4D), upgrade the SDP first before upgrading any of the instances.

8.1.1. Upgrading P4D

If P4D is already 2019.1 or newer, after the SDP upgrade, Helix Core can be upgraded using the SDP Section 7.2.2, “” script. Commonly, the SDP and P4D upgrades are done in a single maintenance window.

If run on a global topology, the Section 7.2.2, “” script must be run on outermost replica servers of the topology first (e.g. replicas of edges), and then their P4TARGET servers, and finally on the master/commit server after all replicas have been upgraded. Run /p4/common/bin/ -man to see the documentation on staging binaries prior to running on any given machine.

If P4D is older than 2019.1, contact us for upgrade details.

8.2. SDP and P4D Version Compatibility

The SDP is often forward- and backward-compatible with P4D versions, but for best results they should be kept in sync by upgrading SDP before P4D. This is partly becuase the SDP contains logic that helps upgrade P4D, which can change as P4D evolves.

The SDP is aware of the P4D version, and has backward-compatibility logic to support older versions of P4D. This is guraanteed for supported versions of P4D (generally current and two prior releases). Backward compatiblity of SDP with older versions of P4D is likely to extend farther back, though without the "offically supported" guarantee.

8.3. SDP Installation Methods

There are 4 methods for installing a new version of the SDP in order to upgrade, each described in detail later.

  • In-Place, Automated: Automated in-place upgrades can be done if your current SDP version is r20.1 or later, and you are upgrading SDP to r20.2 or later.

  • In-Place, Manual: Manual upgrades of the SDP must be peformed to upgrade from versions older than r20.1.

  • Migration-Style: A migration-style upgrade is one in which the existing server machines (virtual or physical) are left in place, and brand new "green field" machines are installed fresh using the Helix Installer (which installs the latest SDP on a "green field" baseline operating system). Then the Helix Core data is migrated from the existing hardware to the new hardware. This approach is especially appealing when upgrading other aspects of the infrastructure, such as the hardware and/or operating system.

  • Custom with HMS: The Helix Management System is used by some customers.

8.4. Custom HMS Managed Installations

If the Helix Management System (HMS) is used to manage this installation, you should have custom site-specific documentation for upgrading the SDP that supercedes this documentation. If the file /p4/common/bin/hms exists at your site, you have an HMS-managed site. Conact Perforce Consulting for more information.

Note that HMS solutions are inherently custom and not officially supported, but can be fully automated for global Helix Core topologies.

8.5. Upgrade from SDP 2020.1+

If your current version of the SDP is 2020.1 or later, you will be able to upgrade the SDP on any given machine to 2020.2 or later using the script. Starting with the SDP 2020.2 release, an will be included in the SDP which will SDP in place on any given machine from any prior version, so long as the version is 2020.1 or later.

To confirm that your current version of the SDP is 2020.1 or later, check the contents of the file: /p4/common/Version

8.6. Upgrade from pre-20.1 SDP

The following procedure accounts for details for upgrading from various older implementations of the SDP, going back as far as 2007.

8.6.1. Mount Point Names

You will need to be aware of your moint point names. While referred to as mount point names in this document, in any given installation any or all of the three SDP "mount points" may be simple directories on the root volume or some other volume. In some installations, creative liberties were taken to use fewer than three volumes, and in some cases the operating system root volume was used as one of the volumes. Investiage and be aware of how your installation was configured.

In the examples below, the modern SDP mount point names are used:

  • /hxdepots - Volume for versioned files and rotated/numbered metadata journals.

  • /hxmetadata- Volume for active and offline metadata

  • /hxlogs - Volume for active journal and various logs.

Depending on the version of the SDP, the above values may be used, or earlier defaults such as, /depotdata, /metadata, and logs. However, often customer sites changed from the defaults to custom values, such as /depots, /p4db, /p4journal, and others.

In the sample steps in this document, adapt the steps to use your local values for mount point names to the new values.

If your site uses two volumes for metadata, /hxmetadata1 and /hxmetadata2, continue using the same names below.

8.6.2. Operating System User

You will need to be aware of your operating system user that p4d runs as in your environment.

The sample steps below assume that Perforce runs as the peforce operating system user, which is typical. Adapt if your user is something else, such as p4admin.

In modern installations, the default home directory is /home/perforce, though in some installations the home directory is /p4. In either case, this does not need to be changed during the upgrade process.

8.6.3. Upgrade Procedure for Pre-SDP 2020.1 SDP.

The procedure is broken into 3 phases, Preparation, Execution, and PostOp. Preparation steps can be done in a non-disruptive manner on the production server ahead of the Execution. Execution steps are generally performed in a scheduled maintenance window. PostOp steps are done some time after (perhaps days or weeks after) the upgrade is complete. Preparation

Preparation steps are:

  1. Acquire Downloads.

  2. Deploy new SDP common files.

  3. Modify new SDP config files.

  4. Configure new SDP instance bin files and symlinks.

  5. Determine Metadata Symlink Type (Fixed or Variable)

  6. Account for customization (if any)

PREP STEP 1: Acquire Downloads

Copy the downloaded tarball to the machine and put it in /hxdepots/sdp.Unix.tgz. (If a file with the same name exists from a previous upgrade, move it aside first.)

Next, get the latest p4, p4d, p4broker, and p4p executables from the Perforce FTP server:, and get them copied to /tmp.

The following is typically performed in a scheduled maintenance window.

PREP STEP 2: Deploy new SDP commmon files


PREP STEP 3: Modify new SDP config files




PREP STEP 6: Account for any customizations.

Login as the perforce operating system user, and run this command:

ls -l /p4/1/root /p4/1/offline_db

The root and offline_db will be symlinks.

Depending on how old the SDP is, the structure will either be fixed or variable metadata symlinks. Determine which you have.

Variable Metadata Symlink References

If one of the symlinks points to a directory ending in db1, and the other in db2 (it doesn’t matter which is pointing to which), you have variable metadata symlinks.

Fixed Metadata Symlink References

If the target of the root and offline_db symlinks points to directories ending in the same names, i.e. root and offline_db, then you have fixed metadata symlinks.

PREP STEP 6: Account for customization (if any) Execution

Execution steps are:

  1. Stop Services

  2. Move Old SDP aside.

  3. Upgrade Physical Structure

  4. Put new SDP common files in place.

  5. Put new SDP instance bin files in place.

EXEC STEP 1. Stop Services

Stop the p4d service for all instances on this machine. Also stop all p4broker services running on this machine (if any).

For this short maintenance, the broker cannot be left running (e.g. to broadcast a "Down For Maintenance (DFM)" message) because the structure change cannot be started until all processes launched from the SDP directory structure have stopped.

Sample commands:

p4d_1_init status
p4d_1_init stop
p4d_1_init status

p4broker_1_init status
p4broker_1_init stop
p4broker_1_init status

The extra status are for situational awareness; and are not strictly necessary.

EXEC STEP 2. Move old SDP Aside
EXEC STEP 3. Upgrade Physical Structure

In this step, the physical structure of the upgrade is done for pre-2019.1 SDP.

The structure of the SDP changed in the 2019.1 release, to increase performance and reduce complexit in post-failover operations. The following notes describe how to do an in-place conversion to the new structure.

First, become familar with the Pre-2019.1 and 2019.1+ structures.

SDP Pre-2019.1 Structure:

  • /p4 is a directory on the operating system root voume, /.

  • /p4/N is a symlink to a directory is typically the mount point for a storage volume (/hxdepots by default).

  • /p4/N contains symlinks for /hxdepots, /hxmetadata, and hxlogs, as well as tickets and trust files.

SDP 2019.1+ Structure:

  • /p4 is a directory on the operating system root volume, /, (same as Pre-2019.1 Structure).

  • /p4/N is local directory on the operating system root volume,

  • /p4/N contains symlinks for /hxdepots, /hxmetadata, and hxlogs, as well as tickets and trust files (same as the Pre-2019.1 structure)

  • /p4/N/bin is local directory on the operating system root volume. The bin directory is the only actual directory in /p4/N; other items are files or symlinks to directories.

The script (included in the SDP starting with SDP 2019.1) give errors if the 2019.1+ SDP structure is not in place.

Converting the SDP structure in-place to the new style requires downtime on the edge/replica of interest. While the downtime can be brief if only the SDP structure is changed, commonly the P4D is upgraded in the same maintenance window. If the P4D is pre-2019.1, a longer maintenance window will be required, depending on duration of checkpoints.

Following is the procedure to upgrade the structure in-place on a machine.

In the following sample procedure, the default SDP instance name of 1 is used, and default mount point names are used. Adapt this to your environment by applying this procedure to each instance on any given machine. If you have multiple instances, apply this procedure for each instance, one at a time.

Move the instance symlink aside, and replace it with a regular directory. Then copy the .p4* files (e.g. .p4tickets and .p4trust) into the new directory. Sample commands:

cd /p4
mv 1 1.old_symlink
mkdir 1
cd 1
cp -p /p4/1.old_symlink/.p4t* .

If you have Fixed Metadata Symlinks, first convert them to to Variable Metadata Symlinks. If you already have Varialbe Metadata Symlinks, proceed to STEP 5.

In this step, move the underlying directories that will be pointed to by the root and offline_db sylmink names, and move them to their db1 and db2 names.

mv /hxmetadata/p4/1/root /hxmetadata/p4/1/db1
mv /hxmetadata/p4/1/offline_db /hxmetadata/p4/1/db2

Next, recreate the same symlinks you see reported by the ls command:

ls -l /p4/1.old_symlink/*
cd /p4/1

ln -s /hxmetadata/p4/1/db1 root
ln -s /hxmetadata/p4/1/db2 offline_db
Do not just copy the sample commands above. Pay close attention to the ls output, and make sure the root points to whatever it was pointing to before, either a directory ending in db1 or db2 (unless you just converted from Fixed Metadata Symlinks in STEP 4). Also confirm that offline_db and root aren’t both pointing to the same directory; one should be pointing to db1 and the other to db2.

Then, create additional symlinks akin to whatever else is in /p4/1.old_symlink

That should look something like this:

cd /p4/1
ln -s /hxdepots/p4/1/depots
ln -s /hxdepots/p4/1/checkpoints
ln -s /hxdepots/p4/1/checkpoints.YourEdgeServerID
ln -s /hxlogs/p4/1/logs
ln -s /hxlogs/p4/1/tmp

ls -l

Next, create the bin directory, as a local directory and copy files to it:

mkdir bin
cd bin
cp /p4/1.old_symlink/bin/p4d_1_init .
cp /p4/1.old_symlink/bin/p4broker_1_init .
ln -s /p4/common/bin/p4broker_1_bin p4broker_1
ln -s /p4/common/bin/p4_bin p4_1

Last, take a look at /p4/1.old_symlink/bin/p4d_1 - that p4d_1 will be either a tiny script or a symlink (depending on whether your p4d is case sensitive or not). If you server is case sensitive, it will be a symlink. If your server is case-insensitive, it will be a tiny script.

If your server is case sensitive, create the symlink like this:

ln -s /p4/common/bin/p4d_1_bin p4d_1

OR, if your server is case-sensitive, that p4d_1 will be a tiny script, so just copy it:

cp /p4/1.old_symlink/bin/p4d_1 .

Then, start your server again, and run the script and confirm that it’s happy now. If so, you should be good to run the

EXEC STEP 4. Put new SDP common files in place.


EXEC STEP 5. Put new SDP instance bin files in place.


POSTOP STEP N: Cleanup - Deferred

Appendix A: SDP Package Contents

The directory structure of the SDP is shown below in Figure 1 - SDP Package Directory Structure. This includes all SDP files, including documentation and maintenance scripts. A subset of these files are deployed to server machines during the installation process.

    Server (Core SDP Files)
            setup (unix specific setup)
                    bin (Backup scripts, etc)
                        triggers (Example triggers)
    setup (cross platform setup - typemap, configure, etc)
    test (automated test scripts)

Figure 1 - SDP Package Directory Structure

A.1. Volume Layout and Server Planning

Figure 2: SDP Runtime Structure and Volume Layout, viewed from the top down, displays a Perforce application administrator’s view of the system, which shows how to navigate the directory structure to find databases, log files, and versioned files in the depots. Viewed from the bottom up, it displays a Perforce system administrator’s view, emphasizing the physical volume where Perforce data is stored.

A.1.1. Memory and CPU

Make sure the server has enough memory to cache the db.rev database file and to prevent the server from paging during user queries. Maximum performance is obtained if the server has enough memory to keep all of the database files in memory. While the p4d process itself is frugal with system resources such as RAM, it benefits from an excess of RAM due to modern operating systems using excess RAM as file I/O cache. This is to the great benefit of p4d, even though the p4d process itself may not be seen as consuming much RAM directly.

Below are some approximate guidelines for allocating memory.

  • 1.5 kilobyte of RAM per file revision stored in the server.

  • 32 MB of RAM per user.

INFO: When doing detailed history imports from legacy SCM systems into Perforce, there may be many revisions of files. You want to account for (total files) x (average number of revisions per file) rather than simply the total number of files.

Use the fastest processors available with the fastest available bus speed. Faster processors are typically more desirable than a greater number of cores and provide better performance since quick bursts of computational speed are more important to Perforce’s performance than the number of processors. Have a minimum of two processors so that the offline checkpoint and back up processes do not interfere with your Perforce server. There are log analysis options to diagnose underperforming servers and improve things. Contact Perforce Support/Perforce Consulting for details.

A.1.2. Directory Structure Configuration Script for Linux/Unix

This script describes the steps performed by the script on Linux/Unix platforms. Please review this appendix carefully before running these steps manually. Assuming the three-volume configuration described in the Volume Layout and Hardware section are used, the following directories are created. The following examples are illustrated with "1" as the server instance number.

Directory Remarks


Must be under root (/) on the OS volume


Files in here are generated by the script.




Contains p4_<instance>.vars file, e.g. p4_1.vars


Files from $SDP/Server/Unix/p4/common/bin.


Contains init.d and cron.d.



Contains offline copy of main server databases (linked by /p4/1/offline_db.


Used only during running of for extra redundancy.

Next, creates the following symlinks in the /hxdepots/p4/1 directory:

Link source Link target Command



ln -s /hxmetadata1/p4/1/root



ln -s /hxmetadata1/p4/1/offline_db



ln -s /hxlogs/p4/1/logs

Then these symlinks are created in the /p4 directory:

Link source Link target Command



ln -s /hxdepots/p4/1 /p4/1



ln -s /hxdepots/p4/common /p4/common

Next, renames the Perforce binaries to include version and build number, and then creates appropriate symlinks.

The versioned binary links in /p4/common/bin are as below.

For the example of <instance> 1 we have:

ls -l /p4/1/bin
p4d_1 -> /p4/common/bin/p4d_1_bin

The structure is shown in this example, illustrating values for two instances, with instance #1 using p4d release 2018.1 and instance #2 using release 2018.2.

In /p4/1/bin:

p4_1 -> /p4/common/bin/p4_1_bin
p4d_1 -> /p4/common/bin/p4d_1_bin

In /p4/2/bin:

p4_2 -> /p4/common/bin/p4_2
p4d_2 -> /p4/common/bin/p4d_2

In /p4/common/bin:

p4_1_bin -> p4_2018.1_bin
p4_2018.1_bin -> p4_2018.1.685046
p4_2_bin -> p4_2018.2_bin
p4_2018.2_bin -> p4_2018.2.700949
p4d_1_bin -> p4d_2018.1_bin
p4d_2018.1_bin -> p4d_2018.1.685046
p4d_2_bin -> p4d_2018.2_bin
p4d_2018.2_bin -> p4d_2018.2.700949

The naming of the last comes from:

./p4d_2018.2.700949 -V
Rev. P4D/LINUX26X86_64/2018.2/700949 (2019/07/31).

So we see the build number p4d_2018.2.700949 being included in the name of the p4d executable.

Although this link structure may appear quite complex, it is easy to understand, and it allows different instances on the same server host to be running with different patch levels, or indeed different releases. And you can upgrade those instances independently of each other which can be very useful.

A.1.4. Case Insensitive P4D on Unix

By default p4d is case sensitive on Unix for filenames and directory names etc.

It is possible and quite common to run your server in case insensitive mode. This is often done when Windows is the main operating system in use on the client host machines.

In "case insensitive" mode, that means that you should ALWAYS execute p4d with the flag -C1 (or you risk possible table corruption in some circumstances).

The SDP achieves this by executing a simple Bash script:

# shellcheck disable=SC2016
exec $P4D -C1 "$@"

So the above will ensure that /p4/common/bin/p4d_1_bin (for instance 1) is executed with the -C1 flag.

As noted above, for case sensitive servers, p4d_1 is normally just a link:

/p4/1/bin/p4d_1 -> /p4/common/bin/p4d_1_bin

Appendix B: Frequently Asked Questions/Troubleshooting

This appendix lists common questions and problems encountered by SDP users. Do not hesitate to contact if additional assistance is required.

B.1. Journal out of sequence

This error is encountered when the offline and live databases are no longer in sync, and will cause the offline checkpoint process to fail. Because the scripts will replay all outstanding journals, this error is much less likely to occur. This error can be fixed by running the Section 7.3.6, “” script. Alternatively, if you know that the checkpoints created from previous runs of Section 7.3.4, “” are correct, then restore the offline_db from the last known good checkpoint.

B.2. Unexpected end of file in replica daily sync

Check the start time and duration of the Section 7.3.4, “” cron job on the master. If this overlaps with the start time of the Section 7.5.30, “” cron job on a replica, a truncated checkpoint may be rsync’d to the replica and replaying this will result in an error.

Adjust the replica’s cronjob to start later to resolve this.

Default cron job times, as installed by the SDP are initial estimates, and should be adjusted to suit your production environment.

Appendix C: Starting and Stopping Services

There are a variety of init mechanisms on various Linux flavors. The following describes how to start and stop services using different init mechanisms.

C.1. SDP Service Management with the systemd init mechanism

On modern OS’s, like RHEL/CentOS 7/& 8, and Ubuntu 18.04 and 20.04, and SuSE 12 and 15, the systemd init mechanim is used. The underlying SDP init scripts are used, but they are wrapped with "unit" files in /etc/systemd/system directory, and called using the systemctl interface as root (typically using sudo while running as the perforce user).

On systems where systemd is used, the service should only be started using the sudo systemctl command, as in this example:

sudo systemctl status p4d_N
sudo systemctl start p4d_N
sudo systemctl status p4d_N

Note that there is no immediate indication from running the start command that it was actually successful, hence the status command is run immediately after. (If the start was unsuccessful, a good start to diagnostics would include running tail /p4/N/logs/log and cat /p4/N/logs/p4d_init.log).

The service should also be stopped in the same manner:

sudo systemctl stop p4d_N

Checking for status can be done using both the systemctl command, or calling the underlying SDP init script directly. However, there are cases where the status indication may be different. Calling the underlying SDP init script for status will always report status accurately, as in this example:

/p4/N/bin/p4d_N_init status

That works reliably even if the service was started with systemctl start p4d_N.

Checking status using the systemctl mechanis is done like so:

sudo systemctl start p4d_N

If this reports that the service is active (running), such indication is relaible. However, the status indication may falsely indicate that the service is down when it is actually running. This will occur if the underlying init script was used to start the server rather than using sudo systemctl start p4d_N as prescribed. The status indication will only indicate that the service is running if it was started using the systemctl mechanism.

Since status is unreliable with systemd, a reboot of the system without first manually shutting down the p4d process will not benefit from a graceful shutdown, and data corruption is possible. This issue is not specific to p4d. Any database application can suffer the same sort of corruption if not shutdown gracefully during a reboot.

To ensure no such corruption occurs, it is strongly recommended that the p4d service

C.1.1. Brokers and Proxies

In the above examples for starting, stoping, and status-checking of services using either the SysV or systemd init mechanisms, p4d is the sample service managed. This can be replaced with p4p or p4broker to manage proxy and broker services, respectively. For example, on a systemd system, the broker service, if configured, can be started like so:

sudo systemctl status p4broker_1
sudo systemctl start p4broker_1
sudo systemctl status p4broker_1

C.1.2. Root or sudo required with systemd

For SysV, having sudo is optional, as the underlying SDP init scripts can be called safely as root or perforce; the service runs as perforce.

If systemd is used, by default root access (often granted via sudo) is needed to start and stop the p4d service, effectively making sudo access required for the perforce user. The systemd "unit" files provided with the SDP handle making sure the underlying SDP init scripts start running under the correct operating sytem account user (typically perforce).

C.2. SDP Service Management with SysV init mechanism

On older OS’s, like RHEL/CentOS 6, the SysV init mechanism is used. For those, you can the following example commands, replacing N with the actual SDP instance name

sudo service p4d_N_init status

The service can be checked for status, started and stopped by calling the underlying SDP init scripts as either root or perforce directly:

/p4/N/bin/p4d_N_init status

Replace status with start or stop as needed. It is common to do a status check immediately before and after a start or stop.

During installation, a symlink is setup such that /etc/init.d/p4d_N_init is a symlink to /p4/N/bin/p4_N_init, and the proper chkconfig commands are run to register the application as a serivice that will be started on boot and gracefully shutdown on reboot.

On systems using SysV, calling the underlying SDP init scripts is safe and completely interchangeable with using the service command being run as root. That is, you can start a service with the underlying SDP init script, and the SysV init mechanism will still safely detect whether the service is running during a system shutdown, and thus will perform a graceful stop if p4d is up and running when you go to reboot. The status indication of the underlying SDP init script is absolutely 100% reliable, regardless of how the service was started (i.e. calling the init script directly as root or perforce, or using the service call as root.