Thanks Bill.

I looked into using the query command but the standard queries prompts the
user to specify the volume name one by one. I haven't yet been able to find
a way to script this command by reading volume names from storage so that
the output can be fed to the delete and rm commands.

My SQL and catalog structure knowledge is minimal but I'll try to figure
out an additional SQL to add to the query list.

BTW, the query list in /etc/bacula/scripts is empty so I copied across the
query file from the distribution section.

-Chris-

On Wed, 12 Apr 2023, 17:27 Bill Arlofski via Bacula-users, <
bacula-users@lists.sourceforge.net> wrote:

> On 4/11/23 16:35, Chris Wilkinson wrote:
> > I have some disk volumes that are not associated with any job but have
> not yet reached their expiry time so they are not
> > being pruned. These were created by a job run that was deleted. It seems
> deleting a job run doesn't purge the associated volumes.
> >
> > I would like to delete these now obsolete volumes from disk and recover
> the space used.
> >
> > I thought the prune command would do this but it doesn't find the
> obsolete volumes, presumably because they haven't reached
> > their expiry time. I thought perhaps the bls -j <pathtovolume> utility
> might help but it is extremely slow and produces much
> > unwanted output that is difficult to parse out.
> >
> > How could I list these obsolete volumes so I could script a delete from
> catalog and rm the volume files?
> >
> > Thanks
> > Chris Wilkinson
>
>
> Hello Chris,
>
> Bacula does its best to not delete tings, especially volumes/backup data.
> The rare case being the `ActionOnPurge = truncate`
> f
> eature.
>
> The answer in your case is simple:
>
> In bconsole:
> * delete yes volume=xxxx
>
> Then in a shell:
> # rm -f /path/to/filevolume
>
> This can be done with a simple script too (standard warnings apply):
> ----8<----
> #!/bin/bash
>
> bcbin=/path/to/bconsole
> bccfg=/path/to/bconsole.conf
> path2vols=/path/to/file/vols
>
> For vol in vol_1 vol_2 vol_3; do
>
>    echo "delete yes volume="${vol}" | "${bcbin}" -c "${bccfg}"
>    rm -f "$path2vols}"/"${vol}
>
> done
> ----8<----
>
> To be sure there are no jobs associated with a volume, I would recommend
> to use the bconsole `query` command, then choose
> option `14: List Jobs stored for a given Volume name`, and then do the
> deletions after you are sure all is OK.
>
>
> Hope this helps,
> Bill
>
> --
> Bill Arlofski
> w...@protonmail.com
>
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to