digint / digint/btrbk

Feature request: Notify on outdated backups

Open
#483 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Perl
Stars
2.1k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

I couldn't find a command or an additional script to "throw an alert" if the latest backups are too old.

```
# sudo -u btrbk btrbk list latest
SOURCE_SUBVOLUME SNAPSHOT_SUBVOLUME STATUS TARGET_SUBVOLUME
/mnt/btrfs/@ /mnt/btrfs/@snapshots/btrbk/root.20220714T1600 - /run/media/user/backup/btrbk-system/laptop/root.20220714T1600
/mnt/btrfs/@var-log /mnt/btrfs/@snapshots/btrbk/var-log.20220714T1600 - /run/media/user/backup/btrbk-system/laptop/var-log.20220714T1600
/mnt/btrfs/@home /mnt/btrfs/@snapshots/btrbk/home.20220714T2000 - /run/media/user/backup/btrbk-system/laptop/home.20220714T2000
```

I use a laptop and an external USB disk to store my snapshots and I would like to get notified if my latest backups are i.e. two weeks old.

Any suggestions how this could be implemented?

* One additional option in the configuration. For example, use ```btrbk list outdated``` to loop through all latest snapshots and print an error message with the snapshot to stderr if too old and exit code is 1.

* Use a dedicated script with the logic described above.

I could then use this to create a dedicated timer and service which is executed every day and sends a warning message if the backups are too old.

However, this only works if ```snapshot_create ondemand``` is used since the target is not available if the USB disk is disconnected. If I use ```snapshot_create always``` then I always have daily/hourly snapshots, but I don't know if they are available on my backup disk.

```
# sudo -u btrbk btrbk list latest
WARNING: Skipping target "/run/media/user/backup/btrbk-system/laptop": Failed to fetch subvolume detail
WARNING: ... Command execution failed (exitcode=1)
WARNING: ... sh: sudo -n readlink -v -e '/run/media/user/backup/btrbk-system/laptop'
WARNING: ... readlink: /run/media/user/backup/btrbk-system/laptop: No such file or directory
WARNING: Skipping target "/run/media/user/backup/btrbk-system/laptop": Failed to fetch subvolume detail
WARNING: Skipping target "/run/media/user/backup/btrbk-system/laptop": Failed to fetch subvolume detail
SOURCE_SUBVOLUME SNAPSHOT_SUBVOLUME STATUS
/mnt/btrfs/@ /mnt/btrfs/@snapshots/btrbk/root.20220714T1600 -
/mnt/btrfs/@var-log /mnt/btrfs/@snapshots/btrbk/var-log.20220714T1600 -
/mnt/btrfs/@home /mnt/btrfs/@snapshots/btrbk/home.20220714T2000 -
```

Maybe some additional info about snapshots send to a target can be stored in a cache directory? Otherwise, I would need to parse the logfile.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the `btrbk list latest` command and the `snapshot_create` configuration behavior described here. Define how an age threshold should report outdated snapshots and how unavailable targets should be handled; done means a command or configuration path returns a failure suitable for a daily timer without requiring logfile parsing.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.