Backup bitwarden_rs data on Synology

In the last post, I wrote about installing bitwarden_rs per Docker on Synology and how to activate live sync. Now I’ll show you how to backup the data. I’ll use bruceforce/bw_backup docker to dump the sqlite database automatically, since just copying the sqlite3 file is not really backing up the database. I also found out, that the created dump file won’t be automatically uploaded to cloud by the Cloud Sync. Some how Cloud Sync doesn’t notice that there’s a new file.

Setting up backup container

In the Docker app, let’s search for bruceforce/bw_backup container. Just search for bw_backup.

bruceforce/bw_backup image
bruceforce/bw_backup Image

After downloading the image, we’ll just run it. During the initialisation, we need to adjust some settings.

In the volume tab, we mount the bitwarden folder, in which the bitwarden files are stored. My Bitwarden data are saved in docker/bitwardenrs. This folder must be mount as /data.

Mount bitwarden folder as /data
Mount Bitwarden folder

In the environment tab, we need to adjust the UID and GID. I set them to 0 (root).
Crontime can be set to how often the Bitwarden data should be backed up. If you don’t familiar with crontab format, you can use crontab.guru to check the time.

Environment of backup container
Environment of the backup container

A useful parameter is DELETE_AFTER. I set this parameter to 7, so older than 7 backup files will be removed automatically. The complete documentation on the image can be found on the Github page.

Backup to cloud storage

When the backup script in the container is finished, you’ll find the dump file in the db_backup folder. Adding this folder to a Cloud Sync task to automatically upload the file to a cloud provider (Google Drive, Dropbox, etc.) won’t work. Somehow Cloud Sync ignores the files.

Backup folder
Backup folder

The only way to upload the files to a cloud storage per Cloud Sync is to manually copy them. After manual copying the files, Cloud Sync notices the files and sync these with cloud storage. To automate the copying process, we set a “User-defined script” task in Task Scheduler to copy the files.

As script/command I just simply run a rsync to sync the bitwarden folder to a cloud storage folder in Synology.

User-defined script as task to copy the dump files
User-defined script as task to copy the dump files

2 thoughts on “Backup bitwarden_rs data on Synology”

  1. Thank you for these instructions. I have one question.
    I have everything setup and tried the backup every 5 minutes (*/5 * * * *).

    However, it does not backup. I let it sit overnight and this morning, only 1 backup in the db_backup folder and it was from 0100 hours.
    I have timestamp = true and # of backups set to 10. Any idea on why it will not backup? Thank you again.

Leave a Reply

Your email address will not be published. Required fields are marked *