digint / digint/btrbk

Question: when btrbk runs multiple times per day, preserve latest of that day only + follow preserve options

Open
#394 2 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
Perl
Stars
2.1k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

btrbk runs nightly, but sometimes I manually run it during the day. When I do that, I do not want to have multiple snapshots & backups:
```
20210531
20210531_1
20210531_2
```

Per day, I only want to keep the latest. But I still want btrbk to follow my retention policies (for example preserve snapshots of the past 6 days, past 3 weeks, past 2 months). Just not keep more than 1 backup _per day_ in the snapshots dir and on the targets, if btrbk runs >1 times on a day, only preserve the latest one of that day.

- I tried with `snapshot_preserve_min` and `target_preserve_min` set to `latest`. But that doesn't seem to do the trick.
- I am a bit afraid to use `snapshot_preserve_min 1d`, I don't want btrbk to destroy all preserved snapshots and backups, only the older ones from today.
- I am also very afraid to us `snapshot_preserve_min no`, because the documentation states
> Defines how many days back daily backups should be preserved. The first backup of a day (starting at preserve_hour_of_day) is considered a daily backup.

That would do the opposite: preserve the first of the day (2021053) instead of the last of the day (20210531_2).

This is what my config looks like. A few default settings are the same for my system backup but I wasn't sure if they would be inherited properly so I just added them in there as well.
```
# Generic settings
# ----------------
lockfile /var/lock/btrbk.lock
transaction_log /home/asterix/docker/HOST/logs/btrbk.log
#stream_buffer 256m

# Default settings & retention policy
# --------------------------------------------------
snapshot_create ondemand
snapshot_dir .timeline
snapshot_preserve_min latest
snapshot_preserve 6d 3w 2m
target_preserve_min latest
target_preserve 20d 10w 12m
archive_preserve_min latest
archive_preserve 20d 10w 18m

# SYSTEM Backup settings with custom settings & retention policy
# --------------------------------------------------------------
volume /mnt/system
group System
snapshot_create ondemand
snapshot_dir timeline
snapshot_preserve_min latest
snapshot_preserve 6d 3w 2m
target_preserve_min latest
target_preserve 14d 6w 3m
target /mnt/disks/backup1/system
target /mnt/disks/backup2/system
subvolume @
subvolume @home
subvolume @docker

# USER Backup config with default retention policy
# ------------------------------------------------
volume /mnt/disks/data1
group Users
subvolume Users
target /mnt/disks/backup1/data1
target /mnt/disks/backup2/data1
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.