On 16/08/12 11:16, Tilman Schmidt wrote: > Am 15.08.2012 21:13, schrieb Conrad Lawes: >> At my company, we store our backup tapes offsite with a storage provider. >> We have 28-day retention policy for weekly backups. May times I not sure >> which tapes Bacula will need for the coming weekly schedule. As a result, I >> oftentime have to manually change the volume status in the autochanger so >> that Bacula completes the weekly backup jobs. >> Is there a way to query the bacula catalog to determine the tapes that >> Bacula will need for the next weekly backup? > > It works the other way round. Bacula decides which tape to use upon > seeing which tapes are available. > > So you should > 1. configure the tape's retention parameters so that Bacula knows it may > use the tape > 2. load the tape into the changer and update slots > 3. let Bacula decide to use that tape. > > If step 3 fails, you've done something wrong in step 1. :-)
I believe Conrad wants to know which tapes he should be loading into the changer BEFORE Bacula asks for them. The queries attached will answer that question and which tapes should be removed from the changer. I also have a shell script which will move tapes for removal to the mailslot magazine - but that is only useful for larger changers such as a neo8000, which have a mailslot magazine. # 18 :List Volumes Bacula thinks should be removed from changer SELECT Slot, VolumeName,VolStatus AS Status, lpad(text(round(VolBytes/(1024.00*1024.00*1024.00),1)),7,' ') AS GB, date(LastWritten) AS LastWritten, date(Media.LastWritten + interval '1 second' * Media.VolRetention) AS Expiry ##,Storage.Name AS Location FROM Media,Pool,Storage WHERE Media.PoolId=Pool.PoolId AND ((VolStatus='Used') OR (VolStatus='Full') OR (VolStatus='Disabled') OR (VolStatus='Error')) AND Slot>0 and Slot<501 AND InChanger=1 AND Media.StorageId=Storage.StorageId AND date(Media.LastWritten + interval '1 second' * Media.VolRetention * .98)-current_date > 5 ORDER BY VolumeName; # 19 :List Volumes Bacula thinks are eligible for the changer SELECT DISTINCT VolumeName,VolStatus as Status, ##Storage.Name AS Location, lpad(text(round(VolBytes/(1024.00*1024.00*1024.00),1)),7,' ') AS GB, date(LastWritten) AS LastWritten, date(Media.LastWritten + interval '1 second' * Media.VolRetention) AS Expiry FROM Media,Pool,Storage WHERE Media.PoolId=Pool.PoolId # AND Media.StorageId=Storage.StorageId AND InChanger=0 ##Volume is ready to be used AND ((VolStatus='Purged') OR (VolStatus='Append') OR (VolStatus='Recycle') ##or volume is at (98% of cycle time minus 5 days) OR date(Media.LastWritten + interval '1 second' * Media.VolRetention * .98)-current_date <= 5) ORDER BY VolumeName ASC ; ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users