Thank you so much, Bill, for your excellent explanation. It was 100% clear to
me what needs to be done.
I am happy to tell you that nearly all your proposals are already implemented
in my setup.
They only bit left to do is to put your scripts in as jobs.
I currently have only this maintenance job:
Job {
Name = "Pruning"
Description = "Prune all expired volumes"
Type = "Admin"
Schedule = "EveryNight"
JobDefs = "DefaultJob"
PruneJobs = yes
PruneFiles = yes
PruneVolumes = yes
Enabled = yes
Runscript {
RunsWhen = "Before"
RunsOnClient = no
Console = "prune expired volume yes"
}
Priority = 12
AllowDuplicateJobs = no
}
Thank you again,
J/C
> On 11. Jun 2022, at 22:09, Bill Arlofski via Bacula-users
> <[email protected]> wrote:
>
> On 6/10/22 17:08, Justin Case wrote:
>> Hi there,
>> I am using Bacula since some weeks now, but operationally I am a complete
>> noob. Haven’t run through many use cases yet.
>> Since I have included my laptop as a job the incrementals run relatively
>> quick, but the fulls take long. Sometime I put the laptop to sleep without
>> thinking about the backup!
>> If that happens during a job for the laptop, then the job stops if the
>> connect does not work for some time. This leads to an errored job that has a
>> lot of data in volumes, but the job is incomplete. I run that job later. OK,
>> from a safety point of vie no problem at all.
>> But what about the space occupied by the incomplete job?
>> What is an efficient way to reclaim this space using the Baculum UI?
>> Deleting the incomplete job does not do the trick I suppose? What are
>> additional steps that are required?
>> Thanks for your experienced feedback!
>> J/C
>
>
> Hello Justin,
>
>
> Short answer:
>
> You can not delete data inside Bacula volumes.
>
>
> Long answer:
>
> To begin the process of seeing if you can reclaim these volume(s), deleting
> the failed laptop jobs is the correct first step. This removes any mention of
> those jobs and files from the catalog, which means when you look to see what
> jobs are stored on the volume(s) that those failed jobs used (the next step
> to do), you will see either no jobs associated with the volume(s), or any
> other jobs that may have also used them.
>
> When you check the "Jobs on volume" in Baculum, if there are no jobs
> associated with a volume, Bacula will just prune/purge/recycle and re-use
> them as necessary once a pruning operation takes place.
>
> If there are other jobs that used these volumes, you can just let things be
> and the volumes will be pruned/purged/recycled and re-used once the volume
> reaches its retention period - as above.
>
> If you want to reclaim the volumes sooner, you can delete the other jobs that
> are on the volume(s) - of course making the right decisions about important
> jobs and not deleting those.
>
> But if you keep any jobs that wrote to the volume(s) and don't delete them,
> they are still in the catalog and you will need to wait for the volume
> retention period to pass before Bacula will re-use the volume(s).
>
>
> Future hints:
>
> You may want to create a special pool for the laptop and maybe even set in
> this pool "MaximumVolumeJObs = 1". Then, you can be guaranteed that only
> laptop jobs will ever be on volumes in this pool, and that only one laptop
> job will ever be on any given volume in this pool.
>
> Then, when you run into this situation again and you want to clean up, it
> will be as easy as just deleting the failed job(s), and then the volume(s)
> that the deleted job(s) used will be ready for re-use as detailed in the
> first paragraph. :)
>
> Additionally, if you really want/need to reclaim the actual disk space these
> volumes use, there are some additional steps to take:
>
> First, I would globally disable pruning in the Director's 'Director{}' block
> by adding "Autoprune = no". If you are running an older version of Bacula,
> this option may not exist.
>
> Then, set "ActionOnPurge = truncate" in the new pool.
>
> Next create an Admin type job that runs nightly before the backup jobs run
> which will run a small script which calls some bconsole commands to do some
> catalog maintenance, including pruning and then truncating the pruned/purged
> volumes.
>
>
> The script that my NightlyMaint Admin job runs looks like the following:
> ----8<----
> #!/bin/bash
>
> bcbin="/opt/comm-bacula/sbin/bconsole"
> bcconfig="/opt/comm-bacula/include/bconsole.conf"
> storage="XXXX" # set your defined storage resource name here
>
> echo
> echo "========"
> echo "Running update stats days=3 command..."
> echo -e "update stats days=3\nquit\n" | ${bcbin} -n -c ${bcconfig}
>
> echo
> echo "========"
> echo "Running .bvfs_update command..."
> echo -e ".bvfs_update\nquit\n" | ${bcbin} -n -c ${bcconfig}
>
> echo
> echo "========"
> echo "Running prune jobs all yes command..."
> echo -e "prune jobs all yes\nquit\n" | ${bcbin} -n -c ${bcconfig}
>
> echo
> echo "========"
> echo "Pruning expired volumes"
> echo -e "prune expired volume yes\nquit\n" | ${bcbin} -n -c ${bcconfig}
>
> echo
> echo "========"
> echo "Running truncate allpools storage=${storage} command..."
> echo -e "truncate allpools storage=speedy-file\nquit\n" | ${bcbin} -n -c
> ${bcconfig}
> ----8<----
>
>
> My NightlyMaint Admin job looks like:
> ----8<----
> Job {
> Name = NightlyMaint
> JobDefs = AdminJobs
>
> RunScript {
> RunsWhen = before
> RunsOnClient = no
> FailJobOnError = yes
> # This script runs the update slots command piped to bconsole
> # -----------------------------------------------------------
> Command = "/opt/comm-bacula/include/scripts/updateslots.sh"
>
> # This script runs prune expired volumes, update stats, and .bvfs_update
> commands
> #
> -------------------------------------------------------------------------------
> Command = "/opt/comm-bacula/include/scripts/consolecommands.sh"
>
> # This command performs a PostgreSQL vacuum on the bacula catalog DB
> # ------------------------------------------------------------------
> Command = "/usr/bin/vacuumdb -q -z -d bacula"
> }
> }
> ----8<----
>
>
> And finally, if you decide to use this "ActionOnPurge = truncate" option in
> any of your current pools, you will need to do the following in bconsole to
> make sure any existing volumes in those pools inherit this new setting:
>
> * reload
> * update pool=xxxx (where xxxx is each pool you have modified)
> * update volume fromallpools
>
>
>
> Hope this helps!
>
>
> Best regards,
> Bill
>
> --
> Bill Arlofski
> [email protected]
> _______________________________________________
> Bacula-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bacula-users
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users