Vaultwarden Backup and Restore: SQLite, Attachments and a Test Drill

Guide · Vaultwarden · Last updated · How we research

Sources: official docs and release notes · Drafted with AI assistance, then checked against the linked sources

On this page
  1. What lives in /data
  2. Step 1 — Consistent SQLite backup (Docker)
  3. Step 2 — Copy attachments and recommended files
  4. Step 3 — Automate daily
  5. Step 4 — Restore drill
  6. Restore on a new server
  7. FAQ
  8. Sources

Pinned version: Vaultwarden 1.37.5 (GitHub release). Last checked: 2026-11-10.

Vaultwarden's wiki says to back up regularly (preferably automated) and keep at least one copy off the machine. For the default SQLite setup, you must back up db.sqlite3 and the attachments directory; config.json and rsa_key* files are recommended. Avoid relying only on filesystem or VM snapshots.

If Vaultwarden is not installed yet, follow Vaultwarden with Docker + HTTPS. After a restore, common errors cover DOMAIN and volume mistakes.

What lives in /data

From the official Backing up your vault wiki page:

PathRequired?Notes
db.sqlite3 (+ WAL handling)RequiredAlmost all vault state
attachments/RequiredFile attachments are not in the DB
sends/OptionalEphemeral Send files
config.jsonRecommendedAdmin-page settings (may hold secrets in plaintext)
rsa_key*RecommendedJWT signing; losing them logs everyone out
icon_cache/OptionalCan be refetched

Encrypt backups that include config.json or rsa_key.pem if they leave your host (admin token, SMTP secrets, signing key).

Step 1 — Consistent SQLite backup (Docker)

Since Vaultwarden 1.32.1 the binary can back up SQLite itself. With Docker:

sh
docker exec -it vaultwarden /vaultwarden backup

That uses SQLite's online backup API while the server runs. The wiki also shows host-side sqlite3 … ".backup '…'" if you install sqlite3 on the host; official images do not ship sqlite3 or cron inside the container, so schedule jobs on the host.

Copy the resulting db_*.sqlite3 (or your dated backup file) out of the data volume to another disk or object storage.

While the container can stay up for the DB backup command, also copy:

Example host-side rsync of everything except live SQLite sidecars, after a /vaultwarden backup:

sh
rsync -a --exclude 'db.sqlite3-shm' ./vw-data/ /path/to/backups/vw-$(date +%Y%m%d)/

Keep the dated db_*.sqlite3 from Step 1 with that tree. Tools the wiki mentions for offsite copies include rclone, restic and rustic.

Step 3 — Automate daily

Run Step 1 (and the file copy) from cron on the Docker host at least daily. The wiki's example of stopping Compose, zipping /opt/vw-data and scp-ing offsite is valid when you want a cold copy; the built-in /vaultwarden backup avoids downtime for the database portion.

Step 4 — Restore drill

  1. Stop Vaultwarden (docker compose stop vaultwarden or equivalent).
  2. Replace files under the data directory with the backup.
  3. If the DB backup came from .backup, VACUUM INTO, or /vaultwarden backup, **delete any existing db.sqlite3-wal** before start — a stale WAL can corrupt the restored DB. Rename your backup file to db.sqlite3.
  4. If you instead copied db.sqlite3 + matching db.sqlite3-wal as a pair while the DB was idle, restore both together. You do not need db.sqlite3-shm.
  5. Start Vaultwarden and log in with a test client.

The wiki recommends practising restore periodically and keeping the previous data directory aside until the drill succeeds.

Restore on a new server

To restore Vaultwarden on a new server, stop the container, put your backed-up db.sqlite3, attachments/, rsa_key* files and config.json into the new /data folder, delete any stale db.sqlite3-wal, and start the same image tag you backed up from. Then check that DOMAIN still matches the URL your apps use. The Vaultwarden wiki covers what to back up; this page is the restore side. For making the backups, see Vaultwarden backup.

