{"id":375,"date":"2026-10-14T00:31:08","date_gmt":"2026-10-14T00:31:08","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2014\/09\/22\/ways-to-perforce-server-disk-space-cleanup-and-repos-size-management\/"},"modified":"2026-10-14T00:31:08","modified_gmt":"2026-10-14T00:31:08","slug":"ways-to-perforce-server-disk-space-cleanup-and-repos-size-management","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/ways-to-perforce-server-disk-space-cleanup-and-repos-size-management\/","title":{"rendered":"Perforce Server Disk Cleanup and Repository Size Management: A Safe, Practical Playbook"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Originally published on 2014-09-22; fully revised and updated.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If your Perforce (Helix Core) server is low on disk, cleanup should be done in a controlled order so you recover capacity without damaging metadata. This guide expands the original draft checklist into an operator-friendly workflow: establish a baseline, choose the right cleanup method, and validate after each change.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.devopsschool.com\/blog\/ways-to-perforce-server-disk-space-cleanup-and-repos-size-management\/\">Original post<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3540 aligncenter\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/09\/perforce-server-disk-space-.png\" alt=\"perforce-server-disk-space-cleanup-and-repos-size-management\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/09\/perforce-server-disk-space-.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/09\/perforce-server-disk-space--300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where Perforce disk usage usually grows<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The original article identified five useful areas. In practice, they map to two categories: <strong>measurement<\/strong> (understanding where space is going) and <strong>intervention<\/strong> (reclaiming or relocating storage).<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Checkpoint and journal history accumulation over time<\/li><li>Insufficient capacity under the current <code>P4ROOT<\/code> filesystem<\/li><li>Large or stale workspace metadata (including <code>db.have<\/code>)<\/li><li>Lack of regular visibility into depot and server storage trends<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Disk-space triage workflow<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use a measure-first sequence before deleting anything. This reduces the chance of reclaiming the wrong data or introducing avoidable downtime.<\/p>\n\n\n\n<pre class=\"mermaid\">\nflowchart TD\n    A[Capture baseline] --> B[Run p4 diskspace]\n    B --> C[Run p4 sizes by depot path]\n    C --> D{Main pressure source}\n    D --> E[Checkpoint and journal retention cleanup]\n    D --> F[Move P4ROOT to larger storage]\n    D --> G[Workspace metadata review]\n    E --> H[Maintenance window execution]\n    F --> H\n    G --> H\n    H --> I[Post-change validation and monitoring]\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Commands to measure space before cleanup<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Check server-level disk visibility<\/h3>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">p4 diskspace<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Use this as a quick operational check to understand available space from the server side before making any cleanup decision.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Estimate depot footprint by path<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript language-bash\">p4 sizes <span class=\"hljs-comment\">\/\/depot\/...<\/span>\np4 sizes <span class=\"hljs-comment\">\/\/depot\/projectA\/...<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Run this at broad and narrow scopes to find which depot areas are contributing most to growth.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Cleanup options compared<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Option<\/th><th>What it helps with<\/th><th>Risk level<\/th><th>When to use it<\/th><\/tr><\/thead><tbody><tr><td>Prune old checkpoints and journals<\/td><td>Recovers space from backup artifacts<\/td><td>Medium<\/td><td>When retention is undefined or too long<\/td><\/tr><tr><td>Move <code>P4ROOT<\/code> to larger storage (symlink or mount strategy)<\/td><td>Removes immediate filesystem pressure<\/td><td>Medium to High<\/td><td>When server metadata volume is outgrowing current disk<\/td><\/tr><tr><td><code>db.have<\/code> maintenance<\/td><td>Can reduce workspace metadata burden<\/td><td>High<\/td><td>Only with a tested runbook and change control<\/td><\/tr><tr><td>Regular <code>p4 diskspace<\/code> and <code>p4 sizes<\/code> checks<\/td><td>Prevents surprise capacity incidents<\/td><td>Low<\/td><td>As part of normal operations<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Operational playbook<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1) Clean up old checkpoints and journals first<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a fresh checkpoint, inventory existing files, and review age before deleting anything. Keep enough history for your recovery policy.<\/p>\n\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\">p4 admin checkpoint\nls -lh \/p4\/<span class=\"hljs-number\">1<\/span>\/checkpoints\nfind \/p4\/<span class=\"hljs-number\">1<\/span>\/checkpoints -type f -mtime +<span class=\"hljs-number\">30<\/span> -<span class=\"hljs-keyword\">print<\/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<p class=\"wp-block-paragraph\">The last command is intentionally non-destructive (preview only). Review output and apply your approved retention policy before removal.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2) Relocate P4ROOT only during a planned maintenance window<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If disk pressure is structural, move server root data to a larger volume, then link back. Validate startup and command behavior immediately after.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript language-bash\">sudo systemctl stop perforce\nsudo rsync -a \/p4\/<span class=\"hljs-number\">1<\/span>\/root\/ <span class=\"hljs-regexp\">\/data\/<\/span>perforce\/root\/\nsudo mv \/p4\/<span class=\"hljs-number\">1<\/span>\/root \/p4\/<span class=\"hljs-number\">1<\/span>\/root.backup\nsudo ln -s \/data\/perforce\/root \/p4\/<span class=\"hljs-number\">1<\/span>\/root\nsudo systemctl start perforce<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript language-bash\">p4 info\np4 diskspace\np4 -c workspace_name sync -n <span class=\"hljs-comment\">\/\/depot\/...<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Service names and paths differ by installation. Treat the above as a template, not a copy-paste runbook.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3) Treat db.have operations as high risk<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The original draft mentions deleting <code>db.have<\/code>. This can affect client sync state and should only be done with version-specific guidance, tested recovery steps, and a rollback plan.<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">p4 clients\np4 client -d workspace_name<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\">When possible, prefer lower-risk cleanup (for example, removing stale workspaces) before considering direct metadata-table intervention.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Best practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Measure first with <code>p4 diskspace<\/code> and <code>p4 sizes<\/code>, then decide.<\/li><li>Use explicit retention rules for checkpoints and journals.<\/li><li>Run disruptive changes only in maintenance windows with rollback steps.<\/li><li>Avoid direct metadata-table manipulation unless fully documented and tested for your server version.<\/li><li>Schedule recurring capacity checks so growth is handled before it becomes an incident.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Running out of storage on a Perforce (Helix Core) server can quickly become an availability risk. This guide shows a safer cleanup workflow: measure space first, compare options, then execute changes with minimal operational risk.<\/p>\n","protected":false},"author":1,"featured_media":3540,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[370],"tags":[1817,1816,1820,1122,545,1806,244,373,1821,1823,1822,593,1818,1819,399,732,213,1452],"class_list":["post-375","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-perforce","tag-cleanup","tag-disk-space","tag-disk-space-cleanup","tag-guide","tag-how","tag-instruction","tag-management","tag-perforce","tag-perforce-server","tag-perforce-server-guide","tag-perforce-server-tutorial","tag-process","tag-repos","tag-repos-size-management","tag-server","tag-steps","tag-tutorial","tag-ways"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/375","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=375"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/375\/revisions"}],"predecessor-version":[{"id":79255,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/375\/revisions\/79255"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/3540"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}