This is the final mods to Bill's script. It scans the catalog for volumes
without a job, deletes them from the catalog and disk. There were a lot of
orphaned volumes and this recovered ~1TB from my storage.
In my setup, all volumes are in one directory and therefore have unique
names e.g. poolname-full1234
#!/bin/bash
#list volumes with no associated jobs
#usage ./delete-vols-nojob.sh any-char
store="/mnt/usb2/bacula" #where you store volumes
for vol in $(echo "list media" | bconsole | grep "^| \+[0-9].*" | awk
'{print $4}'); do
echo -e "query 14\n${vol}\n" | bconsole | if grep --quiet "No results to
list"; then
if [ ! -z $1 ];then
echo -e "delete yes volume=${vol}" | bconsole
sudo rm -f ${store}/${vol}
fi
echo ${vol} "deleted"
fi
done
Thank you to Bill 👍
On Wed, 12 Apr 2023, 6:06 pm Bill Arlofski via Bacula-users, <
[email protected]> wrote:
> On 4/12/23 11:01, Bill Arlofski via Bacula-users wrote:
>
> Oops... I have a rogue `\` in those last two echo commands:
>
> > for vol in $(echo -e "list media pool=xxxx\n\quit\n" | "${bcbin}" -c
> "${bccfg}" \
>
> and
>
> > for vol in $(echo -e "list media\n\quit\n" | "${bcbin}" -c "${bccfg}" \
>
> There should not be the `\` before each `quit`
>
>
>
> --
> 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