diff --git a/hosts/yodaHedgehog/btrbk-config.nix b/hosts/yodaHedgehog/btrbk-config.nix new file mode 100644 index 0000000..d3c6541 --- /dev/null +++ b/hosts/yodaHedgehog/btrbk-config.nix @@ -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; + } + ]; +} diff --git a/hosts/yodaHedgehog/configuration.nix b/hosts/yodaHedgehog/configuration.nix index d0880ab..051bf1e 100644 --- a/hosts/yodaHedgehog/configuration.nix +++ b/hosts/yodaHedgehog/configuration.nix @@ -18,8 +18,8 @@ ../../modules/sendmail-mta.nix ../../modules/journalwatch.nix - # TODO - #../../modules/btrbk + ../../modules/btrbk + ./btrbk-config.nix ../../modules/de-p1st-monitor.nix #../../modules/spin-down.nix diff --git a/modules/btrbk/README.md b/modules/btrbk/README.md index ff77e29..f6713be 100644 --- a/modules/btrbk/README.md +++ b/modules/btrbk/README.md @@ -246,7 +246,7 @@ Another remote backup server periodically pulls snapshots to create remote backu cat > ~/btrbk.cfg <<'EOF' timestamp_format long stream_compress lz4 -ssh_identity /mnt/backup/rootnas_ed25519 +ssh_identity /mnt/backup/rootNas_ed25519 # Create backups. target_preserve_min no @@ -255,11 +255,11 @@ target_preserve 7d 4w 6m # Hourly backups -> @hourly cron entry #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_create no -volume ssh://rootnas/jc-data +volume ssh://rootNas/jc-data snapshot_dir /snap target /mnt/backup/snap subvolume arch.p1st.de @@ -274,7 +274,7 @@ volume ssh://rootnas/jc-data subvolume proxy subvolume recipe.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 target /mnt/backup/snap2 subvolume cloud.privacy1st.de diff --git a/modules/btrbk/backup.nix b/modules/btrbk/backup.nix index 1c4f026..c06d63c 100644 --- a/modules/btrbk/backup.nix +++ b/modules/btrbk/backup.nix @@ -16,6 +16,8 @@ in # Optional. # If this is `true` and `volume` starts with `ssh://`, `lz4` transport compression is enabled. lz4 = true; + # Optional. + #ssh_identity = /root/.ssh/rootNas_ed25519; instance = "local-backup-ssd"; volume = "/jc-data"; snapshot_dir = "/snap"; @@ -50,6 +52,7 @@ in settings = { timestamp_format = "long"; stream_compress = mkIf ((x.lz4 or false) && strings.hasPrefix "ssh://" x.volume) "lz4"; + ssh_identity = mkIf (x?ssh_identity) x.ssh_identity; # Create backups. target_preserve_min = daily.preserve-min;