nullbox: don't use privatemounts for backup
Mount namespaces aren't shared by processes, even within the same unit. See systemd.exec(5).
This commit is contained in:
parent
48659b6f64
commit
bd5fe47749
@ -11,8 +11,6 @@ in
|
|||||||
|
|
||||||
systemd.services.restic-backups-system = {
|
systemd.services.restic-backups-system = {
|
||||||
path = with pkgs; [ btrfs-progs ];
|
path = with pkgs; [ btrfs-progs ];
|
||||||
# ensures mounts are isolated to only this service
|
|
||||||
serviceConfig.PrivateMounts = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services.restic.backups.system = {
|
services.restic.backups.system = {
|
||||||
@ -20,20 +18,15 @@ in
|
|||||||
# create an atomic backup
|
# create an atomic backup
|
||||||
backupPrepareCommand = ''
|
backupPrepareCommand = ''
|
||||||
set -Eeuxo pipefail
|
set -Eeuxo pipefail
|
||||||
mkdir -p /tmp/btrfs_root
|
|
||||||
mount -t btrfs -o subvol=/ ${escapeShellArg fs.device} /tmp/btrfs_root
|
|
||||||
|
|
||||||
if btrfs subvol delete /tmp/btrfs_root/@restic-snapshot-mcserver; then
|
if btrfs subvol delete /srv/mcserver/@restic; then
|
||||||
echo "Old restic snapshot deleted.";
|
echo "Old restic snapshot deleted.";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
btrfs subvol snapshot -r /srv/mcserver /tmp/btrfs_root/@restic-snapshot-mcserver
|
btrfs subvol snapshot -r /srv/mcserver /srv/mcserver/@restic
|
||||||
|
|
||||||
umount /srv/mcserver
|
|
||||||
mount -t btrfs -o subvol=/@restic-snapshot-mcserver ${escapeShellArg fs.device} /srv/mcserver
|
|
||||||
'';
|
'';
|
||||||
backupCleanupCommand = ''
|
backupCleanupCommand = ''
|
||||||
btrfs subvolume delete /tmp/btrfs_root/@restic-snapshot-mcserver
|
btrfs subvolume delete /srv/mcserver/@restic
|
||||||
'';
|
'';
|
||||||
|
|
||||||
rcloneConfigFile = secret "restic-rclone";
|
rcloneConfigFile = secret "restic-rclone";
|
||||||
@ -43,7 +36,7 @@ in
|
|||||||
".snapshots"
|
".snapshots"
|
||||||
];
|
];
|
||||||
paths = [
|
paths = [
|
||||||
"/srv/mcserver"
|
"/srv/mcserver/@restic"
|
||||||
];
|
];
|
||||||
dynamicFilesFrom = ''
|
dynamicFilesFrom = ''
|
||||||
echo
|
echo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user