Skip to content
Blog

Migrate Vaultwarden: Backup, Move & Restore

VaultKeepR cover: Migrate Vaultwarden: Backup, Move & Restore

To move Vaultwarden to a new server, stop the container, copy the whole data folder to the new host, start the same image there with the same DOMAIN, and log in. The folder holds the SQLite database, attachments, config.json and the rsa_key files. For a backup of a running instance, use the built-in /vaultwarden backup command instead of copying files.

This guide follows the official Vaultwarden wiki, read on 2026-11-30. Where the wiki is silent, the text says so.

What the data folder holds

By default, Vaultwarden keeps everything under a folder called data. In the Docker examples of the wiki that folder is mounted at /data, and the DATA_FOLDER variable changes its location. With the default SQLite backend, the wiki (last edited 2026-04-28) classifies the contents like this:

Item Wiki verdict What it is
db.sqlite3 Backup required Almost all state: vault entries, users, organizations, devices
db.sqlite3-wal Pair with the database Write-ahead log, not always present
db.sqlite3-shm Not needed Shared memory file
attachments/ Backup required File attachments, the only important data stored outside the database
config.json Backup recommended Admin page settings; holds the admin token and SMTP credentials in plaintext
rsa_key.pem, rsa_key.der, rsa_key.pub.der Backup recommended Sign authentication tokens
sends/ Backup optional Send file attachments, meant to be ephemeral
icon_cache/ Backup optional Cached website icons

Deleting the rsa_key files logs every user out and invalidates invitation tokens sent by mail. Since rsa_key.pem could in principle be used to forge login sessions, the wiki recommends encrypting it, and config.json, before they go to cloud storage. With MySQL or PostgreSQL the folder looks the same minus the SQLite files, and you dump the tables separately.

Back up a running instance

The wiki recommends the .backup command of the sqlite3 CLI. It uses SQLite's Online Backup API, which the SQLite documentation (page updated 2025-11-13) describes as the original method for backing up a live database. The copy can run in steps, so the source does not stay locked for the whole operation.

sqlite3 data/db.sqlite3 ".backup '/path/to/backups/db-$(date '+%Y%m%d-%H%M').sqlite3'"

The Docker images ship neither sqlite3 nor cron, according to the wiki. Since version 1.32.1 Vaultwarden has its own command:

docker exec -it vaultwarden /vaultwarden backup

Look for the new .sqlite3 file next to db.sqlite3 in the data folder, then copy it off the machine. A plain copy of the database is acceptable only when nothing uses it, and then db.sqlite3 and db.sqlite3-wal travel together. The wiki also advises against relying on VM or filesystem snapshots, because recovery from them can be difficult or impossible for a typical user.

These commands cover the database only. Copy attachments/, config.json and the rsa_key files with your usual tool; the wiki suggests rclone, restic or rustic.

Move Vaultwarden to a new server

You need SSH access to both hosts, root or sudo on each, and Docker Compose on the target. The example uses the layout of the wiki's compose template: a ./vw-data folder mounted at /data.

  1. On the old host, run docker compose down. The wiki's own Docker backup script also stops the container first to keep the data consistent.
  2. Archive the whole folder with permissions preserved: sudo tar -czpf vw-data.tar.gz -C ./vw-data .
  3. Copy it over SSH: scp vw-data.tar.gz user@new-host:~/. The archive contains rsa_key.pem and config.json, so delete it from both hosts once the move succeeds.
  4. On the new host, create the folder and extract before anything starts: mkdir vw-data && sudo tar -xzpf vw-data.tar.gz -C ./vw-data.
  5. Write a compose.yaml based on the wiki template, with the same DOMAIN as before:
services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: always
    environment:
      DOMAIN: "https://vault.example.com"
    volumes:
      - ./vw-data:/data
    ports:
      - 11001:80
  1. Run docker compose up -d && docker compose logs -f. This is the start command the wiki gives.
  2. Open your vault address in a browser and log in. Expected result: your items appear, and an item with an attachment opens it. Then log in from one client app. Switch DNS or your reverse proxy to the new host only after both checks pass.

