Skip to content

Backups and restoration

Make, check and restore backups, move to a new server, and switch between local and S3 storage.

Avenvail's backup command writes one .tar file that holds everything needed to rebuild the installation:

  • a consistent snapshot of the database (accounts, tokens, files, share links), taken with SQLite's backup API so Avenvail can keep running;
  • the key ring from /data/keys, which sessions and stored share links need;
  • the contents of every file, read through the configured storage (local or S3) and checked against the SHA-256 recorded when it was uploaded;
  • a manifest with the size and SHA-256 of everything above.

Uploads an intake automation is still processing and uploads in quarantine are not in the backup either: their content lives only in /data/temp and /data/quarantine. After a restore they show as quarantined with nothing to release, and expire with the quarantine retention.

Configuration (.env, Compose file, proxy config) is not in the backup. Keep those, and the secrets in them, somewhere safe as well.

A backup contains password hashes, encryption keys and every file. Treat it like the server itself: the file is created readable only by the Avenvail user, and copies you make should be encrypted (see Off-site copies).

The examples assume the Compose setup from Install, with a ./backups folder mounted at /backups.

Make a backup

docker compose exec avenvail dotnet Avenvail.Api.dll admin backup /backups/
Backup written to /backups/avenvail-backup-20261128T034500Z.tar (1,284,331,520 bytes).
  1 user(s), 2,310 file(s), 1,904 share link(s), 2,310 object(s).

Options:

OptionMeaning
/backups/ (a folder)Writes avenvail-backup-<UTC time>.tar into it. You can also give a full file name.
--keep <n>After a successful backup into a folder, deletes older avenvail-backup-*.tar files there, keeping the newest n.
--no-blobsLeaves file contents out. Only for S3 storage that you back up separately (see S3).

If a stored file is missing or its bytes no longer match the checksum from upload, the backup is not written and the error names the affected files. Restore them from another copy or delete them in Avenvail, then try again.

Daily backups

With cron on the Docker host (the DigitalOcean installer sets this up):

30 3 * * * root cd /opt/avenvail && docker compose exec -T avenvail dotnet Avenvail.Api.dll admin backup /backups/ --keep 7 >> /var/log/avenvail-backup.log 2>&1

A backup that includes file contents needs about as much free space as your files, plus the database size in /data/temp while it runs.

Check a backup

docker compose exec avenvail dotnet Avenvail.Api.dll admin verify-backup /backups/avenvail-backup-20261128T034500Z.tar

This reads the whole archive and checks every checksum without changing anything. Run it on copies you keep off-site, too.

Restore

Restore into a stopped Avenvail. It refuses to run while an Avenvail server is using the same data directory.

docker compose stop avenvail
docker compose run --rm avenvail admin restore /backups/avenvail-backup-20261128T034500Z.tar
docker compose up -d

The restore:

  1. checks every checksum in the archive, and refuses a backup made by a newer Avenvail than the one running;
  2. refuses to replace an installation that already has an account or files, unless you add --force. With --force, the current database and keys are moved to /data/pre-restore-<time>/ rather than deleted;
  3. writes the files into the configured storage, swaps in the database and keys, and applies any database migrations this version needs;
  4. re-reads the newest files from storage and checks them against their checksums, then prints a few share links with the SHA-256 they should serve:
Restored the backup made 2026-11-28 03:45 UTC by Avenvail 0.1.0.
  1 user(s), 2,310 file(s), 1,904 share link(s), 2,310 object(s). 2,310 object(s) written to local storage.
Checked the 10 newest files against the checksums recorded at upload: all match.
After starting Avenvail, these share links should download files with the listed SHA-256:
  https://files.example.com/s/Qm9...Xc/raw  sha256 81018ae0ac2c...
Start Avenvail again to use the restored installation.

After starting Avenvail, spot-check one of them:

curl -s https://files.example.com/s/Qm9...Xc/raw | sha256sum

Sign in with the account from the backup. Existing share links, ShareX tokens and deletion links keep working. Browser sessions from before the backup also survive, because the keys are restored.

Uploads that were still in progress when the backup ran did not finish, and are cleaned up during the restore.

Move to a new server

  1. On the old server, make a backup and copy it off, e.g. scp root@old:/opt/avenvail/backups/avenvail-backup-*.tar .
  2. On the new server, install Avenvail as usual with the same Avenvail__BaseUrl (and the same storage settings, unless you are moving storage). Do not complete first-run setup. If the installer started Avenvail, stop it: docker compose stop avenvail.
  3. Copy the backup into the new server's backups folder and make it readable by Avenvail: sudo chown 1654 backups/*.tar.
  4. Run the restore and start Avenvail, as above.
  5. Point DNS at the new server.

The restore treats an installation with no account and no files as empty, so step 2 does not need --force.

S3 storage

By default a backup copies every file out of the bucket into the archive, so it protects you even if the bucket is lost. For large buckets that can be slow and needs local disk. If you protect the bucket another way, back up only the database and keys:

docker compose exec avenvail dotnet Avenvail.Api.dll admin backup /backups/ --no-blobs

A restore of such a backup checks that every file it refers to exists in the configured bucket with the right size, and stops without changing anything if one is missing.

Protecting the bucket itself is up to your provider's tools: replication to a second bucket or region, or a scheduled rclone sync to other storage. Versioning helps against overwrites and accidental deletes, but it is not a backup on its own: it does not survive deleting the bucket or losing the account.

Moving between local and S3 storage

A backup that includes file contents can be restored into an installation configured with different storage. The restore writes every file into the new storage and records it there.

  1. Make a backup (without --no-blobs).
  2. Stop Avenvail and change the storage settings in .env.
  3. docker compose run --rm avenvail admin restore /backups/<file> --force (--force because the installation already has data).
  4. Start Avenvail and check a few files.

Files in the old storage are not deleted. Remove them yourself once you are satisfied.

Off-site copies and encryption

Backups on the same disk as the server do not protect against losing the server. Copy them somewhere else and encrypt them on the way. Some options:

  • restic or Borg: encrypted, deduplicated repositories, e.g. restic -r s3:... backup /opt/avenvail/backups.
  • rclone with a crypt remote, to any cloud storage.
  • age for a single file: age -r <public key> -o backup.tar.age avenvail-backup-....tar.

Keep at least one copy that the server's own credentials cannot delete. Test a restore from it now and then, for example into a throwaway Compose project on another machine.

Recovery checklist

  • verify-backup passes on the copy you restore from.
  • The restore printed no problems.
  • You can sign in, and the Files page shows what you expect.
  • A share link printed by the restore downloads with the listed SHA-256.
  • ShareX can upload with an existing token.
  • Once you are satisfied, delete /data/pre-restore-* if the restore made one.