bundles/zfs: introduce zfs-snapshot-backups, enable backups for nodes which need zfs-snapshot-backups
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
93e36156a0
commit
479b730be4
11 changed files with 96 additions and 18 deletions
21
bundles/zfs/files/backup-pre-hook
Normal file
21
bundles/zfs/files/backup-pre-hook
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
run-parts --exit-on-error -- /etc/zfs-snapshot-backup-pre.d
|
||||
|
||||
|
||||
% for dataset in sorted(node.metadata.get('zfs/filesystems_with_backup_snapshots')):
|
||||
if zfs get type ${dataset}@snapshot-backup >/dev/null 2>&1
|
||||
then
|
||||
zfs destroy -f ${dataset}@snapshot-backup
|
||||
fi
|
||||
|
||||
zfs snapshot ${dataset}@snapshot-backup
|
||||
|
||||
mkdir -p /mnt/backup-snapshot${node.metadata['zfs']['datasets'][dataset]['mountpoint']}
|
||||
mount -t zfs ${dataset}@snapshot-backup /mnt/backup-snapshot${node.metadata['zfs']['datasets'][dataset]['mountpoint']}
|
||||
|
||||
|
||||
% endfor
|
||||
run-parts --exit-on-error -- /etc/zfs-snapshot-backup-post.d
|
Loading…
Add table
Add a link
Reference in a new issue