{"id":349,"date":"2026-10-13T18:30:58","date_gmt":"2026-10-13T18:30:58","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2014\/02\/18\/perforce-backup-commands\/"},"modified":"2026-10-13T18:30:59","modified_gmt":"2026-10-13T18:30:59","slug":"perforce-backup-commands","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/perforce-backup-commands\/","title":{"rendered":"Perforce Backup Commands: Checkpoints, Journal Rotation, and Restore Workflow"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Originally published on 2014-02-18; fully revised and updated.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you administer a Perforce server, these commands are the building blocks for consistent backups and recovery. This rewrite expands the original command list from <a href=\"https:\/\/www.devopsschool.com\/blog\/perforce-backup-commands\/\">the source article<\/a> into a practical runbook-style reference.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/02\/perforce-backup-commands.png\" alt=\"perforce-backup-commands\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/02\/perforce-backup-commands.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/02\/perforce-backup-commands-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Perforce backup command reference<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The original post highlights that the <code>-z<\/code> flag enables compression. The table below summarizes each command and its purpose.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>Primary purpose<\/th><th>When to use it<\/th><\/tr><\/thead><tbody><tr><td><code>p4d -jc [-z]<\/code><\/td><td>Take a checkpoint and rotate the journal<\/td><td>Standard scheduled backup point<\/td><\/tr><tr><td><code>p4 admin checkpoint [-z]<\/code><\/td><td>Trigger checkpoint and journal handling from client side<\/td><td>When you operate through admin commands instead of direct server shell usage<\/td><\/tr><tr><td><code>p4d -jj [-z]<\/code><\/td><td>Rotate journal only<\/td><td>When you need journal rotation without creating a new checkpoint<\/td><\/tr><tr><td><code>p4d -jr [-z] filename<\/code><\/td><td>Restore from a journal file<\/td><td>Recovery and replay operations<\/td><\/tr><tr><td><code>p4d -jd [-z] filename<\/code><\/td><td>Write checkpoint to a specific file without incrementing checkpoint or journal counters<\/td><td>Manual or ad hoc checkpoint exports<\/td><\/tr><tr><td><code>p4d -c command<\/code><\/td><td>Lock database files and run a command<\/td><td>Consistent file-level operations while DB files are locked<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">p4d commands vs p4 admin checkpoint<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Option<\/th><th>Execution style<\/th><th>Typical operator context<\/th><\/tr><\/thead><tbody><tr><td><code>p4d -jc<\/code> and related <code>p4d<\/code> flags<\/td><td>Run directly on the server host<\/td><td>Platform or infrastructure admins with shell access<\/td><\/tr><tr><td><code>p4 admin checkpoint<\/code><\/td><td>Run as a Perforce admin command from client side<\/td><td>Perforce administrators managing backups through server command interfaces<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Backup and recovery workflow<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A safe operating pattern is to create a checkpoint, rotate and archive journals, and regularly validate that restoration works in a non-production environment.<\/p>\n\n\n\n<pre class=\"mermaid\">\nflowchart TD\n    A[Plan backup window] --> B[Run checkpoint and rotate journal]\n    B --> C[Archive checkpoint and journal files]\n    C --> D[Test restore in non production]\n    D --> E{Restore successful}\n    E -- no --> F[Fix runbook and repeat test]\n    E -- yes --> G[Keep retained backup sets]\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Example command patterns<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use these examples as templates and replace paths with your own server root and backup locations.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Create a checkpoint and rotate journal<\/span>\np4d -r \/p4\/<span class=\"hljs-number\">1<\/span>\/root -jc -z\n\n<span class=\"hljs-comment\"># Rotate journal only<\/span>\np4d -r \/p4\/<span class=\"hljs-number\">1<\/span>\/root -jj -z<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Create a checkpoint file without incrementing checkpoint or journal counters<\/span>\np4d -r \/p4\/<span class=\"hljs-number\">1<\/span>\/root -jd -z \/backups\/checkpoint.manual.gz\n\n<span class=\"hljs-comment\"># Lock database files and run a copy command<\/span>\np4d -r \/p4\/<span class=\"hljs-number\">1<\/span>\/root -c <span class=\"hljs-string\">\"cp -a db.* \/backups\/db-snapshot\/\"<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Journal restore example<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Replay a compressed journal file during recovery<\/span>\np4d -r \/p4\/<span class=\"hljs-number\">1<\/span>\/root -jr -z \/backups\/journal<span class=\"hljs-number\">.42<\/span>.gz<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Common pitfalls<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Running backup commands without documenting file naming and retention conventions.<\/li><li>Keeping backups but not performing periodic restore tests.<\/li><li>Mixing manual and automated checkpoint flows without clear runbook ownership.<\/li><li>Assuming all command flags behave identically across all Perforce server versions.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This guide explains the core Perforce backup commands from the original post and how to use them in a practical backup and restore workflow. You will get a command reference, comparison tables, and ready-to-adapt examples.<\/p>\n","protected":false},"author":1,"featured_media":3728,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[370],"tags":[591,2248,2250,378,2254,373,2247,2249,2251,2252,2256,2253,1956,1884,2255],"class_list":["post-349","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-perforce","tag-backup","tag-backup-commands","tag-backup-perforce-commands","tag-commands","tag-commands-for-perforce-backup","tag-perforce","tag-perforce-backup","tag-perforce-backup-commands","tag-perforce-backup-guide","tag-perforce-backup-instructions","tag-perforce-backup-method","tag-perforce-backup-tutorials","tag-perforce-guide","tag-perforce-tutorial","tag-recovery"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/349","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=349"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/349\/revisions"}],"predecessor-version":[{"id":79219,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/349\/revisions\/79219"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/3728"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}