Skip to content

Commit

Permalink
fix: fix sanoid_post_remove_vzdump.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgarel authored and root committed Aug 27, 2024
1 parent 01c68ef commit d55266a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions confs/ovh3/sanoid/sanoid.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
# no_sanoid_checks:rpool/subvol-112-disk-0:rpool/subvol-113-disk-0:rpool/subvol-115-disk-0:rpool/subvol-116-disk-0:
# no_sanoid_checks:rpool/subvol-117-disk-0:rpool/subvol-119-disk-0:rpool/subvol-120-disk-0:rpool/subvol-122-disk-0:
# no_sanoid_checks:rpool/subvol-130-disk-0:rpool/subvol-140-disk-0:rpool/subvol-150-disk-0:rpool/subvol-150-disk-1:
# no_sanoid_checks:rpool/vm-200-disk-0:rpool/vm-200-disk-0-old:rpool/vm-200-state-bef_alex_resize:rpool/vm-201-disk-0:
# no_sanoid_checks:rpool/vm-200-disk-0:rpool/vm-200-disk-0-old:rpool/vm-200-state-bef_alex_resize:rpool/vm-201-disk-0:rpool/vm-201-disk-1:
# no_sanoid_checks:rpool/vm-202-disk-0:rpool/vm-202-state-bef_upgrade:rpool/vm-203-disk-0:rpool/vm-203-state-before_more_space:
# no_sanoid_checks:rpool/backups
# no_sanoid_checks:rpool/backups:rpool/backups/wild-ecoscore-111:
# no_sanoid_checks:rpool/logs-nginx:
# no_sanoid_checks:rpool/obf-old:rpool/opf-old:
# no_sanoid_checks:rpool/off/clones:rpool/off/clones/images:rpool/off/clones/orgs:rpool/off/clones/products:rpool/off/clones/users:
# no_sanoid_checks:rpool/static:rpool/static/obf-images:rpool/static/off-pro-images:rpool/static/opf-images:rpool/static/opff-images:
#
# Disabled because I don't know how to apply a template to children a a different one
# for the dataset itself
# no_sanoid_checks:rpool/off-backups
#
# Voluntarily disabled
# no_sanoid_checks: rpool/staging-clones:rpool/staging-clones/off-images:rpool/staging-clones/off-products:rpool/staging-clones/orgs:rpool/staging-clones/users
# no_sanoid_checks: rpool
Expand Down
8 changes: 6 additions & 2 deletions scripts/zfs/sanoid_post_remove_vzdump.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/usr/bin/env bash

# SANOID_TARGETS is an env variable set by sanoid before calling this script

# This script removes eventual vzdump snapshots that where synchronized
# but shan't have been
# This is for backup of datasets only (not local one)
readarray -d "," DATASETS <<< $SANOID_TARGETS
for DATASET in "${DATASETS[@]}"
do
if ( zfs list "$DATASET"@vzdump )
# remove line returns
DATASET=$(echo $DATASET|tr -d '\r\n')
if [[ -n "$DATASET" ]] && ( zfs list "$DATASET@vzdump" )
then
zfs destroy "$DATASET"@vzdump
zfs destroy "$DATASET@vzdump"
fi
done

0 comments on commit d55266a

Please sign in to comment.