borgbase / vorta

Desktop Backup Client for Borg Backup
https://vorta.borgbase.com
GNU General Public License v3.0
1.98k stars 130 forks source link

Feature Request: Add Support for BTRFS Snapshots #688

Closed ei8ht187 closed 3 years ago

ei8ht187 commented 3 years ago

I'm using OpenSUSE and therefore BTRFS with Snapper. Therefore it would be nice to have an integration for snapper and btrfs snapshots in Vorta. Idea: When Backup starts, Vorta creates a Snapshot of the Filesystem via either snapper or direct btrfs command. After the snapshot is created, Vorta creates the backup automatically from this snapshot.

Hofer-Julian commented 3 years ago

Hi! Thanks for your feature request. Unfortunately, this is out of Vorta's scope. I see there is https://github.com/ricardomv/snapper-gui. Unfortunately it hasn't seen much activity in the past two years.

mischaelschill commented 3 years ago

Maybe this helps: what you want to do can be done with custom shell commands. I do something similar for my vm backups, although I run borgmatic for backing up and vorta only for viewing:

#!/bin/bash
for dir in `find /var/lib/libvirt/images/ -mindepth 1 -maxdepth 1 -type d`
do
    vm=`basename "$dir"`
    pushd "$dir"
    snap=`ls .snapshots | sort -n | tail -n1`
    path=".snapshots/$snap/snapshot"
    backuppath="/var/lib/libvirt/backup/$vm"
    echo mounting $path to $backuppath
    mount -o bind "$path" "$backuppath"
    popd
done

borgmatic --create | logger -t borg

umount -q /var/lib/libvirt/backup/*

This script finds the latest snapshot and bind-mounts them to another path. I ignored the images path so that borg does not backup images of currently running vms. I see no reason why this couldn't be turned into two shell scripts for pre/post in vorta, although you may need to setuid them.

mauromol commented 3 years ago

I was going to open a feature request just like this, to support btrfs snapshots and LVM snapshots, when available.

It's really sad to know it's out of Vorta's scope: I think source consistency is a really important aspect in a backup application, too often underestimated. Also, I think that conceptually this is as simple as creating snapshots of source folders before running borg create, properly adapt exclusion rules to the new source locations, run borg create on the snapshot mount points and finally unmount the snapshots at the end.

I really hope you can reconsider. IMHO, it would be an excellent and valuable "plus" feature for Vorta.

Hofer-Julian commented 3 years ago

I still think that this shouldn't be part of Vorta, but I am curious what this would help you. Why don't you backup the folders you want directly, instead of creating a snapshot beforehand. The result should be the same.

mauromol commented 3 years ago

I won't be the same unless no write activity is in progress on those files. If borg could back it up instantly, then yes, it would be the same. But if it takes, say, 5 minutes to terminate the job (start on t0, end on t1) and files are changed between t0 and t1, the final archive will neither reflect the state of your source at t0, nor possibly the state at t1. Please see: https://borgbackup.readthedocs.io/en/stable/quickstart.html#important-note-about-files-changing-during-the-backup-process There, LVM and ZFS are mentioned. BTRFS of course is another file system which supports snapshotting like ZFS.

Hofer-Julian commented 3 years ago

Okay, that is indeed a valid point