Compare commits

..

3 commits

Author SHA1 Message Date
3b1ef1eb41
backup server recordsize 2022-09-18 23:00:32 +02:00
50fed682eb
backup /etc 2022-09-18 22:58:56 +02:00
5ead4ba105
dont de- and recompress 2022-09-18 22:58:31 +02:00
4 changed files with 18 additions and 8 deletions

View file

@ -16,7 +16,14 @@ defaults = {
'/usr/bin/rsync',
'/sbin/zfs',
},
}
},
'zfs': {
'datasets': {
'tank': {
'recordsize': "1048576",
},
},
},
}
@ -25,7 +32,7 @@ defaults = {
)
def zfs(metadata):
datasets = {}
for other_node in repo.nodes:
if (
other_node.has_bundle('backup') and
@ -42,7 +49,7 @@ def zfs(metadata):
'com.sun:auto-snapshot': 'false',
'backup': False,
}
# for rsync backups
datasets[f'{base_dataset}/fs'] = {
'mountpoint': f"/mnt/backups/{id}",
@ -51,10 +58,10 @@ def zfs(metadata):
'com.sun:auto-snapshot': 'true',
'backup': False,
}
# for zfs send/recv
if other_node.has_bundle('zfs'):
# base datasets for each tank
for pool in other_node.metadata.get('zfs/pools'):
datasets[f'{base_dataset}/{pool}'] = {
@ -64,7 +71,7 @@ def zfs(metadata):
'com.sun:auto-snapshot': 'false',
'backup': False,
}
# actual datasets
for path in other_node.metadata.get('backup/paths'):
for dataset, config in other_node.metadata.get('zfs/datasets').items():

View file

@ -39,7 +39,7 @@ else
echo "INCREMENTAL BACKUP"
last_bookmark=$(zfs list -t bookmark -H -o name | grep "^$source_dataset#$bookmark_prefix" | sort | tail -1 | cut -d '#' -f 2)
[[ -z "$last_bookmark" ]] && echo "ERROR - last_bookmark is empty" && exit 98
$(zfs send -v -L -i "#$last_bookmark" "$source_dataset@$new_bookmark" | $ssh sudo zfs recv "$target_dataset")
$(zfs send -v -L -c -i "#$last_bookmark" "$source_dataset@$new_bookmark" | $ssh sudo zfs recv "$target_dataset")
fi
if [[ "$?" == "0" ]]

View file

@ -27,7 +27,7 @@ do
echo "INCREMENTAL BACKUP"
last_bookmark=$(zfs list -t bookmark -H -o name | grep "^$dataset#$bookmark_prefix" | sort | tail -1 | cut -d '#' -f 2)
[[ -z "$last_bookmark" ]] && echo "ERROR - last_bookmark is empty" && exit 98
$(zfs send -v -L -i "#$last_bookmark" "$dataset@$new_bookmark" | $ssh sudo zfs recv "$dataset" -o mountpoint=none)
$(zfs send -v -c -L -i "#$last_bookmark" "$dataset@$new_bookmark" | $ssh sudo zfs recv "$dataset" -o mountpoint=none)
fi
if [[ "$?" == "0" ]]

View file

@ -5,6 +5,9 @@
'metadata': {
'backup': {
'server': 'home.backups',
'paths': {
'/etc',
},
},
}
}