Thanks for that suggestion. Am I correct that I can only select multiple 
records from one page?

I had a large number of volumes to delete that spread over several pages so 
wrote the little script. I also use the Bacula Webmin module to delete the odd 
volume but it’s a one at a time operation.

Best
-Chris-




> On 24 Feb 2022, at 04:09, Marcin Haba <ganius...@gmail.com> wrote:
> 
> Hello Chris,
> 
> If you use Baculum and you want to delete Purged volumes only from the 
> catalog you can go to Volumes page, then in 'Vol. status' filter select 
> 'Purged', after that select volumes that you want to delete. If you want to 
> delete all Purged volumes, please select all filtered jobs (for example by 
> clicking first volume and clicking the last one with SHIFT). At the end in 
> the actions drop down list you can select 'Delete' action and that's all. In 
> the modal window you should now see the delete action log from bconsole.
> 
> Best regards,
> Marcin Haba (gani)
> 
> On Wed, 23 Feb 2022 at 17:41, Chris Wilkinson <winstonia...@gmail.com 
> <mailto:winstonia...@gmail.com>> wrote:
> Your suggestion was perfect. 
> 
> This little bash script has the desired effect. It can be altered to 
> find/delete other types of unwanted records such as Error or Read-Only or 
> restricted to a particular pool as you suggested. It doesn’t delete anything 
> on disk, only from the catalog.
> 
> #!/bin/bash
> #Usage: sudo ./delete-purged-volumes.sh any-char
> #Delete purged Bacula volumes. Do not delete if arg is empty
> if [[ -z $1 ]]; then
>   echo "Not deleting"
> fi
> for vol in $(echo "list volume" | bconsole | grep Purged | awk '{print $4}')
> do
>   if [[ ! -z $1 ]]; then
>     echo "delete yes volume=$vol" | bconsole > /dev/null
>     echo "Volume $vol deleted"
>   else
>     echo "Volume $vol not deleted"
>   fi
> done
> 
> Best
> -Chris-
> 
> 
> 
> 
>> On 21 Feb 2022, at 11:22, Josip Deanovic <djosip+n...@linuxpages.net 
>> <mailto:djosip+n...@linuxpages.net>> wrote:
>> 
>> On 2022-02-21 11:46, Chris Wilkinson wrote:
>>> Following a failure of a storage device, I have a number of records
>>> marked as ‘read-only’ in the database.
>>> The backup jobs has been moved to a new storage so these records are
>>> now redundant and I’d like to clean them out.
>>> I looked through bconsole commands but didn’t find a command to do
>>> this except by finding volumes with read only status and deleting them
>>> one by one. Is there a semi-automated way to find and delete read-only
>>> records?
>> 
>> 
>> Hi Chris
>> 
>> I think that bconsole delete command would not accept more than
>> one volume name or volume id.
>> 
>> You could get the list of your read-only volumes from the database
>> and then use shell one-liner which would send the delete command
>> through bconsole in a loop.
>> 
>> Instead of retrieving the list of volumes from the database you
>> could also get them from bconsole + some grepping or awking.
>> 
>> Something like this would give you the list of the names of your
>> volumes in the Read-Only state from all available pools (you might
>> want to limit the list to a specific pool using pool=your-pool-name):
>> echo "list volumes" | bconsole | grep Read-Only | awk '{print $4}'
>> 
>> Then you can take that list of volume names and in a similar manner
>> call bconsole tool with the delete command in a loop.
>> 
>> 
>> Regards!
>> 
>> -- 
>> Josip Deanovic
>> 
>> 
>> _______________________________________________
>> Bacula-users mailing list
>> Bacula-users@lists.sourceforge.net 
>> <mailto:Bacula-users@lists.sourceforge.net>
>> https://lists.sourceforge.net/lists/listinfo/bacula-users 
>> <https://lists.sourceforge.net/lists/listinfo/bacula-users>
> 
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net <mailto:Bacula-users@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/bacula-users 
> <https://lists.sourceforge.net/lists/listinfo/bacula-users>
> 
> 
> -- 
> "Greater love hath no man than this, that a man lay down his life for his 
> friends." Jesus Christ
> 
> "Większej miłości nikt nie ma nad tę, jak gdy kto życie swoje kładzie za 
> przyjaciół swoich." Jezus Chrystus

_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to