# Backing up the panel

> Back up and restore a FeatherPanel install with the installer's Backup Manager or database snapshots, and the files you must not lose.

Source: https://featherpanel.com/docs/panel/backups/

This page covers the panel itself: its database, its configuration and uploaded files. Game server data lives on your
nodes; see [server backups](https://featherpanel.com/docs/wings/server-backups) and [node backups](https://featherpanel.com/docs/wings/node-backups).

## What you must keep

| Item | Where | Why |
|------|-------|-----|
| Database | `mariadb_data` volume | Users, servers, nodes, settings |
| Backend `.env` | `featherpanel_config` volume, `storage/config/.env` | Holds `DATABASE_ENCRYPTION_KEY` |
| Uploads and plugins | `featherpanel_attachments`, `featherpanel_addons` volumes | Files users and admins uploaded, installed plugins |
| Host `.env` and Compose file | `/var/www/featherpanel/` | Database passwords, updater token, Cloudflare settings |

> [!DANGER]
> The panel encrypts secrets such as node tokens with `DATABASE_ENCRYPTION_KEY`. If you restore a database without the
> `.env` it was encrypted with, those values cannot be read. Keep both together.

## Backup Manager

Run the installer, pick `[1] Panel`, then `Backup Manager`:

| Option | What it does |
|--------|--------------|
| Create Backup | Archives every `featherpanel_*` volume and the host `docker-compose.yml` and `.env` |
| List Backups | Lists archives in `/var/www/featherpanel/backups` |
| Restore Backup | Stops the stack, restores the volumes, optionally restores the Compose file and `.env`, starts the stack |
| Delete Backup | Deletes an archive after you type `yes` |
| Export for Migration | Writes a migration package to `/var/www/featherpanel/migrations` |
| Import Migration | Restores a migration package on a new server |

A backup is `featherpanel_backup_YYYYMMDD_HHMMSS.tar.gz`, mode `600`. Inside it are `volumes/<volume>.tar.gz`, a `config/`
folder and `backup_info.txt`. The containers must be running when you create one.

> [!WARNING]
> The Backup Manager copies the raw MariaDB files while the database is running. That is usually fine on a quiet panel,
> but a dump is safer. Take a [snapshot](#database-snapshots) or a `mariadb-dump` as well before large changes.

> [!WARNING]
> `/var/www/featherpanel/backups` is inside the install directory. Uninstalling with the installer deletes that directory,
> and a disk failure takes the backups with the panel. Copy archives to another machine.

## Database snapshots

The panel CLI can dump the database to a FeatherPanel Backup file (`.fpb`, plain SQL) in `storage/backups`, which is the
`featherpanel_snapshots` volume:

```bash
featherpanel snapshots create
featherpanel snapshots list
featherpanel snapshots restore snapshot_<timestamp>.fpb
```

Restore asks for confirmation unless you add `-y`. See the [Panel CLI](https://featherpanel.com/docs/cli/panel) for all subcommands.

## A plain dump

```bash
docker exec featherpanel_mysql sh -c 'mariadb-dump -uroot -p"$MARIADB_ROOT_PASSWORD" featherpanel' > featherpanel.sql
docker cp featherpanel_backend:/var/www/html/storage/config/.env featherpanel-backend.env
```

## Scheduled backups

The installer does not schedule backups. Add a cron job on the host, for example a nightly snapshot:

```cron
30 3 * * * /usr/local/bin/featherpanel snapshots create >/dev/null 2>&1
```

For automatic backups of servers and nodes managed by the panel, see [admin backups](https://featherpanel.com/docs/admin/backups).

## Moving to a new server

Use Export for Migration on the old server, copy the package (the installer prints `scp` and `rsync` commands), install
FeatherPanel on the new server and run Import Migration. The full procedure is in
[Migrating between hosts](https://featherpanel.com/docs/migrating/between-hosts).

## Frequently asked questions

### Where are FeatherPanel backups stored?

The installer's Backup Manager writes featherpanel_backup_YYYYMMDD_HHMMSS.tar.gz files to /var/www/featherpanel/backups. Database snapshots are .fpb files in the featherpanel_snapshots volume.

### Does a panel backup include game server files?

No. Server files live on your Wings nodes. Use server backups and node backups for them.
