logo

Back up and export your data

Your hosted Perforce server is backed up by the platform. Backup & export gives you your own copy as well: a read-only endpoint that only your backup machine can reach, and a command you run there whenever you want a fresh, restorable snapshot. You hold the key; we never see the private half.

Is this the right page?

This page moves data out of the platform onto a machine you control. If you want to move an existing Perforce server onto the platform, you want Bring an existing server across.

Bring an existing server across Back up and export your data
Use it whenYou already run Perforce elsewhere and want to move onto our platform.Your Perforce server runs on our platform and you want your own off-site copy.
Data movesFrom your current server to your new server here.From your server here to your backup machine.
Who runs rsyncWe do.You do, with a command we generate.
Whose SSH keyOurs. You install its public half on your current server.Yours. You paste its public half into the app.
When it is availableOnly when the server is created, by choosing Bring my server across.Any time, on a live server.
It ends withA live server here, adopted from your data.A standing endpoint and a restorable copy on your machine.

The reliable tell: a screen about installing our key on your server is migration. A command you run against our server is export.

What you get, and what you do not

What an export contains
IncludedNever included
A consistent checkpoint of the server (.dsl_export/checkpoint.ckp.N.gz), cut for you when you pull. A few small p4d runtime files (monfile.mem, server.locks/, state.xu) come along too; ignore them.The live db.* database files. A checkpoint is the consistent form of the same data.
The depot archive directories: your versioned file content.Your Perforce license file. Licenses are never copied off the server.
Replica and standby state, the server's TLS private key, and our own credential files.

Open Backup & Export

In the project sidebar, expand Source Control Hosting and choose Backup & Export. The page is titled Backup & export with the sub-line Pull your own off-site copy of this project's Perforce server.

  • If you are not a project administrator the page says Only project administrators can configure backup & export access.
  • If the project has no server yet it says No Perforce server yet. Create one under Server Configuration, then come back to set up backups.

With a live server, the page shows the Back up / export your data panel: Get a locked-down, read-only endpoint you pull your own off-site backup from — no support ticket needed. The same endpoint can seed a new Perforce service on this system: create it in migration mode and use the “copying from another DevStreamLabs Perforce server” helper on its handshake screen.

The Back up / export your data panel before export is enabled: the key generation instruction, the SSH public key and Backup server IP or CIDR fields, and the Enable export button.
The panel before export is enabled.

Generate a key on your backup machine

  1. Create an SSH key pair on the machine that will pull backups

    The panel shows the command. Run it on your backup machine, not on your workstation.

    On your backup machine
    ssh-keygen -t ed25519 -f ./perforce-backup-key
    
  2. Copy the public half

    On your backup machine
    cat ./perforce-backup-key.pub
    

    You will paste this one line into the app. The private key, ./perforce-backup-key, stays on the backup machine; nothing in the app or in this flow ever asks for it.

Enable export

Fields on the export form
FieldWhat to enter
SSH public keyThe single line from perforce-backup-key.pub. Placeholder: ssh-ed25519 AAAA... backup@yourhost.
Backup server IP or CIDRThe public address your backup machine connects from, 198.51.100.7 in this guide, or a range such as 198.51.100.0/28 if it may move within a subnet. The panel notes: Only this address will be able to reach the backup endpoint. An all-addresses range (/0) is refused.

Choose Enable export. If a value is rejected the reason appears next to the field in plain language, for example the backup IP must not be an all-addresses range (/0); the full list is on Troubleshooting.

Wait for the endpoint to arm

Accepting the form does not open the endpoint yet. The panel reads Setting up your backup endpoint… while two things happen in order: a public port is allocated and routed, and then the server confirms its SSH endpoint is listening with your key. The pull command is not valid until both have happened, which usually takes a minute or two.

The panel in its enabling state, reading Setting up your backup endpoint…

Pull a backup

When the endpoint is live the panel shows an Enabled pill and the details you need:

Rows on the enabled export panel
RowExampleMeaning
Endpoint203.0.113.20:42022The address and port your backup machine connects to. The port is allocated per project.
Backup userp4_northwind_starfallThe account the endpoint accepts your key for; a random twelve-letter name.
Whitelisted from198.51.100.7The only source address allowed to connect. Check it matches your backup machine.
Copy commandsee belowThe rsync command to run, with two placeholders for you to fill.
The enabled panel: Endpoint, Backup user and Whitelisted from rows with Copy buttons, the Copy command block, the Restoring the backup instructions, and Change access and Remove access buttons.
An armed endpoint, ready to pull from.

