Dear List, We use 1 job per volume disk based backups. To prevent the disk from filling up i've created a housekeeping script. This script deletes all volumes which have status: 'purged'.
Background information: According the documentation: 1. "When all Job and File records have been pruned or purged from the catalog for a particular Volume, if that Volume is marked as Append, Full, Used, or Error, it will then be marked as Purged. Only Volumes marked as Purged will be considered to be converted to the Recycled state if the Recycle directive is set to yes." After testing I can conform that if there are no database relations to a volume it will be marked as purged. This included incremental job's which didn't backed up any file. 2. I assumed that the option: "Action On Purge = <Truncate>", Will delete my volumes (leave the file, but 0 byte it), but this was not the case. According the documentation you have to run a command first (missed opportunity if you ask me, why should you run a command?). After more investigation I found out that even the command isn't working in the current stable, which is already reported: https://bugs.bareos.org/view.php?id=282 So since: "Action On Purge = <Truncate>" is not working properly I've created the script below. I can't come up with a scenario where this script is "dangerous" but if you do, please let me know. Best, Teun #!/bin/bash # # Author: Teun Ouwehand @ Nextpertise B.V. # Bareos housekeeping, delete purged volumes from disk # function delete_volume_on_disk() { re='^[0-9]+$' if ! [[ $i =~ $re ]] ; then if [ -f "/var/lib/bareos/storage/$1" ]; then rm /var/lib/bareos/storage/$1 fi fi } function delete_volume_in_database() { re='^[0-9]+$' if [[ $i =~ $re ]] ; then echo "DELETE FROM Media WHERE MediaId = $i" mysql --defaults-file=/etc/mysql/debian.cnf bareos -N -e "DELETE FROM Media WHERE MediaId = $i" fi } list=`mysql --defaults-file=/etc/mysql/debian.cnf bareos -N -e "SELECT MediaId, VolumeName FROM Media WHERE VolStatus = 'Purged'"` for i in $list; do delete_volume_on_disk $i delete_volume_in_database $i done -- You received this message because you are subscribed to the Google Groups "bareos-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
