Re: needed tapes

"Gary R. Schmidt" <[email protected]>
Newsgroups gmane.comp.bacula.user
Message-ID <[email protected]>
On 13/3/25 18:14, Stefan G. Weichinger via Bacula-users wrote:
> 
> thanks all for your replies and explanations.
> 
> It wasn't my intention to let somebody else do my work, no :-)
> 
> I see the complexity somehow, and wonder if I can at least come up with 
> something that *helps* choosing the next 8 tapes each week.
> 
> Currently mostly I select the tapes, I am the external admin of that 
> server, and it seems the customer would prefer if some internal tape 
> operator can do that ... (that guy is very likely cheaper for them).
> 
> The customer has to write and fulfill a specific SOP document for 
> backups, and I will see if I can negotiate about that part.
> 
> So it is standard procedure for most of the Bacula installations that 
> somebody "manually" selects the tapes regularly? Sure, with big 
> libraries it's not necessary, I understand.
> 
> Thanks, greetings, Stefan
> 
> ps: I still haven't found the time to look at that script using 
> bconsole ... I will do that asap and see what I can achieve.
> 

I use an 8-slot autoloader, I added a little bit of SQL to the query 
file and just run that, it lists my tapes from last-used to most recent.
I grab the three oldest, move them to the Scratch pool, purge them, and 
replace the three oldest in the autoloader with them.

NOTE: This is for Postgres, YMMV:
# 22
:List volumes in Order of LastWritten
SELECT Media.MediaId, Media.VolumeName, Media.PoolId, Pool.Name AS Pool, 
Media.Slot,
         Media.Slot <> 0 AS InChanger, Media.FirstWritten, 
Media.LastWritten, Media.VolStatus,
         GREATEST(0, (extract('epoch' from LastWritten + 
Media.VolRetention * interval '1second' - NOW())::bigint)) as ExpiresIn,
         Media.VolBytes
     FROM Media
     INNER JOIN Pool
         ON Media.PoolId = Pool.PoolId
     ORDER BY Media.LastWritten;

I wrote it about 6 years ago, previously I'd been looking at the output 
of "list media" and working out what was oldest.

	Cheers,
		Gary	B-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.