My recommendation, not the wiki's: run the image tag you ran before, and upgrade as a separate step once the move works.

Permissions

The wiki states that vaultwarden/server runs as root inside the container by default. Extracting with sudo tar -p keeps the original ownership, which is what you want. If you run the container as another user, the wiki's example uses nobody and gives the folder to user ID 65534, and it stresses that the ID must match the user inside the container, not on the host.

Passkeys and security keys

The wiki says WebAuthn requires an HTTPS domain with a valid certificate and a DOMAIN value equal to the address Vaultwarden is served from. Keep the hostname unchanged during the move. If it must change, test your security keys on the new address before you shut down the old server.

Restore from a backup

  1. Stop Vaultwarden and replace each file or folder in data with its backed-up version.
  2. If the database came from .backup, VACUUM INTO or /vaultwarden backup, delete any existing db.sqlite3-wal first. A stale write-ahead log can corrupt the database when SQLite tries to recover from it.
  3. If you saved a straight copy, restore db.sqlite3 and its matching -wal file as a pair. You never need the -shm file.
  4. Start the container and check the logs.

The wiki also says to rehearse a restore now and then, keeping a copy of your original data while you do.

Switch from SQLite to PostgreSQL

Read the wiki's warning first: the migration is unsupported, has not been tested thoroughly, and is at your own risk. The page reports a test with SQLite 3.37.2, PostgreSQL 16.10 and Vaultwarden 1.34.3 (last edited 2026-07-24). SQLite remains what the wiki calls the most common setup.

  1. Create a database user and an empty database owned by it.
  2. Point a new Vaultwarden instance at the empty database and start it once, so the schema gets created. Do nothing else with it, then stop it.
  3. Install pgloader. With Vaultwarden stopped on the old file, open it with sqlite3 db.sqlite3 and run PRAGMA journal_mode=delete; to disable WAL.
  4. Create bitwarden.load, using the wiki's content:
load database
     from sqlite:///where/you/keep/your/vaultwarden/db.sqlite3
     into postgresql://yourpgsqluser:yourpgsqlpassword@yourpgsqlserver:yourpgsqlport/yourpgsqldatabase
     WITH data only, include no drop, reset sequences
     EXCLUDING TABLE NAMES LIKE '__diesel_schema_migrations'
     ALTER SCHEMA 'bitwarden' RENAME TO 'public'
;
  1. Run pgloader bitwarden.load. The wiki says warnings may appear and the migration should still complete.
  2. Set DATABASE_URL=postgresql://user:password@host:5432/vaultwarden and start Vaultwarden. Percent-encode special characters in the password.

A related trap on SQLite: if you run with ENABLE_DB_WAL=false, set it on every start, because a single start without it turns WAL back on. The setting has no effect on PostgreSQL.

Automate the backups

The wiki asks for regular, automated backups, preferably daily or more often, with at least one copy stored elsewhere. It also lists third-party backup projects and tells you to review any of them before use.

One of them is ttionya/vaultwarden-backup. Its README lists db.sqlite3, config.json, rsa_key*, attachments and sends among the backed-up items, and it uploads through rclone, which you configure before the first backup. Its automatic mode starts as a sidecar container:

docker run -d \
  --restart=always \
  --name vaultwarden_backup \
  --volumes-from=vaultwarden \
  --mount type=volume,source=vaultwarden-rclone-data,target=/config/ \
  -e DATA_DIR="/data" \
  ttionya/vaultwarden-backup:latest

Change the defaults before you trust it. ZIP_PASSWORD defaults to a placeholder string. ZIP_TYPE is zip, with 7z available for those who want stronger encryption. BACKUP_KEEP_DAYS is 0, which keeps every file forever. The schedule runs at minute 5 of every hour. The README also documents a restore command that overwrites existing files and requires the container to be stopped.

What this does not protect against

