Backups Via Dirvish

Dirvish is an easy to use backup system based on rsync. Having recently setup an external encrypted usb drive to store backups, mounted at /mnt/backup1, I setup backups for target directories on my local system using Dirvish (of course, if it were not in early development, I would use Snap but alas its too early to trust critical system operations to it). The entire process is fairly easy, there being two files which you need to modify, as well as creating a cron job to run dirvish daily. I’ll keep it brief and simple here, use this great guide if you want more info. Before we begin, recognize a ‘bank’ is a directory where multiple vaults are stored. A ‘vault’ holds the configuration and the actual snapshots of the filesystem(s).
<!–break–>
Install Dirvish and Configure
Use your package management system or build dirvish yourself. After which modify /etc/dirvish/master.conf (or alternatively /etc/dirvish.conf) to contain the following directives:

tree - specifies the root directory to start traversing down from (there can only be one)

exclude - specifies any specific files to be included / excluded. See the ‘Filter Rules’ and ‘Exclude’ section of the rsync man page for alot more detailed info. Be careful with subdirectories here, due to how rsync works.

Initialize Vault
Any new vaults need to be initialized with the first snapshot before dirvish-runall can be invoked. This can be simply done by running the ‘dirvish’ command.

/usr/bin/dirvish --init --vault myvault

After this you should have your first snapshot in ‘/mnt/backup1/snapshot/myvault/yyyymmdd-hhmm’. Run ‘/usr/bin/dirvish-runall’ any time after this to create a new incremental snapshot, or create on or more cronjobs for it. If setting up regular backups, its advisable to run the ‘/usr/bin/dirvish-expire’ command right before ‘/usr/bin/dirvish-runall’ to clean up expired snapshots and to ensure a backup job is not currently in operation.