Skip to content

Commit 1ce2407

Browse files
committed
docs(backup): document manual restore steps
Adds a "Restore from a backup archive" section to docs/cli/backup.md covering: - How to inspect a backup with verify + reading the embedded manifest.json - Archive payload layout (<archive-root>/payload/posix/<abs-path>/...) - Same-machine restore via tar -xzf back to original paths - New-machine / different-path restore via staging directory + cp -a - Pointer to /install/migrating for guided cross-machine flows OpenClaw does not currently ship `openclaw backup restore`, so the docs explicitly call that out and explain the manual `tar` extract guided by the manifest. Frontmatter `read_when` is extended to cover restore. Closes #77849
1 parent 7d5ca30 commit 1ce2407

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

‎docs/cli/backup.md‎

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ summary: "CLI reference for `openclaw backup` (create local backup archives)"
33
read_when:
44
- You want a first-class backup archive for local OpenClaw state
55
- You want to preview which paths would be included before reset or uninstall
6+
- You want to restore from a `.tar.gz` archive previously created by `openclaw backup`
67
title: "Backup"
78
---
89

@@ -20,6 +21,8 @@ openclaw backup create --only-config
2021
openclaw backup verify ./2026-03-09T00-00-00.000Z-openclaw-backup.tar.gz
2122
```
2223

24+
OpenClaw does not currently ship an `openclaw backup restore` subcommand. Restore is a manual `tar` extract guided by the embedded `manifest.json`. See [Restore from a backup archive](#restore-from-a-backup-archive) below.
25+
2326
## Notes
2427

2528
- The archive includes a `manifest.json` file with the resolved source paths and archive layout.
@@ -90,6 +93,83 @@ Large workspaces are usually the main driver of archive size. If you want a smal
9093

9194
For the smallest archive, use `--only-config`.
9295

96+
## Restore from a backup archive
97+
98+
`openclaw backup` does not yet provide a paired `openclaw backup restore` subcommand. Archives produced by `openclaw backup create` are plain `.tar.gz` files, and the embedded `manifest.json` records each backed-up source path so you can extract the right pieces back to the right place.
99+
100+
### Inspect the archive first
101+
102+
Before extracting anything, verify the archive and read the manifest so you know which paths it contains:
103+
104+
```bash
105+
openclaw backup verify ./2026-03-09T00-00-00.000Z-openclaw-backup.tar.gz
106+
107+
# Print just the manifest from the archive (no extraction).
108+
tar -xOzf ./2026-03-09T00-00-00.000Z-openclaw-backup.tar.gz \
109+
2026-03-09T00-00-00.000Z-openclaw-backup/manifest.json
110+
```
111+
112+
The manifest reports `paths.stateDir`, `paths.configPath`, `paths.oauthDir`, and `paths.workspaceDirs` — these are the absolute paths the archive was created from. The `assets[]` array lists every backed-up source plus its `archivePath` inside the tarball.
113+
114+
### Archive layout
115+
116+
Inside the tarball, every backed-up tree is rooted under:
117+
118+
```
119+
<archive-root>/payload/posix/<absolute-source-path-without-leading-slash>/...
120+
```
121+
122+
(or `<archive-root>/payload/windows/<DRIVE>/<rest>/...` on Windows). The `<archive-root>` is the timestamped directory that matches the archive basename, for example `2026-03-09T00-00-00.000Z-openclaw-backup`. There is also a top-level `<archive-root>/manifest.json`.
123+
124+
### Restore on the same machine (paths unchanged)
125+
126+
If you are restoring to the same machine and the original absolute paths still exist, stop the gateway, then extract the relevant payload subtrees back to their original locations. For example, to restore the state directory only:
127+
128+
```bash
129+
openclaw gateway stop
130+
131+
ARCHIVE=./2026-03-09T00-00-00.000Z-openclaw-backup.tar.gz
132+
ROOT=2026-03-09T00-00-00.000Z-openclaw-backup
133+
STATE_DIR="$HOME/.openclaw"
134+
135+
# Move the existing state aside instead of deleting it.
136+
mv "$STATE_DIR" "$STATE_DIR.pre-restore.$(date +%s)" 2>/dev/null || true
137+
138+
# Extract just the state-directory payload back to /.
139+
# (-C / + the encoded "posix/<abs-path>" layout puts files back at their original paths.)
140+
tar -xzf "$ARCHIVE" -C / --strip-components=3 \
141+
"$ROOT/payload/posix${STATE_DIR}"
142+
143+
openclaw doctor
144+
openclaw gateway start
145+
openclaw status
146+
```
147+
148+
Repeat for `configPath`, `oauthDir`, and any `workspaceDirs` you want to restore. Use the `assets[]` entries from the manifest to confirm the exact `archivePath` for each tree before extracting.
149+
150+
### Restore on a new machine or to a different path
151+
152+
If the original absolute paths do not exist (new machine, new home directory, or you want to inspect first), extract into a staging directory and then copy the trees you want into place:
153+
154+
```bash
155+
mkdir -p /tmp/openclaw-restore
156+
tar -xzf ./2026-03-09T00-00-00.000Z-openclaw-backup.tar.gz -C /tmp/openclaw-restore
157+
158+
# Read /tmp/openclaw-restore/<archive-root>/manifest.json to map archived paths
159+
# to where you want them on the new machine, then move trees individually, e.g.:
160+
mkdir -p "$HOME/.openclaw"
161+
cp -a /tmp/openclaw-restore/2026-03-09T00-00-00.000Z-openclaw-backup/payload/posix/Users/old-user/.openclaw/. "$HOME/.openclaw/"
162+
163+
openclaw doctor
164+
openclaw gateway restart
165+
openclaw status
166+
```
167+
168+
After any restore, run `openclaw doctor` so it can apply config migrations and repair services. The state directory's `extensions/` tree is restored without nested `node_modules/`; if a restored plugin reports missing dependencies, run `openclaw plugins update <id>` or reinstall it with `openclaw plugins install <spec> --force`.
169+
170+
If you are migrating to a new machine and want a guided end-to-end flow rather than manual `tar` commands, see [Migrating an OpenClaw install](/install/migrating).
171+
93172
## Related
94173

95174
- [CLI reference](/cli)
175+
- [Migrating an OpenClaw install](/install/migrating)

0 commit comments

Comments
 (0)