[Borgbackup] Archive File Integrity Check Against Local File System

kevin.mccall at yahoo.com kevin.mccall at yahoo.com
Sun Dec 11 19:16:34 EST 2022


 Really great, thank you sincerely for sharing the knowledge. This is helpful.


    On Sunday, December 11, 2022 at 04:58:51 AM EST, Thorsten Schöning <tschoening at am-soft.de> wrote:  
 
 Guten Tag kevin.mccall at yahoo.com,
am Samstag, 10. Dezember 2022 um 14:21 schrieben Sie:

> If I wanted to complete a file verification against the local file
> system how do you recommend doing so with an Borg archive? 

Take the backup based on some snapshot and after the backup itself has
successfully finished, mount the backup again to compare the file tree
of the snapshot and that of the mounted backup archive using some
specialized tools producing some output about some differences.

That output needs to be additionally processed to get the result you
actually want, e.g. error out on any difference at all, error out on
missing files only, error out on files with different checksums or
stuff like that. Things heavily depend on the tools you use to
compare and which output they produce. Best approach most likely is to
error out either on any changes at all or implement some black- or
whitelist to check for special conditions of interest.

As often, we are not the only ones thinking of these kinds of problems
and I found some interesting suggestions for the necessary compare
tools:

> rsync --dry-run --recursive --delete --links --checksum --verbose /dir1/ /dir2/ > dirdiff_2.txt
> diff --brief --recursive --no-dereference --new-file --no-ignore-file-name-case /dir1 /dir2 > dirdiff_1.txt

https://stackoverflow.com/a/40986505/2055163

"borg mount" makes the archive easily available without copying things
unnecessarily, e.g. your used compare tool might recognize chanbges in
file sizes already, in which case it wouldn't need to read the entire
files at all. That most likely wouldn't be possible with your former
TAR-approach.

https://borgbackup.readthedocs.io/en/stable/usage/mount.html
https://borgbackup.readthedocs.io/en/stable/usage/mount.html#borg-umount

Last but not least, I'll strongly suggest to use BORGMATIC to
implement your approaches. It supports a mostly configuration driven
approach allowing to put your configs and stuff into GIT/SVN/... AND
supports hooks on various events. I use that mechanism to create
snapshots BEFORE backups and delete them and send summary mails AFTER
each backup. The AFTER hook would be the place to compare things
before cleaning the snapshots up. The following is how I call things,
while you need to implement the actual scripts on your own of course:

> hooks:
>    before_backup:
>        - >
>          '/usr/local/am_soft_it/libs_bin/backup/bgm_hooks/before_backup/local_zfs_datasets.sh'
>          'bts.ams'
>          'root'
>          'rpool/ROOT/pve-1' 'rpool/data/encr/home'
>    after_backup:
>        - >
>          '/usr/local/am_soft_it/libs_bin/backup/bgm_hooks/after_backup/local_zfs_datasets.sh'
>          'bts.ams'
>          'root'
>          'rpool/ROOT/pve-1' 'rpool/data/encr/home'
>    on_error:
>        - |
>          export BGM_ERR_VAR_CONFIG_PATH="{configuration_filename}"
>          export BGM_ERR_VAR_REPO="{repository}"
>          export BGM_ERR_VAR_ERROR_MSG="{error}"
>          export BGM_ERR_VAR_ERROR_OUT="$(cat << 'EOT'
>          {output}
>          EOT
>          )"
> 
>          '/usr/local/am_soft_it/libs_bin/backup/bgm_hooks/on_error/local_zfs_datasets.sh' 'bts.ams' 'root' 'rpool/ROOT/pve-1' 'rpool/data/encr/home'

https://torsion.org/borgmatic/docs/how-to/add-preparation-and-cleanup-steps-to-backups/
https://torsion.org/borgmatic/

The author of that tool was VERY helpful and open for suggestions and
discussions and stuff in the past to me. And I asked for somewhat
weird stuff already. ;-)

Mit freundlichen Grüßen

Thorsten Schöning

-- 
AM-SoFT IT-Service - Bitstore Hameln GmbH
Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister für IT und TK

E-Mail: Thorsten.Schoening at AM-SoFT.de
Web:    http://www.AM-SoFT.de/

Tel:  +49 5151-  9468- 0
Tel:  +49 5151-  9468-55
Mobil: +49  178-8 9468-04

AM-SoFT IT-Service - Bitstore Hameln GmbH, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 221853 - Geschäftsführer: Janine Galonska




_______________________________________________
Borgbackup mailing list
Borgbackup at python.org
https://mail.python.org/mailman/listinfo/borgbackup
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/borgbackup/attachments/20221212/81e42c02/attachment.html>


More information about the Borgbackup mailing list