I wrote a couple of scripts to help with this problem. Start by deleting all
the jobs that you don’t want anymore. This should mark all the associated
volumes as ‘purged’. That can be done in bconsole or Baculum.
This one deletes any ‘purged’ volume records 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
This one deletes any volumes from the filesystem that are not now in the
catalog. These are files in the filesystem that have no entry in the catalog.
#!/bin/bash
#Usage: sudo -u bacula ./delete-orphened-volumes.sh target-dir any-char
#Delete orphaned Bacula volumes. Do not delete if second arg is empty
if [[ -z $1 ]]; then
echo "Please supply target directory"
exit
fi
if [[ ! -d $1 ]]; then
echo "Target does not exist"
exit
fi
if [[ -z $2 ]]; then
echo "Not deleting"
fi
cd $1 # change to target directory
for vol in $(find . -maxdepth 1 -type f -printf '%f\n')
do
echo "list volume=$vol" | bconsole | if grep --quiet "No results to list";
then
if [[ ! -z $2 ]]; then
rm $1$vol
echo "Orphaned file $1$vol deleted"
else
echo "Orphaned file $1$vol not deleted"
fi
fi
done
Best
-Chris-
> On 21 Mar 2022, at 12:42, Martin Simmons <[email protected]> wrote:
>
> You can use the "delete volume" command in bconsole to remove a volume from
> the catalog. After that, you can safely rm it from the filesystem.
>
> __Martin
>
>
>>>>>> On Sat, 19 Mar 2022 13:08:41 +0100, Justin Case said:
>>
>> Dear all,
>>
>> again another newbie question:
>>
>> I need to use a different disk drive for Bacula and I would like to start
>> over in the sense of deleting all volume files in a clean way, i.e. not
>> corrupting the catalog. The goal is to free up the space occupied by all
>> Bacula volumes.
>>
>> I know that I could migrate all volumes, but that takes more time than
>> starting over. Losing all backups of the past few days after setting up
>> Bacula is OK for me.
>>
>> I checked the manual what else I could do and it seems that one way would be
>> to set each volume manually to purged, but that would not delete the volume
>> but it would just be recycled/re-used. That would basically not help me to
>> free the space on the disk currently used by Bacula. Also it would be a
>> manual effort as I already have >150 volumes.
>>
>> All the best,
>> JC
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users