{"id":602,"date":"2026-03-21T22:52:56","date_gmt":"2026-03-21T14:52:56","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/cli-backup\/"},"modified":"2026-03-21T23:08:55","modified_gmt":"2026-03-21T15:08:55","slug":"cli-backup","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/cli-backup\/","title":{"rendered":"backup"},"content":{"rendered":"<h1>backup<\/h1>\n<h1><code>openclaw backup<\/code><\/h1>\n<p>Create a local backup archive for OpenClaw state, config, credentials, sessions, and optionally workspaces.<\/p>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\nopenclaw backup create<br \/>\nopenclaw backup create &#8211;output ~\/Backups<br \/>\nopenclaw backup create &#8211;dry-run &#8211;json<br \/>\nopenclaw backup create &#8211;verify<br \/>\nopenclaw backup create &#8211;no-include-workspace<br \/>\nopenclaw backup create &#8211;only-config<br \/>\nopenclaw backup verify .\/2026-03-09T00-00-00.000Z-openclaw-backup.tar.gz<\/p>\n<pre><code>\n## Notes\n\n* The archive includes a `manifest.json` file with the resolved source paths and archive layout.\n* Default output is a timestamped `.tar.gz` archive in the current working directory.\n* If the current working directory is inside a backed-up source tree, OpenClaw falls back to your home directory for the default archive location.\n* Existing archive files are never overwritten.\n* Output paths inside the source state\/workspace trees are rejected to avoid self-inclusion.\n* `openclaw backup verify &lt;archive&gt;` validates that the archive contains exactly one root manifest, rejects traversal-style archive paths, and checks that every manifest-declared payload exists in the tarball.\n* `openclaw backup create --verify` runs that validation immediately after writing the archive.\n* `openclaw backup create --only-config` backs up just the active JSON config file.\n\n## What gets backed up\n\n`openclaw backup create` plans backup sources from your local OpenClaw install:\n\n* The state directory returned by OpenClaw's local state resolver, usually `~\/.openclaw`\n* The active config file path\n* The OAuth \/ credentials directory\n* Workspace directories discovered from the current config, unless you pass `--no-include-workspace`\n\nIf you use `--only-config`, OpenClaw skips state, credentials, and workspace discovery and archives only the active config file path.\n\nOpenClaw canonicalizes paths before building the archive. If config, credentials, or a workspace already live inside the state directory, they are not duplicated as separate top-level backup sources. Missing paths are skipped.\n\nThe archive payload stores file contents from those source trees, and the embedded `manifest.json` records the resolved absolute source paths plus the archive layout used for each asset.\n\n## Invalid config behavior\n\n`openclaw backup` intentionally bypasses the normal config preflight so it can still help during recovery. Because workspace discovery depends on a valid config, `openclaw backup create` now fails fast when the config file exists but is invalid and workspace backup is still enabled.\n\nIf you still want a partial backup in that situation, rerun:\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\nopenclaw backup create --no-include-workspace\n<\/code><\/pre>\n<p>That keeps state, config, and credentials in scope while skipping workspace discovery entirely.<\/p>\n<p>If you only need a copy of the config file itself, <code>--only-config<\/code> also works when the config is malformed because it does not rely on parsing the config for workspace discovery.<\/p>\n<h2>Size and performance<\/h2>\n<p>OpenClaw does not enforce a built-in maximum backup size or per-file size limit.<\/p>\n<p>Practical limits come from the local machine and destination filesystem:<\/p>\n<ul>\n<li>Available space for the temporary archive write plus the final archive<\/li>\n<li>Time to walk large workspace trees and compress them into a <code>.tar.gz<\/code><\/li>\n<li>Time to rescan the archive if you use <code>openclaw backup create --verify<\/code> or run <code>openclaw backup verify<\/code><\/li>\n<li>Filesystem behavior at the destination path. OpenClaw prefers a no-overwrite hard-link publish step and falls back to exclusive copy when hard links are unsupported<\/li>\n<\/ul>\n<p>Large workspaces are usually the main driver of archive size. If you want a smaller or faster backup, use <code>--no-include-workspace<\/code>.<\/p>\n<p>For the smallest archive, use <code>--only-config<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>backup openclaw backup Create a local backup archive fo [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-602","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/602","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=602"}],"version-history":[{"count":2,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/602\/revisions"}],"predecessor-version":[{"id":721,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/602\/revisions\/721"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}