Skip to content

Backup and Recovery

Scope: what "the data folder" really contains, the two ways to back it up (the server's own command and a folder copy — both proven), a restore rehearsed in the lab, and the losses that backups cannot fix, named before they happen.

The whole vault is a folder

Stop the lab server and list its world (t19):

$ find the data folder
db.sqlite3
db.sqlite3-shm
db.sqlite3-wal
rsa_key.pem

$ du -sh
316K

Four entries, a third of a megabyte, for two accounts, an organisation, and the beginnings of a household. Know them:

  • db.sqlite3 — the database: accounts, sealed items, organisations, collections, invitations, settings. The -wal and -shm files beside it are its working papers (write-ahead log); a running server's truth is in the set of three.
  • rsa_key.pem — the server's signing key, created at first start (t04). Login tokens are signed with it. Lose it and every client's session is invalidated at once — annoying, not fatal; lose it and the database and there is nothing left to discuss.

On a busier server the folder also grows: attachments/ (files attached to items, stored sealed but separate), sends/ (Bitwarden Send payloads), icon_cache/ (website favicons, pure cache), and config.json if the admin page's settings were ever saved (chapter 5). Those four never appeared in the lab — nothing attached anything, and the admin changed no settings — and they are the reason "back up the database" is not the whole instruction.

Two ways, one rehearsed restore

The built-in way. The binary has a backup command whose entire job is a consistent snapshot of the database, safe to take while the server runs — the same thing the admin page's backup button does, and what a USR1 signal to the process triggers. The lab ran it (t19):

$ vaultwarden backup
Backup to 'LAB/data/db_20261022_024751.sqlite3' was successful

A timestamped copy lands in the data folder, in the database's own format, with no torn pages from a copy made mid-write. This is the right answer to "the database, nightly."

The whole-folder way. Stop the server (or take the snapshot above), then copy the entire data folder. examples/backup.sh does both layers in order — built-in snapshot first, then a dated folder copy, keeping two weeks of them — because the restore you actually perform is of a server, not of a database: key, attachments, config and all.

The restore, rehearsed. The lab copied its data folder to a new home, started the same binary on the copy at a different port, and asked the questions that matter (t20): Maren logged in, and her cipher read back with its organisation intact. Nothing was converted, imported, or repaired — the folder simply was the server, in a new place. Do this once for your own server before you need it. The rehearsal, not the backup, is what makes it a recovery plan.

The losses backups don't fix

  • A forgotten master password. The vault in the backup is sealed with the same key as the live one. No restore opens it. (An organisation is the one partial exception in the ecosystem: an owner who still has access can re-share organisation items to a member's new account. Private-vault items have no such path.)
  • A backup kept only on the same machine. The folder copy defends against a corrupt database and a bad update. Against a dead disk or a house fire it defends against nothing; the dated copy needs to leave — another machine, an external drive, an encrypted corner of somebody's cloud. The vault inside is sealed, so the copy is safe to store in places you would not put an open folder of passwords.
  • A backup never restored. Covered above, because it is the common one.

And the update-shaped special case: before any upgrade (chapter 8), take the snapshot. An update that goes wrong is just a restore with a story.