---
title: "Backups and restore"
description: "How HolaClaw Server backs itself up, how to take, download and verify a backup, and how to restore one, on the same host or a new one."
updated: 2026-11-16
canonical: https://holaclaw.ai/docs/server/backups
---

A running HolaClaw Server daemon takes and keeps its own backups. You can also take one at any time, copy it off the machine, and restore it on the same host or a new one.

Commands are written as `holaclaw …`. Run them [the way your deployment does](/docs/server/choose-a-deployment#where-things-are).

## Automatic backups

The daemon takes a backup every `backups.every` (default `24h`) and keeps the newest `backups.keep` (default `7`; `0` turns them off). It never prunes the backups you asked for or uploaded. They live under `backups/` in the data directory.

```toml
# config.toml
[backups]
every = "12h"
keep  = 14
```

## What a backup holds

An archive holds the database, the blobs and the config files. It includes `auth.toml` only with `--include-secrets`, and then whoever has the archive holds every credential.

The owner's admin token file is never in it. Copy it out beside the archive if you need it.

## Common tasks

| Task | Command |
| --- | --- |
| Take one now | `holaclaw backup create --wait` |
| Take one with the secrets | `holaclaw backup create --wait --include-secrets` |
| List them | `holaclaw backup list` |
| Download or upload one | `holaclaw backup download <id>`, `holaclaw backup upload <file>` |
| Verify one | `holaclaw backup verify <id or file>` |
| Delete one | `holaclaw backup rm <id>` |
| Back up a stopped or broken installation, with no daemon | `holaclaw backup --out <path>` |

The same operations are in the Control API, under `/v1/backups`, for `admin` tokens.

### Back up a container

Do not copy the volumes of a running container: the database can be caught mid-write. Have the daemon take a backup, then copy it out:

```sh
docker exec holaclaw holaclaw backup create --wait --include-secrets
docker cp holaclaw:/var/lib/holaclaw/backups/<id>.tar.gz .
(umask 077; docker exec holaclaw cat /etc/holaclaw-secrets/token > token)
```

`backup create` prints the `<id>`.

## Restore on the same installation

```sh
holaclaw backup restore <id>
```

This replaces the database and the blobs with the backup's, and restarts the daemon on them. Everything stored since then is gone, API tokens included. The config files and `auth.toml` are not touched.

## Restore on a new host

With no daemon running, `holaclaw backup restore <file>` recreates the whole installation from an archive: the config files, `auth.toml` if the archive holds it, the database and the blobs. `holaclaw init` is not needed, and refuses to run on a restored installation: the owner and the API tokens come with the database.

- The config files go into `/etc/holaclaw`, or into the directory that `--config` or `HOLACLAW_CONFIG` names.
- The data and the secrets go where the archive's own `config.toml` says.
- It lists every directory and file it would create or replace, and asks before writing. `--yes` skips the question.
- It deletes nothing. A replaced config file is kept in `<config dir>/.backup-<timestamp>/`, and a replaced `auth.toml` or database beside the new one, as `.pre-restore`.
- It refuses to run while the daemon of that config directory is running.

### Restore a container

Start from empty volumes, put the archive in the data volume, restore it with no daemon running, put the token back, then start the container and remove the archive:

```sh
docker run --rm -i -v holaclaw-data:/var/lib/holaclaw --entrypoint sh ghcr.io/ikitana/holaclaw:latest \
  -c 'cat > /var/lib/holaclaw/restore.tar.gz' < <id>.tar.gz
docker run --rm -v holaclaw-config:/etc/holaclaw -v holaclaw-secrets:/etc/holaclaw-secrets \
  -v holaclaw-data:/var/lib/holaclaw ghcr.io/ikitana/holaclaw:latest \
  backup restore --yes /var/lib/holaclaw/restore.tar.gz
docker run --rm -i -v holaclaw-secrets:/etc/holaclaw-secrets --entrypoint sh ghcr.io/ikitana/holaclaw:latest \
  -c 'umask 077; cat > /etc/holaclaw-secrets/token' < token
# start the container with the usual `docker run`, then:
docker exec holaclaw rm /var/lib/holaclaw/restore.tar.gz
```

## How it works

- **The archive** is a gzipped tar of a consistent snapshot, with a `MANIFEST.json` of sizes and hashes that `backup verify` checks. The daemon takes the snapshot through its own database handle, so writes can go on meanwhile.
- **A backup is whole or failed.** It is written under a temporary name and renamed when complete. One cut short by a restart is marked `failed`, and its partial file removed.
- **A restore is two steps.** The running daemon checks the archive, unpacks it and restarts. The next start swaps the database in before opening it. A crash halfway is finished by the next start.

## Related

- [Upgrades](/docs/server/upgrades)
- [Secrets](/docs/server/secrets)