A backup of the data folder protects against a dead disk or a botched upgrade. It does not protect against a lost master password: the wiki says data taken from the vault stays encrypted with keys that require it. A backup stored on the same machine disappears with that machine, and one sent to the cloud in plaintext exposes your admin token and SMTP credentials.

Do not follow this guide if you run MySQL or MariaDB, where the dump step is outside the wiki's scope. It also does not cover the official Bitwarden server, only Vaultwarden.

When you would rather not run a server

Every step above exists because a server holds your vault. A manager with no server removes that work, at the cost of changing tools. VaultKeepR encrypts the vault on your device with XChaCha20-Poly1305, using a key derived with Argon2id, and stores the encrypted vault on IPFS instead of a server you operate. It has not had a third-party security audit, and the core is open source under the MIT licence. For a side-by-side look, see the VaultKeepR and Vaultwarden comparison and Bitwarden vs Vaultwarden. For the model without a server to run, read a self-hosted password manager without running a server.

The VaultKeepR docs have a guide to export your personal vault from Vaultwarden and import it into VaultKeepR. It covers the vault contents only, and states that moving the server itself is out of scope, which is what this article handled.

FAQ

Can I migrate Vaultwarden while the server is running?

You can back up the database from a running server with /vaultwarden backup or sqlite3 .backup. For a move, stop the container first, so the database, attachments and keys all come from the same moment.

Why can't I just copy db.sqlite3 to another machine?

The wiki allows a plain copy only when the database is not in use, and then db.sqlite3 must travel with its db.sqlite3-wal file. Attachments, the rsa_key files and config.json live outside the database and need to travel too.

How do I migrate Vaultwarden from SQLite to PostgreSQL?

Let a new instance create the schema in an empty PostgreSQL database, stop it, disable WAL on the SQLite file, then load the data with pgloader and a data-only load file. The wiki calls the procedure unsupported, so back up first.

Will moving Vaultwarden log out my devices?

The wiki says the rsa_key files sign the tokens of logged-in users, and that deleting them logs everyone out. Copy them with the rest of the folder and keep the same DOMAIN.

How do I fix permission errors after moving the data folder?

The official image runs as root by default, so root must be able to read and write the folder. If you run the container as another user, the folder must belong to that user's ID inside the container, for example 65534 for nobody.

Sources

FAQ

Can I migrate Vaultwarden while the server is running?
You can back up the database from a running server with the built-in /vaultwarden backup command or sqlite3 .backup. For a move, stop the container first, so the database, attachments and keys all come from the same moment.

Direct link to this question

Why can't I just copy db.sqlite3 to another machine?
The Vaultwarden wiki allows a plain copy only when the database is not in use, and then you must copy db.sqlite3 together with its db.sqlite3-wal file. Attachments, the rsa_key files and config.json live outside the database and need to travel too.

Direct link to this question

How do I migrate Vaultwarden from SQLite to PostgreSQL?
Let a new Vaultwarden instance create the schema in an empty PostgreSQL database, stop it, disable WAL on the SQLite file, then load the data with pgloader and a data-only load file. The wiki calls this procedure unsupported and lightly tested, so back up first.

Direct link to this question

Will moving Vaultwarden log out my devices?
The wiki says the rsa_key files sign the tokens of logged-in users, and that deleting them logs everyone out. Copying them with the rest of the data folder is therefore the safe default. Keep the same DOMAIN as well.

Direct link to this question

How do I fix permission errors after moving the data folder?
The official image runs as root by default, so the data folder must be readable and writable by root. If you run the container as another user, the folder must belong to that user's ID inside the container, for example 65534 for nobody.

Direct link to this question

Keep reading

2026-11-23 · 7 min read

Export Keeper Passwords: CSV, JSON & KDBX

Steps to export a Keeper vault from the Web Vault, Desktop app or Commander CLI, what each format keeps, and what to do when your admin blocks Export.

2026-11-16 · 7 min read

Browser password manager or a dedicated app?

Chrome and Safari keep your logins in your browser account. A dedicated app changes who holds the key. Here is what each choice means for your passwords.