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