The command as the panel shows it:

Copy command, as shown
rsync -rltz --info=progress2 -e 'ssh -p 42022 -i /path/to/your/private_key' [email protected]:p4root/ /path/to/your/backup/

Replace the two placeholders: -i /path/to/your/private_key with the path to the private key you generated, and /path/to/your/backup/ with where the copy should land. Then run it on your backup machine.

On your backup machine, placeholders filled in
rsync -rltz --info=progress2 -e 'ssh -p 42022 -i ~/perforce-backup-key' \
  [email protected]:p4root/ /srv/p4-backups/starfall/

The panel explains: Run this on your backup server (the one at 198.51.100.7). It only ever reads — you cannot write to your hosted server through it. Before running, replace -i /path/to/your/private_key with the private half of the key you pasted above, and /path/to/your/backup/ with your destination directory. The panel also shows Last backup pulled: with the time of the last checkpoint it cut for you; that time can lag a pull until the panel next refreshes.

Pull on a schedule

The endpoint stays available until you remove it, so the same command works from a scheduler. A nightly pull with a systemd timer:

/etc/systemd/system/perforce-backup.service
[Unit]
Description=Pull the starfall Perforce backup

[Service]
Type=oneshot
User=backup
ExecStart=/usr/bin/rsync -rltz --info=progress2 -e 'ssh -p 42022 -i /home/backup/perforce-backup-key' [email protected]:p4root/ /srv/p4-backups/starfall/
/etc/systemd/system/perforce-backup.timer
[Unit]
Description=Nightly starfall Perforce backup

[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true

[Install]
WantedBy=timers.target
Enable it
sudo systemctl enable --now perforce-backup.timer

Restore from a backup

The panel carries the restore instructions under Restoring the backup: Restore into a fresh, empty P4ROOT: p4d -r <new_root> -z -jr <checkpoint.ckp.N.gz>, then place the pulled depot archive directories under <new_root>, then start p4d and run p4 verify -q //.... Step by step, on a machine with p4d installed:

  1. Create an empty root and restore the checkpoint

    mkdir -p /opt/perforce/restore
    p4d -r /opt/perforce/restore -z -jr /srv/p4-backups/starfall/.dsl_export/checkpoint.ckp.N.gz
    

    Use the newest checkpoint.ckp.N.gz under .dsl_export/ in your pulled tree. -z tells p4d the checkpoint is compressed.

  2. Put the depot archives in place

    cp -a /srv/p4-backups/starfall/depot /opt/perforce/restore/
    

    Copy each depot archive directory from your pull into the new root, keeping the directory names. Your depot directories are named after your depots; depot is the default.

  3. Start the server and verify

    p4d -r /opt/perforce/restore -p 1666 -d
    p4 -p localhost:1666 verify -q //...
    

    p4 verify -q prints nothing when every file's content is present and matches its recorded digest. Output means content is missing or changed.

  4. Install a license

    The restored server is unlicensed until you place your license file in the new root. Until then it accepts two users and five workspaces.

Change or remove access

Change access reopens the form so you can rotate the key or move to a new backup address; the endpoint is re-armed with the new values and the old key stops working. Remove access closes the endpoint. It asks first: Remove backup & export access? Your backup endpoint will be closed. Existing backups already on your server are unaffected. Choose Remove access to confirm or Not yet to keep it. The panel reads Closing your backup endpoint… while the port and routing are released.

The Remove backup & export access? dialog with its explanation and the Not yet and Remove access buttons.

How the endpoint is locked down

  • Read-only by construction. Your key is bound to a forced command that only serves rsync --sender, a pull. A push, a delete, a shell, port forwarding or SFTP are refused.
  • One source address. Your backup address is enforced twice: at the network edge, and in the key line itself with from=.
  • A dedicated SSH service. The endpoint runs its own hardened SSH daemon on its own port with a single allowed user, key authentication only.
  • Path-confined. The command can read the export tree and nothing else; the exclusions above are applied on our side and cannot be overridden from yours.

Something out of date or unclear? Email [email protected].