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:

bank:
       /mnt/backup1/snapshot

image-default: %Y%m%d-%H%M
log: gzip
index: gzip
xdev: 0

Runall:
      myvault

expire-default: +6 months

image-perm: 700 
meta-perm: 600

Setup Vaults All vaults need a ‘dirvish/’ subdirectory w/ a ‘default.conf’ configuration file. Thus in ‘/mnt/backup1/snapshot/myvault/dirvish/default.conf’ write:

client: localhost
tree: /
xdev: 0
exclude: 
   + /etc
   + /home
   + /mnt
   + /mnt/thumb
   /mnt/*
   /*  

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.