> ## Documentation Index
> Fetch the complete documentation index at: https://sitectl.libops.io/llms.txt
> Use this file to discover all available pages before exploring further.

# backup

> Create and restore complete site backups containing MariaDB and persistent file volumes.

Use `backup` when database state and persistent application files must move or
recover together. The resulting directory contains a logical MariaDB dump,
archives for the selected non-database volumes, and metadata needed for restore.

```bash theme={null}
sitectl backup create
sitectl backup restore backups/20260808T120000Z --yolo
```

Restore replaces current state. Keep a separate copy of the current site,
inspect the selected context, and stop customer writes before proceeding. After
restore, run `sitectl healthcheck` followed by the application's
`sitectl verify` checks.

## Reference

Create or restore a full-site database and file-volume backup

```bash theme={null}
sitectl backup <command>
```

### `backup create`

Create a compressed logical MariaDB dump plus tar archives for named
Compose volumes not mounted as MariaDB data. sitectl briefly stops the running
application services while leaving MariaDB available, then resumes exactly the
services that were running even when backup creation fails. Full-site backup is
currently supported from Linux operator hosts.

```bash theme={null}
sitectl backup create
```

| Flag           | Default | Description                                                              |
| -------------- | ------- | ------------------------------------------------------------------------ |
| `-o, --output` |         | Project-relative backup directory; defaults to backups/YYYYMMDDTHHMMSSZ. |

### `backup restore`

Validate and stage the complete backup before stopping the site, retain
recovery snapshots of current file and MariaDB volumes, then replace the site.
If a commit step fails, sitectl restores every retained snapshot and restarts the
stack. External Compose volumes are never modified. This destructive operation
requires `--yolo` after the operator verifies the selected backup and is currently
supported from Linux operator hosts.

```bash theme={null}
sitectl backup restore DIRECTORY
```

| Flag     | Default | Description                                                       |
| -------- | ------- | ----------------------------------------------------------------- |
| `--yolo` | `false` | Confirm replacement of current database and file-volume contents. |
