yodaHedgehog: btrbk config

This commit is contained in:
Daniel Langbein 2023-11-18 12:02:52 +01:00
parent 405a6a9981
commit 13b7c922e7
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
4 changed files with 55 additions and 6 deletions

View File

@ -0,0 +1,46 @@
{ config, pkgs, ... }:
let
# TODO: Remove duplicate variables below (reuse from yodaNas config).
ssd-subvolumes = {
"arch.p1st.de" = {};
"blogger.privacy1st.de" = {};
"changedetection.p1st.de" = {};
"cloud.privacy1st.de" = {};
"git.privacy1st.de" = {};
"mastodon-toot-follower.privacy1st.de" = {};
"money.p1st.de" = {};
"music.privacy1st.de" = {};
"paste.p1st.de" = {};
"proxy" = {};
"recipe.privacy1st.de" = {};
"traggo.privacy1st.de" = {};
};
hdd-subvolumes = {
"cloud.privacy1st.de" = {};
# MediaKollektiv: 796 GiB
"cloud.media-kollektiv.eu" = {};
};
in
{
# TODO: Enable lz4 when yodaHedgehog no longer has direct LAN connection.
yoda.btrbkBackups = [
{
instance = "remote-backup-ssd";
lz4 = false;
ssh_identity = "/mnt/backup/rootNas_ed25519";
volume = "ssh://rootnas/jc-data";
snapshot_dir = "/snap";
target = "/mnt/backup/snap";
subvolume = ssd-subvolumes;
}
{
instance = "remote-backup-hdd";
lz4 = false;
ssh_identity = "/mnt/backup/rootNas_ed25519";
volume = "ssh://rootnas/mnt/data/jc-data";
snapshot_dir = "/mnt/data/snap2";
target = "/mnt/backup/snap2";
subvolume = hdd-subvolumes;
}
];
}

View File

@ -18,8 +18,8 @@
../../modules/sendmail-mta.nix ../../modules/sendmail-mta.nix
../../modules/journalwatch.nix ../../modules/journalwatch.nix
# TODO ../../modules/btrbk
#../../modules/btrbk ./btrbk-config.nix
../../modules/de-p1st-monitor.nix ../../modules/de-p1st-monitor.nix
#../../modules/spin-down.nix #../../modules/spin-down.nix

View File

@ -246,7 +246,7 @@ Another remote backup server periodically pulls snapshots to create remote backu
cat > ~/btrbk.cfg <<'EOF' cat > ~/btrbk.cfg <<'EOF'
timestamp_format long timestamp_format long
stream_compress lz4 stream_compress lz4
ssh_identity /mnt/backup/rootnas_ed25519 ssh_identity /mnt/backup/rootNas_ed25519
# Create backups. # Create backups.
target_preserve_min no target_preserve_min no
@ -255,11 +255,11 @@ target_preserve 7d 4w 6m
# Hourly backups -> @hourly cron entry # Hourly backups -> @hourly cron entry
#target_preserve 24h 7d 4w 6m #target_preserve 24h 7d 4w 6m
# Don't create or delete snapshots on remote server "rootnas". # Don't create or delete snapshots on remote server "rootNas".
snapshot_preserve_min all snapshot_preserve_min all
snapshot_create no snapshot_create no
volume ssh://rootnas/jc-data volume ssh://rootNas/jc-data
snapshot_dir /snap snapshot_dir /snap
target /mnt/backup/snap target /mnt/backup/snap
subvolume arch.p1st.de subvolume arch.p1st.de
@ -274,7 +274,7 @@ volume ssh://rootnas/jc-data
subvolume proxy subvolume proxy
subvolume recipe.privacy1st.de subvolume recipe.privacy1st.de
subvolume traggo.privacy1st.de subvolume traggo.privacy1st.de
volume ssh://rootnas/mnt/data/jc-data volume ssh://rootNas/mnt/data/jc-data
snapshot_dir /mnt/data/snap snapshot_dir /mnt/data/snap
target /mnt/backup/snap2 target /mnt/backup/snap2
subvolume cloud.privacy1st.de subvolume cloud.privacy1st.de

View File

@ -16,6 +16,8 @@ in
# Optional. # Optional.
# If this is `true` and `volume` starts with `ssh://`, `lz4` transport compression is enabled. # If this is `true` and `volume` starts with `ssh://`, `lz4` transport compression is enabled.
lz4 = true; lz4 = true;
# Optional.
#ssh_identity = /root/.ssh/rootNas_ed25519;
instance = "local-backup-ssd"; instance = "local-backup-ssd";
volume = "/jc-data"; volume = "/jc-data";
snapshot_dir = "/snap"; snapshot_dir = "/snap";
@ -50,6 +52,7 @@ in
settings = { settings = {
timestamp_format = "long"; timestamp_format = "long";
stream_compress = mkIf ((x.lz4 or false) && strings.hasPrefix "ssh://" x.volume) "lz4"; stream_compress = mkIf ((x.lz4 or false) && strings.hasPrefix "ssh://" x.volume) "lz4";
ssh_identity = mkIf (x?ssh_identity) x.ssh_identity;
# Create backups. # Create backups.
target_preserve_min = daily.preserve-min; target_preserve_min = daily.preserve-min;