Offline backup

This commit is contained in:
Sicheng Pan 2025-08-09 13:05:23 -05:00
parent 7958f6e23a
commit e938eb26a8
Signed by: macronova
GPG key ID: CE969670FB4B4A56

View file

@ -29,36 +29,31 @@
];
};
jobs = let
listener_name = "archive";
in [
{
archiveBaseName = "archive";
backupBaseName = "backup";
pushConfig = name: grid: {
type = "push";
name = "snapshot";
name = "push-${name}";
connect = {
inherit listener_name;
type = "local";
listener_name = "${name}-listener";
client_identity = config.networking.hostName;
};
filesystems."zactive/main/home" = true;
send.encrypted = true;
snapshotting = {
type = "periodic";
prefix = "zrepl-";
interval = "1h";
};
snapshotting.type = "manual";
pruning = {
keep_sender = [
{
type = "grid";
type = "regex";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "24x1h" "7x1d" "4x1w"];
}
];
keep_receiver = [
{
type = "grid";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "30x1d" "52x1w"];
grid = lib.concatStringsSep " | " grid;
}
];
};
@ -66,17 +61,41 @@
initial = "guarantee_resumability";
incremental = "guarantee_incremental";
};
}
{
};
sinkConfig = name: dataset: {
type = "sink";
name = "archive";
name = "sink-${name}";
serve = {
inherit listener_name;
type = "local";
listener_name = "${name}-listener";
};
root_fs = "zarchive/snapshot";
root_fs = dataset;
recv.placeholder.encryption = "off";
};
in [
{
type = "snap";
name = "snapshot";
filesystems."zactive/main/home" = true;
snapshotting = {
type = "periodic";
prefix = "zrepl-";
interval = "1h";
};
pruning = {
keep = [
{
type = "grid";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "24x1h" "7x1d" "4x1w"];
}
];
};
}
(pushConfig archiveBaseName ["1x1h(keep=all)" "30x1d" "52x1w"])
(pushConfig backupBaseName ["8x13w"])
(sinkConfig archiveBaseName "zarchive/snapshot")
(sinkConfig backupBaseName "zbackup/snapshot")
];
};
};