Reduce snapshot and backup numbers

This commit is contained in:
Wojciech Kozlowski 2022-11-10 00:13:15 +01:00
parent 522d93c71e
commit e9498669e8
3 changed files with 32 additions and 10 deletions

View File

@ -1,7 +1,7 @@
[template_home]
hourly = 0
[template_production]
# Template for system datasets that are not being backed up anywhere. Snapshots are used to provide
# option for rollback without having to reinstall entire system. If the hardware crashes or becomes
# corrupt reinstalling might be smarter given the fact that hardware will likely be different.
[template_system]
frequently = 0
hourly = 36
daily = 30
@ -10,12 +10,34 @@
autosnap = yes
autoprune = yes
# Template for home directories which will use the system template, but they don't change so fast.
[template_home]
hourly = 0
# Template for datasets with production data. Unlike system datasets, production datasets are
# expected to be backed up, both to spare local storage as well as a remote location. Therefore,
# snapshots only serve the purpose of providing snapshots for these backups. Otherwise, don't keep
# snapshots as they will just take up space. Applications that need their data versioned will be
# versioning themselves so they only need backups.
[template_production]
frequently = 0
hourly = 2
daily = 2
monthly = 0
yearly = 0
autosnap = yes
autoprune = yes
# Template for backup datasets which also doubles as a hot spare. The assumption is that these
# backup production datasets. In addition to three months of snapshots, keep 36 hourly snapshots for
# quick rollback in case of trouble. No monthly snapshots are kept as that would require the
# production template to produce them.
[template_backup]
autoprune = yes
frequently = 0
hourly = 30
hourly = 36
daily = 90
monthly = 12
monthly = 0
yearly = 0
### don't take new snapshots - snapshots on backup

View File

@ -58,7 +58,7 @@ if __name__ == "__main__":
subprocess.run(f"{restic_cmd_base} snapshots || {restic_cmd_base} init",
shell=True, check=True)
subprocess.run(f"{restic_cmd_base} backup .", shell=True, cwd=backup_path, check=True)
subprocess.run(f"{restic_cmd_base} forget --prune --keep-daily 90 --keep-monthly 12",
subprocess.run(f"{restic_cmd_base} forget --prune --keep-daily 30 --keep-monthly 3",
shell=True, check=True)
subprocess.run(f"{restic_cmd_base} check", shell=True, check=True)

View File

@ -7,17 +7,17 @@
marker: "# {mark} ANSIBLE MANAGED BLOCK SYSTEM #"
block: |
[bpool/BOOT]
use_template = production
use_template = system
recursive = yes
process_children_only = yes
[rpool/ROOT]
use_template = production
use_template = system
recursive = yes
process_children_only = yes
[rpool/home]
use_template = production,home
use_template = system,home
recursive = yes
process_children_only = yes