[Bacula-users] Deleting all volumes for a specific SD from the catalog

2023-06-09 Thread Shawn Rappaport
I have two disk-based SD servers, which are separate physical servers from our 
Director server. The hostnames are:
bac-sd01-az - SD server 1
bac-sd02-az - SD server 2
bac-dir-az - Director server

The disk volumes are named uniquely on the two SD servers:
bac-sd01-az - volume names start with az- (e.g.: az-monthly-1, az-weekly-1, 
az-daily-1, etc.)
bac-sd02-az - volume names start with az2- (e.g.: az2-monthly-1, az2-weekly-1, 
az2-daily-1, etc.)

Due to running low on disk space on bac-sd01-az, I installed and cutover to a 
second SD server with more disk space, bac-sd02-az. I did this quite a while 
ago and no longer need the volumes in my catalog that were on bac-sd01-az. To 
make matters even more fun, bac-sd02-az is now running low on disk space, so I 
installed larger disks in bac-sd01-az and rebuilt it. I would now like to cut 
back over to bac-sd01-az.

Before I do the cutover, I would like to delete all entries that may still 
exist in my catalog for volumes that had been stored on bac-sd01-az, so I can 
start using it from scratch.

I don't need a script that handles deleting the volumes from bac-sd01-az, as 
all of the volumes are already gone. However, I'm wondering what bconsole 
command(s) I can run to delete all volumes starting with az- from my catalog, 
while leaving everything starting with az2- intact. That way, I can cut back 
over to bac-sd01-az, without having stale entries in the catalog.

Thanks in advance for your help!

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


Re: [Bacula-users] Deleting all volumes for a specific SD from the catalog

2023-06-09 Thread Bill Arlofski via Bacula-users

On 6/9/23 08:35, Shawn Rappaport wrote:

I have two disk-based SD servers, which are separate physical servers from our 
Director server. The hostnames are:
bac-sd01-az - SD server 1
bac-sd02-az - SD server 2
bac-dir-az - Director server

The disk volumes are named uniquely on the two SD servers:
bac-sd01-az - volume names start with az- (e.g.: az-monthly-1, az-weekly-1, 
az-daily-1, etc.)
bac-sd02-az -volume names start with az2- (e.g.: az2-monthly-1, az2-weekly-1, 
az2-daily-1, etc.)

Due to running low on disk space on bac-sd01-az, I installed and cutover to a second SD server with more disk space, 
bac-sd02-az. I did this quite a while ago and no longer need the volumes in my catalog that were on bac-sd01-az. To make 
matters even more fun, bac-sd02-az is now running low on disk space, so I installed larger disks in bac-sd01-az and rebuilt 
it. I would now like to cut back over to bac-sd01-az.


Before I do the cutover, I would like to delete all entries that may still exist in my catalog for volumes that had been 
stored on bac-sd01-az, so I can start using it from scratch.


I don't need a script that handles deleting the volumes from bac-sd01-az, as all of the volumes are already gone. However, 
I'm wondering what bconsole command(s) I can run to delete all volumes starting with az- from my catalog, while leaving 
everything starting with az2- intact. That way, I can cut back over to bac-sd01-az, without having stale entries in the catalog.


Thanks in advanceĀ for your help!

--Shawn


Hello Sean,

It is pretty straight forward to do in a small script:
8<
#!/bin/bash

for vol in $(echo "list media" | bconsole | grep "az-[mwd]" | awk '{print 
$4}'); do
  echo "Working on Volume: $vol"
  # echo "delete yes volume=$vol" | bconsole
done
8<


Then rm then the az-* from disk

Please test and then uncomment the `delete yes volume=` line to actually delete 
the volumes from the catalog. ;)


Hope this helps.

*note: I wrote this on-the-fly, in my email client, and while I was in a Zoom presentation so there may be a rogue typo or 
two. :)



Best regards,
Bill

--
Bill Arlofski
w...@protonmail.com



signature.asc
Description: OpenPGP digital signature
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] [EXTERNAL] Re: Deleting all volumes for a specific SD from the catalog

2023-06-09 Thread Shawn Rappaport
Hi Bill,

Your script worked like a champ and deleted hundreds of volumes from the 
catalog. Thanks a bunch for the quick, precise response. It was exactly what I 
needed.

--Shawn

From: Bill Arlofski via Bacula-users 
Sent: Friday, June 9, 2023 8:45 AM
To: bacula-users@lists.sourceforge.net 
Subject: [EXTERNAL] Re: [Bacula-users] Deleting all volumes for a specific SD 
from the catalog

On 6/9/23 08:35, Shawn Rappaport wrote:
> I have two disk-based SD servers, which are separate physical servers from 
> our Director server. The hostnames are:
> bac-sd01-az - SD server 1
> bac-sd02-az - SD server 2
> bac-dir-az - Director server
>
> The disk volumes are named uniquely on the two SD servers:
> bac-sd01-az - volume names start with az- (e.g.: az-monthly-1, az-weekly-1, 
> az-daily-1, etc.)
> bac-sd02-az -volume names start with az2- (e.g.: az2-monthly-1, az2-weekly-1, 
> az2-daily-1, etc.)
>
> Due to running low on disk space on bac-sd01-az, I installed and cutover to a 
> second SD server with more disk space,
> bac-sd02-az. I did this quite a while ago and no longer need the volumes in 
> my catalog that were on bac-sd01-az. To make
> matters even more fun, bac-sd02-az is now running low on disk space, so I 
> installed larger disks in bac-sd01-az and rebuilt
> it. I would now like to cut back over to bac-sd01-az.
>
> Before I do the cutover, I would like to delete all entries that may still 
> exist in my catalog for volumes that had been
> stored on bac-sd01-az, so I can start using it from scratch.
>
> I don't need a script that handles deleting the volumes from bac-sd01-az, as 
> all of the volumes are already gone. However,
> I'm wondering what bconsole command(s) I can run to delete all volumes 
> starting with az- from my catalog, while leaving
> everything starting with az2- intact. That way, I can cut back over to 
> bac-sd01-az, without having stale entries in the catalog.
>
> Thanks in advance for your help!
>
> --Shawn

Hello Sean,

It is pretty straight forward to do in a small script:
8<
#!/bin/bash

for vol in $(echo "list media" | bconsole | grep "az-[mwd]" | awk '{print 
$4}'); do
   echo "Working on Volume: $vol"
   # echo "delete yes volume=$vol" | bconsole
done
8<


Then rm then the az-* from disk

Please test and then uncomment the `delete yes volume=` line to actually delete 
the volumes from the catalog. ;)


Hope this helps.

*note: I wrote this on-the-fly, in my email client, and while I was in a Zoom 
presentation so there may be a rogue typo or
two. :)


Best regards,
Bill

--
Bill Arlofski
w...@protonmail.com

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


Re: [Bacula-users] [EXTERNAL] Re: Deleting all volumes for a specific SD from the catalog

2023-06-09 Thread Bill Arlofski via Bacula-users

On 6/9/23 11:12, Shawn Rappaport wrote:

Hi Bill,

Your script worked like a champ and deleted hundreds of volumes from the 
catalog. Thanks a bunch for the quick, precise
response. It was exactly what I needed.

--Shawn


Hello Shawn,

Glad I could help!


Best regards,
Bill

--
Bill Arlofski
w...@protonmail.com



signature.asc
Description: OpenPGP digital signature
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users