KenKundert / emborg

Interactive command line interface to Borg Backup
GNU General Public License v3.0
94 stars 8 forks source link

Feature request: a configuration lint command #30

Closed coridonhenshaw closed 4 years ago

coridonhenshaw commented 4 years ago

It would be nice to have a command to check an Emborg configuration for gross errors that are hard to detect without watching a backup (with -v) while it is running. Detecting cases where the src_dirs are empty (could indicate an unmounted source), where exclusions can't match any path specified in the src_dirs, or where exclusions exclude every file, and so forth, would reduce the risk of mistakes leading to unusable backups or wasted storage space.

KenKundert commented 4 years ago

Emborg provides a number of ways to check your setup.

  1. You can use 'emborg settings' to see the values used by Emborg for all the settings.
  2. You can also use 'emborg log' to see exactly how borg was invoked.
  3. You can used the --dry-run option to detect things like empty src_dirs or poorly specified excludes: emborg --dry-run create --list
  4. The new version of Emborg (1.14.4) now allows you to sort the output of the manifest command by size, so you can see if there are large files that you should be excluding.

Finally, the latest version adds support for Borg patterns, and there are a lot of subtle assumptions on how the patterns should be written, and carelessness or confusion on the part of the user could result in either under or over excluding. So the new version of Emborg is much more careful about checking the roots (src_dirs), the includes, and the excludes.

I am hesitant to do more as it would require me to duplicate a lot of borg code. I think --dry-run covers a lot of what you want. Perhaps what I need to do is to add a section in the documentation about how to confirm your initial setup.

coridonhenshaw commented 4 years ago

It seems like --dry-run is mostly what I'm looking for. Thanks.

Being able to verify that exclusions work as expected is extremely important in complex (or low backup target disk space) environments because Borg offers no way to selectively delete files from archives. In my case I have several TB of data on permanently mounted Samba shares that only one emborg configuration is supposed to back up. If the excludes fail and that data is backed up by multiple configurations, I'll waste multiple TB on my backup targets with no way to recover that space without deleting the offending Borg repo(s) completely.