Make an off server backup of self-hosted data

I’ve done my best to follow the info in “Backup hosted data” and I have made a complete backup of the entire ./bwdata directory.

The problem is this backup lives on the same server as Bitwarden is running on.

I’m completely new to how Docker and containers work. I’ve never done anything with them before.

I would like to make a backup to a share that is on another drive so I will have a backup should the host VM die or crash completely.

If my backup is just in another directory and something bad happens I won’t really have a backup.

If I understand this correctly: " The backup directory in the container is volume-mapped from the host directory. ./bwdata/mssql/backups on the host machine maps to etc/bitwarden/mssql/backups in the container." The file I want to backup is in the “./bwdata/mssql/backups” directory?

Thanks in advance.

I would backup your entire ./bwdata directory.
As the mssql backup is just the automatic daily backup of your mssql database.
This would be beneficial in the event of a restore, but you will want several other files such as attachments, etc. Which are not stored in the database.

Something simple like rsync is a good option that should work.

1 Like

Thanks Kent. This is exactly what I’m trying to do.

Where I’m failing is mapping a drive or share.

I have a shared folder that I routinely map to my servers and VM’s but I can’t seem to get the command right to get this share mapped to the the VM that’s running the Bitwarden docker.

I’m making progress if you would call it that.

I read a thread on Stack Overflow that suggested “Docker is preventing you from mounting a remote volume inside the container as a security measure.”

It was suggested later in the same thread that a share could in fact be mapped by using the following command:

mount -t cifs /// / -o user=,password=

When I used this command the results were a bit devastating. It stopped one of the docker containers so running docker ps only provided a list of switches and options that work with the command.

In addition to that, sudo reboot -h now would perform a reboot but then the login and password wouldn’t work anymore. It was necessary to log into the hypervisor and “reset” the VM.

Then I had to log into the VM and manually restart bitwarden with the command ./ restart.

It seems trying to map a share is pretty dangerous.

I’m at a loss now how I’m supposed to get a copy of the bwdata directory at this point.

Yikes, yeah I wouldn’t mess with too much of the underlying docker stuff with the standard installer as I’m not sure how well it handles unsupported changes like this.
Ofc with docker you can probably “force” something to work but the software may not be expecting this.
You may find better success if you’d like to tinker with the Bitwarden Unified beta product.

  • Otherwise I would simply allow Bitwarden to make its standard nightly mssql backup
  • Mount your share to your machine and persist
  • Use any type of backup utility of your choice, such as Veeam, rsync, etc.
    • Backup the entire /bwdata directory as directed in the help article, or of particular note

Particularly important pieces of ./bwdata to backup regularly include:

  • ./bwdata/env - Instance’s environment variables, including database and certificate passwords.
  • ./bwdata/core/attachments - Instance’s vault item attachments.
  • ./bwdata/mssql/data - Instance’s database data.Bitwarden will automatically take nightly backups of the mssql database container, when running.
  • You can optionally chose to run another mssql backup immediately prior to your backup kicking off if the nightly backup may be too far outside of your backup window
  • Simply automate this to run on schedule with something like a cron job, you could also use this to notify you when the remote backup has been ran.

Hope these tips help you get it figured out :slightly_smiling_face:

As far as I’m aware I’m not messing with the actual docker containers but I’m trying to map a share on the Ubuntu VM itself.

This is what seems to be wreaking havoc with docker. I’ve tried it twice and it’s done what I described both times.

I’m happy to let Bitwarden make its own nightly backups. My issue is I would like to get some sort of backup somewhere else other than within this VM. If it crashes or becomes completely unusable for some reason and I can’t get to the data these nightly backups are going to be of little use.

That’s why I want to get ./bwdata backed up to another location. Once I get everything right I can configure a cron job to do that same backup regularly.