Running multiple backup jobs on one host makes ´mount´ only show data from the last

Hi,

I’m currently testing out restic am came by a behaviour that I took for “by design”, but was encourage on Twitter to share here anyways.

I’m using restic-tools to easily backup into a S3 (Minio) Bucket. In addition to the file backup I have setup a local.post job to dump a mysql database utilising the --stdin option.

Repeated backup jobs looked fine, so as a next step I wanted to mount the backup to inspect it. Having mounted I saw the backup set of my host in hosts/hostname and looking at the “latest” I was only able to find the sql dump.

I’ve “worked around” this by now setting an alternate hostname when doing the mysql dump.

Steps to reproduce:

  • download and configure restic-tools
  • do a local backup with backup example local
    ( mount backup and you will find the file backup in the latest folder)
  • run an additional stdin, like mysqldump --defaults-extra-file=/etc/mysql/debian.cnf --single-transaction kopano | backup bunsen backup --stdin --stdin-filename kopano.sql
    ( - mount backup and you will find only the sql file in the latest folder)

Expected behaviour (?):

  • my initial expectation was to find a combined view of both backup just in the latest folder (since the snapshots command knows the original path). But seeing that latest is a symlink to the last run job the current behaviour makes sense as well.

restic 0.8.1

link to restic-tools since I could not include it in the other post: https://github.com/binarybucks/restic-tools

Thanks for sharing your experience! I’d classify this behavior as “works as intended”, the latest symlink is just for convenience. You’ll see that when you run two subsequent restic backup commands of two different directories, the latest symlink will point to the most recently finished run of restic, which may be either directory.

The only way (as for now) to combine the regular backup job and the backup of the mysql DB is to first dump the DB into a file, and then include this file in the restic backup run.

You could also specify --tag mysql for the SQL backup and then look into the directory tags/mysql in the fuse mount, there you’ll find a latest link which points to the latest backup of just the mysql DB. The same is for the regular backup: maybe just use --tag fs or so. This is actually very similar to setting a different host name.

Yes, that makes absolute sense.

The suggestion with the tags sounds nice as well. Will incorporate it into my script.