-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
27 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,25 +59,26 @@ Commands: | |
Options: | ||
--vmid The ID of the VM/CT, comma separated (es. 100,101,102), | ||
'all-???' for all known guest systems in specific host (es. all-pve1, all-$(hostname)), | ||
'all-???' for all known guest systems in specific host (es. all-pve1, all-\$(hostname)), | ||
'all' for all known guest systems in cluster, | ||
'storage-???' storage Proxmox VE (pool Ceph) | ||
--label Is usually 'hourly', 'daily', 'weekly', or 'monthly' | ||
--path Path destination backup | ||
--keep Specify the number of backup which should will keep, Default 1 (can't be used with --renew) | ||
--keep Specify the number of differential backups which should will keep, (default: 1) | ||
--renew Specify how many diffs may accumulate, until a full Backup is issued | ||
--renew=10 for keeping 10 Diffs until making a new full export | ||
--renew=7d for making diffs up to 7 days, until making a new full export | ||
--retain Specify how many Backups should be kept, timewise (default: infinite - if unset, nothing is ever deleted) | ||
--retain=30d to keep Backups for 30 days. If the Point in time matches a diff, | ||
it keeps all previous diffs up to the preceding full image to ensure possibility to restore data | ||
--cksum Store checksums for snapshot validation (default: true) | ||
--ckmethod Method used for Checksumming [m5sum, sha1sum, sha224sum, sha384sum, sha512sum] (default: sha1sum) | ||
--qemu-freeze Issue fsfreeze-freeze prio snapshotting and fsfreeze-thaw after snapshot completion (default: true) | ||
--iothreads Specify number of IO threads for exporting (default: 10) | ||
--compress Specify compression method [none,gzip,bzip2,pigz] (default: none) | ||
--compressthreads Specify compression threads for pigz (default: 1) | ||
--compressthreads Specify compression threads for pigz (default: 2) | ||
--script Use specified hook script | ||
E.g. /usr/share/doc/eve4pve-barc/examples/script-hook.sh | ||
E.g. /usr/share/doc/$PROGNAME/examples/script-hook.sh | ||
--syslog Write messages into the system log | ||
--mail Email addresses send log backup, comma separated (es. [email protected],[email protected]) | ||
--unprotect-snap Disable protection snapshot, default is protected. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
eve4pve-barc (0.2.8) | ||
|
||
* Fix backup & restore checksum issues with keep & renew #74 | ||
|
||
-- EnterpriseVE Support Team <[email protected]> 7 Oct 2019 09:12:00 +0100 | ||
|
||
eve4pve-barc (0.2.7) | ||
|
||
* fix #68 #73 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
# Author: Daniele Corsini <[email protected]> | ||
# Bastian Mäuser <[email protected]> | ||
|
||
declare -r VERSION=0.2.7 | ||
declare -r VERSION=0.2.8 | ||
declare -r NAME=$(basename "$0") | ||
declare -r PROGNAME=${NAME%.*} | ||
|
||
|
@@ -987,9 +987,9 @@ function housekeeping() { | |
} | ||
|
||
function merge_diff_backup(){ | ||
|
||
local image='' | ||
|
||
# set the de/compression command & extension | ||
needs_decompress=true | ||
case "$opt_compress" in | ||
|
@@ -1043,19 +1043,19 @@ function merge_diff_backup(){ | |
log debug "for path: $path_backup/"*$suffix_backup_file$EXT_DIFF$cext | ||
for export_diff in $(ls -r "$path_backup/"*$suffix_backup_file$EXT_DIFF$cext 2>/dev/null); do | ||
# iterates diff files from oldest to newest | ||
|
||
# clean up export file path | ||
export_diff=$(printf %q "$export_diff") | ||
log debug "*** Export file is: $export_diff" | ||
|
||
# check the export diff exists (i.e. make sure we have a valid file path) | ||
if [[ -f "$export_diff" ]]; then | ||
log debug "$export_diff exists." | ||
else | ||
log error "Export file not found. Aborting..." | ||
exit 2 | ||
fi | ||
|
||
# are we at a diff count higher or equal to our 'keep' level? | ||
if [ "$index" -ge "$opt_keep" ]; then | ||
if [ -z "$second_diff" ]; then | ||
|
@@ -1064,57 +1064,56 @@ function merge_diff_backup(){ | |
else | ||
first_diff=$(printf %q "$export_diff") | ||
merged_diff="$second_diff-merged" | ||
|
||
# should never happen, but extra safety check | ||
if [ -z "$first_diff" ] || [ -z "$second_diff" ]; then | ||
# for some reason we're missing a diff file path. This could be dangerous with later rm commands so abort. | ||
debug error "One or both diff path/s missing. Aborting!" | ||
return 3 | ||
fi | ||
|
||
# define initial merge file paths | ||
merge_file_1=$first_diff | ||
merge_file_2=$second_diff | ||
|
||
# check if we have files that need decompressing | ||
if [ "$needs_decompress" == true ]; then | ||
|
||
# decompress the 1st diff files | ||
cmd="$decompress $first_diff > $first_diff.raw" | ||
log debug "Decompressing 1st diff file: $cmd" | ||
if ! do_run $cmd ; then | ||
log error "Failed to decompress 1st diff file. Aborting." | ||
exit 4 | ||
fi | ||
|
||
# decompress the 2nd diff files | ||
cmd="$decompress $second_diff > $second_diff.raw" | ||
log debug "Decompressing 2nd diff file: $cmd" | ||
if ! do_run $cmd ; then | ||
log error "Failed to decompress 2nd diff file. Aborting." | ||
exit 5 | ||
fi | ||
|
||
# redefine the merge file paths for the later diff merge operation | ||
merge_file_1=$first_diff.raw | ||
merge_file_2=$second_diff.raw | ||
|
||
fi | ||
|
||
# merge 1st (older) & 2nd (more recent) diffs into a new diff file with a filename based on newer 2nd diff | ||
# we also create the checksum & size meta data files at this time, writing over the old ones | ||
log info "VM $vm_id - Merge diff backup '$(basename "$first_diff")' '$(basename "$second_diff")' to '$(basename "$merged_diff")'" | ||
if do_run "rbd merge-diff $merge_file_1 $merge_file_2 - | tee >($compress > $merged_diff) >(wc -c > $second_diff.${ckext[$opt_ckmethod]}.size) | $opt_ckmethod > $second_diff.${ckext[$opt_ckmethod]}" ; then | ||
|
||
#ok result | ||
|
||
if [ "$needs_decompress" == true ]; then | ||
# remove the temporary decompressed diff files | ||
if ! do_run "rm $first_diff.raw $second_diff.raw" ; then | ||
log error "Failed to remove temporary diff files." | ||
fi | ||
fi | ||
|
||
# clean up the 1st diff files that we no longer need, as it's merged into the 2nd diff | ||
log info "VM $vm_id - Removing first diff backup '$first_diff'"; | ||
if do_run "rm $first_diff" ; then | ||
|
@@ -1141,7 +1140,7 @@ function merge_diff_backup(){ | |
#Error | ||
log error "VM $vm_id - Merge diff backup '$(basename $first_diff)' '$(basename $second_diff)' to '$(basename "$merged_diff")'" | ||
do_run "rm -f $merged_diff" | ||
|
||
if [ "$needs_decompress" == true ]; then | ||
# remove the temporary decompressed diff files | ||
do_run "rm $first_diff.raw $second_diff.raw" | ||
|