Question
How do I remove zombie backups?
Environment
OnApp Backup Scheme
Normal and/or Incremental Backups
Answer
Copy or download zbk.sh onto the control panel server:
#rm -f /tmp/zbk.sh
#curl -s https://bitbucket.org/onappcore/support-tools-public/raw/e86b6a44a4f1857b9fb8bfe91085e08caa1130fb/z-zbk.sh | tee - > /tmp/zbk.sh ; cd /tmp/
And run the following command (with your own parameters):
#bash zbk.sh -B 137.137.137.137
Let 137.137.137.137 be the ip address of the backup server. This would search for backup files that exist on the backup server but do not exist in the OnApp database.
The script will list the files with a prompt asking you to confirm if it is ok to delete them. Check that every line in the output looks like a backup. Then you can type 'y' to delete the items found in that list.
After the script finishes, a list of deleted zombie backups should be in removed_backups.txt
Additional Info
You can check for zombie backup transactions using the -p option.
You can check for missing backup files using the -M option.
The script can also be used to check for zombie backups on a hypervisor, (use -H [ipaddress]) and on the control panel. (Use -C, no argument/parameter required)
bash zbk.sh -h should display a help message with this information as well.
Comments
9 comments
I combined the scripts and adjusted it to work with incremental backups too.
Now deletes zombie mbrs.
You can now run it as root on the CP. It will now let you check for zombies anywhere you can reasonably think of.
Added safeguards. Will warn user and exit if ran on a non-CP server.
Added -p option to check processes on backup servers.
v2.4
Improved search performance
Added size reporting option (Use -s flag) Logged in file /tmp/zbk_rmsize.txt
Refer to ./removed_backups.txt for removal logging.
Added support for unlisted backup servers
Users were reporting error: zbk.sh: line 609: syntax error near unexpected token `<'
zbk.sh: line 609: ` done < <(/usr/bin/mysql -P $MYSQLPORT -h $MYSQLHOST $MYSQLDB -p$MYSQLPW -Bse "select parent_id,identifier from transactions where status='running' and (action='take_backup' or action='take_incremental_backup');")'
I fixed this by adding safeguards to prevent users from using anything but bash. People were using 'sh' which does not allow bash-style process susbstitution.
Added colors to console output.
vers 3.6 - Added missing backup checker
Please sign in to leave a comment.