You are not logged in.
Pages: 1
Hi,
Being new to XSI, I am looking for a way to manage retention. Understanding that pruning is a technically destructive process, is there a way to keep:
1 snap every day if older than 1 day,
1 snap every 7 days if older than 7 days,
1 snap 30 days if older than 30 days,
1 snap every 90 days if older than 90 days,
and no snaps older than 730 days
I know that might not of been the clearest.
Thanks,
-Colt
Offline
We got it. The short answer is no
The rotation mechanism allows you to keep a number or days of restore points, yet it can't maintain such complex scheme.
You can on the other side script it on your own and run the script at the end of every backup.
Offline
[quote=admin]You can on the other side script it on your own and run the script at the end of every backup.[/quote]That's what I suspected. I'll share what I come up with here once done.
Thanks,
-Colt
Offline
Remember to use [b]xsibackup --prune /path/to/repository/20220325002123[/b] to remove restore points inside a repository. You can on the other side remove replicas by just removing the folder. Some people like to [url=https://33hops.com/xsibackup-rotating-replicas.html]rotate small groups of replicas[/url] when the total size of their VM set is not very big. If you add --replica=cbt, the update of each replica will be almost instant from the second run in each replica point.
Offline
[quote=admin]If you add --replica=cbt, the update of each replica will be almost instant from the second run in each replica point.[/quote]DC lists 'Full CBT Support' but the feature comparison doesn't list any CBT capability in the other offerings. Am I correct to assume that pro (and lesser licenses) wont have any CBT available?
Offline
CBT support is exclusive to DC version, still regular differential replica will be almost as fast for VMs under 50 GB.
Offline
[quote=ColtB117]I'll share what I come up with here once done.[/quote]
This is what I came up with. It's pretty simple but does the job for me.
Dailies - After 2 days, it will only retain the most recent backup per day.
Weeklies - After 7 days, it will only retain the most recent backup per 7 days.
Monthlies - After 30 days, it will only retain the most recent backup per 30.
Quarterlies - After 90 days, it will only retain the most recent backup per 90 days.
2 Years - After 730 days, it will not retain any backups older than 730 days.
I plan to run this on my storage, not ESXi. I expect with a bit of rework it could be made to work on ESXi.
[i]Needless to say I take no responsibility for this. I make no guarantee that it's fit for any purpose. If it eats your data you're on your own. Test it in a manner where you can afford for it to fail before using it where you cant. [/i]
#!/bin/bash
bkuploc='/path/to/backups'
xsibackupexec='/opath/to/xsibackup'
declare backups=()
declare bkup_dates=()
unset lastcheckday
unset lastcheckweek
unset lastcheckmonth
unset lastcheckquarter
now_long=`date -u '+%F %T'`
now_gen=`date -u -d "$now_long" '+%Y/%m/%d 23:59:59 UTC'`
now2day=`date -u -d "$now_gen-2 day" +%s`
now7day=`date -u -d "$now_gen-7 day" +%s`
now30day=`date -u -d "$now_gen-30 day" +%s`
now90day=`date -u -d "$now_gen-90 day" +%s`
now2year=`date -u -d "$now_gen-730 day" +%s`
for i in $(find $bkuploc -maxdepth 1 -type d -regextype posix-egrep -regex "^/.*[0-9]{14}$" -printf '%f\n'); do
backups+=("${i:0:4}${i:4:2}${i:6:2}${i:8:2}${i:10:2}${i:12:2}")
done
readarray -td '' bkup_dates < <(printf '%s\0' "${backups[@]}" | sort -rz)
for j in "${bkup_dates[@]}"
do
a=$(date -u -d "${j:0:4}/${j:4:2}/${j:6:2} ${j:8:2}:${j:10:2}:${j:12:2} UTC" +%s)
if [ "$a" -ge "$now7day" ] && [ "$a" -lt "$now2day" ]; then
if [ -z ${lastcheckday+x} ]; then
lastcheckday="$a"
b=`date -u -d "$(date -u -d @$lastcheckday +%Y%m%d)" +%s`
echo "Keep, daily, $bkuploc/$j"
elif [ "$a" -lt "$b" ]; then
lastcheckday="$a"
b=`date -u -d "$(date -u -d @$lastcheckday +%Y%m%d)" +%s`
echo "Keep, daily, $bkuploc/$j"
else
echo "Prune, $bkuploc/$j"
$xsibackupexec --prune "$bkuploc/$j"
fi
elif [ "$a" -ge "$now30day" ] && [ "$a" -lt "$now7day" ]; then
if [ -z ${lastcheckweek+x} ]; then
lastcheckweek="$a"
b=`date -u -d "$(date -u -d @$lastcheckweek '+%Y/%m/%d 23:59:59 UTC') - 7 day" +%s`
echo "Keep, weekly, $bkuploc/$j"
elif [ "$a" -le "$b" ]; then
lastcheckweek="$a"
b=`date -u -d "$(date -u -d @$lastcheckweek '+%Y/%m/%d 23:59:59 UTC') - 7 day" +%s`
echo "Keep, weekly, $bkuploc/$j"
else
echo "Prune, $bkuploc/$j"
$xsibackupexec --prune "$bkuploc/$j"
fi
elif [ "$a" -ge "$now90day" ] && [ "$a" -lt "$now30day" ]; then
if [ -z ${lastcheckmonth+x} ]; then
lastcheckmonth="$a"
b=`date -u -d "$(date -u -d @$lastcheckmonth '+%Y/%m/%d 23:59:59 UTC') - 30 day" +%s`
echo "Keep, monthly, $bkuploc/$j"
elif [ "$a" -le "$b" ]; then
lastcheckmonth="$a"
b=`date -u -d "$(date -u -d @$lastcheckmonth '+%Y/%m/%d 23:59:59 UTC') - 30 day" +%s`
echo "Keep, monthly, $bkuploc/$j"
else
echo "Prune, $bkuploc/$j"
$xsibackupexec --prune "$bkuploc/$j"
fi
elif [ "$a" -ge "$now2year" ] && [ "$a" -lt "$now90day" ]; then
if [ -z ${lastcheckquarter+x} ]; then
lastcheckquarter="$a"
b=`date -u -d "$(date -u -d @$lastcheckquarter '+%Y/%m/%d 23:59:59 UTC') - 90 day" +%s`
echo "Keep, monthly, $bkuploc/$j"
elif [ "$a" -le "$b" ]; then
lastcheckquarter="$a"
b=`date -u -d "$(date -u -d @$lastcheckquarter '+%Y/%m/%d 23:59:59 UTC') - 90 day" +%s`
echo "Keep, quarterly, $bkuploc/$j"
else
echo "Prune, $bkuploc/$j"
$xsibackupexec --prune "$bkuploc/$j"
fi
elif [ "$a" -lt "$now2year" ]; then
echo "Prune, Older than 2 years $bkuploc/$j"
$xsibackupexec --prune "$bkuploc/$j"
fi
done
Offline
Thank you, your code snippet will for sure be useful to others. Just reminding you all, use with caution and test thoroughly.
Offline
Pages: 1