Quick answer

  1. Install Docker on the new server and pin the old tag, for example vaultwarden/server:1.37.5. Don't start it yet.
  2. Copy the backup into the new data folder: the database (renamed to db.sqlite3), attachments/, rsa_key*, config.json and optionally sends/.
  3. Delete any db.sqlite3-wal if your database backup came from /vaultwarden backup, .backup or VACUUM INTO.
  4. Start the container with the same DOMAIN and reverse proxy setup, then log in and check items and attachments.
  5. Update to the latest release only after the restore works.

What each file does on restore

From the wiki's Backing up your vault page:

File or folderIf you restore itIf it's missing
db.sqlite3Users, items, organizations, 2FA settings come backNothing to restore; this is the vault
attachments/File attachments open againAttachments are not in the database, so they're gone
rsa_key*Logged-in apps stay logged inEvery user is logged out and must log in again; open email invitations stop working
config.jsonAdmin-page settings come backYou re-enter settings; environment variables apply instead
sends/Existing file Sends keep workingOnly Send files are lost; Send text lives in the database
icon_cache/Not neededIcons are fetched again

Step 1: the database and the WAL file

The wiki's restore rule is short and important:

On a brand-new server there's usually no old WAL file, but check anyway: if you started the container once to test it, it may have created an empty database and a WAL next to it. Stop the container and replace them.

Before you start, you can check the file with SQLite's own integrity check on the host: sqlite3 db.sqlite3 "PRAGMA integrity_check" should print ok (SQLite docs). The official Docker image doesn't include sqlite3, so run this on the host.

Step 2: match the version

Start the new server on the same image tag you ran when you made the backup, for example vaultwarden/server:1.37.5 instead of latest. Once it works, update the normal way described in the wiki's Updating the vaultwarden image page: pull the new image and recreate the container with the same data folder.

Don't restore a database from a newer Vaultwarden onto an older image. The wiki doesn't document running an older release on a newer database, so treat it as unsupported. See Vaultwarden release notes for what changed between 1.37.x releases.

Step 3: DOMAIN, config.json and HTTPS

Step 4: check it worked

  1. Log in with a test account, or your own, and compare the item count with what you expect.
  2. Open one item with an attachment.
  3. Check an organization collection if you use them.
  4. Log in from a phone app. If you restored rsa_key*, existing sessions should keep working.
  5. Keep the old server's data folder untouched until you're sure. The wiki recommends keeping a copy of the original data whenever you practice a restore.

If logins fail with "failed to fetch" or a 502, see Vaultwarden errors.

Keep these steps where you'll find them during an outage: add Vaultwarden to Lab Lifeboat, our free offline restore planner, or print the Vaultwarden restore checklist.

FAQ

Is copying the whole Docker volume enough?

Only if Vaultwarden is stopped (or you accept crash-consistent risk). For a live SQLite file, use /vaultwarden backup or sqlite3 .backup so pages are consistent.

Do I need the icon cache?

No. It is optional; icons can be fetched again.

Does this replace Bitwarden.org cloud export?

This backs up your self-hosted Vaultwarden data directory. Client-side encrypted exports are a separate Bitwarden client feature and are not a substitute for server attachments/ and SQLite.

How do I restore Vaultwarden from a backup?

Stop Vaultwarden, replace the files in the data folder with your backup (db.sqlite3, attachments/, rsa_key*, config.json), delete any stale db.sqlite3-wal if the database came from /vaultwarden backup, .backup or VACUUM INTO, then start the same image tag you backed up from.

Should I delete db.sqlite3-wal when restoring Vaultwarden?

Yes, if your backup came from /vaultwarden backup, .backup or VACUUM INTO. The wiki warns a stale WAL file could corrupt the restored database. If you copied db.sqlite3 and its matching WAL file together, restore them as a pair.

Sources

Printable restore checklist: Vaultwarden restore checklist. One page with what to back up, the restore steps, gotchas and how to check it worked. Or build a full recovery pack for your lab.

Related guides