Setting up a BTRFS and rsync backup server

Who is this for?

This is for people who came across the following issues with current backup solutions:

  • You have multiple computers, but you want to sync all backups onto one of them.
  • You want the benefits of rsnapshot – daily, weekly, and monthly snapshots.
  • You want the efficient COW (copy-on-write) benefits of BTRFS.
  • You want to back all of this up onto a single, designated backup disk.

Syncing from remote nodes to the server.

On the client, nothing complicated is really happening. Just a simple cron job is syncing down to the server using rsync.

For this to work, you will need to add your client public key to the authorized_keys on the server, and install rsync on both the client and server.

Here is a little script I wrote to handle things nicely:

I recommend placing this in “/usr/local/bin/” and giving it the permissions “700” for root only.

In my root crontab, I have this script set to run every hour at ??:30. On the server, we will be snapshotting everything at ??:00, so this prevents any possible conflicts.

Setting up the server.

If you haven’t already guessed, you should have a BTRFS formatted drive connected to your backup server and mounted (possibly at /mnt/backup).

Normally with rsnapshot, everything is synced into a .sync directory. BUT. With this solution, we create .sync as a BTRFS subvolume:

You will need a few hacky scripts to trick rsnapshot into creating new subvolumes instead of directories as well. Place these in /usr/local/bin:



Now in /etc/rsnapshot.conf, you will want to set the following params:

As well of this, you will of course want to configure the interval options.

Here are mine:

Now you just configure your rsnapshot backup directories. Here is my config:

Last but not least, we add some crontab entries to snapshot ALL THE THINGS:

Now you have a nice backup system, and don’t have to worry about losing files whenever you throw your laptop out the window!


I would like to thank Walter Werther who wrote an article that I ripped some techniques out of.