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

Better exclude options #515

Closed x80486 closed 4 years ago

x80486 commented 4 years ago

Is your feature request related to a problem? Please describe.

I recently started using Vorta (and Borg); it's great, but I don't find the exclude patterns business very friendly or intuitive — compared to other applications I've used that employ "similar approaches".

For instance, if I add my home folder as part of the source files/folders to backup, let's say: /home/x80486, and then use these patterns:

**/.gradle
**/.terraform

...Vorta (or Borg) will scan, recursively, every single subdirectory (starting from /home/x80486) and exclude everything that looks like .gradle and .terraform. The issue is, I just want to exclude those two at the /home/x80486 level, but not at any other depth/level.

Probably it's just me that I don't know how to express the correct pattern for that, but I can't find how to do such thing in the Borg/Vorta documentation.

Also, using:

.gradle
.terraform

...doesn't do anything, which is what I would expect to work because I'm giving the root path to start scanning from already.

Describe the solution you'd like

To be able to accept relative and absolute paths accordingly to the input in the sources. For instance, if I provide /home/x80486 as source, and the following list as patterns:

**/.idea
**/node_modules
.gradle
.terraform

...I would expect Vorta to backup everything inside /home/x80486 except:

Describe alternatives you've considered

None :rofl:

ghost commented 4 years ago

Could you add .nobackup to Exclude if Present, and put .nobackup in .gradle and .terraform?

x80486 commented 4 years ago

Indeed, I explored that also, but turns out a good amount of the subdirectories I have in the exclusion list are wiped out and recreated with some frequency, so I would have to come back and copy again the .nobackup file on all of them.

What I put is just a very small amount of folder/files that I'm excluding.

ghost commented 4 years ago

Try making .nobackup undeletable (chattr +i .nobackup)

ghost commented 4 years ago

Found this https://manpages.debian.org/testing/borgbackup/borg-patterns.1.en.html. Path prefix and path full-match might be useful

ThomasWaldmann commented 4 years ago

@x80486 isn't that what you need?:

/home/x80486/**/.idea
/home/x80486/**/node_modules
/home/x80486/.gradle
/home/x80486/.terraform

Untested, please carefully try yourself.

x80486 commented 4 years ago

Indeed, but what I was saying was that since we already provided the source path, there shouldn't be a need to specify it again on every exclude entry because it should be inferred, right? Although reading through Borg I can see that it should be done in such way.

In any case, what you wrote there (augmented) works for me :partying_face: :trophy: :tropical_drink:

/home/x80486/.asdf
/home/x80486/.cache
/home/x80486/.gradle
/home/x80486/.gradle-kotlin-dsl
/home/x80486/.java
/home/x80486/.local/share/Trash
/home/x80486/.m2
/home/x80486/.nix-defexpr
/home/x80486/.nix-profile
/home/x80486/.swt
/home/x80486/.terraform.d
/home/x80486/.var
/home/x80486/.vgrive
/home/x80486/.bash_history
/home/x80486/.esd_auth
/home/x80486/.ICEauthority
/home/x80486/.node_repl_history
/home/x80486/HalfAssAppImages
/home/x80486/Desktop
/home/x80486/Workshop/**/.idea
/home/x80486/Workshop/**/node_modules
/home/x80486/Workshop/**/*.iml
/home/x80486/Workshop/**/*.ipr
ThomasWaldmann commented 4 years ago

There's no relationship between roots and exclude patterns in borg.

And changing that would be a major change of behaviour (although not a total compatibility break), which we could only do when doing a new release, like 1.2 or 1.3.

But there is nobody working on that and it is also not a topic for the vorta issue tracker.

x80486 commented 4 years ago

OK, @ThomasWaldmann, I get your point. I think I'll leave it open but feel free to close if you think it's not an issue or unrelated with Vorta somehow...by the way, before leaving you alone, is there a way to exclude a directory, but include some parts/paths of it at the same time? Something like:

/home/x80486/.local                      # Exclude .local/
!/home/x80486/.local/share/JetBrains     # ...but include what's in .local/share/JetBrains/
ThomasWaldmann commented 4 years ago

borg takes the first matching rule, so more special / strict matches need to come before more general / less strict matches. read the borg help patterns output or the docs on the web.

m3nu commented 4 years ago

Closing, since it's not really related to Vorta.

There is another issue to discuss GUI exclude improvments: #399