Hi,

You can find informations about that on bacula manual
http://bacula.org/dev-manual/Automatic_Volume_Recycling.html#SECTION000243000000000000000

You can try this (change Pool.Name and MediaType)

SELECT Media.VolumeName  AS volumename,
       Media.VolStatus   AS volstatus,
       Media.LastWritten AS lastwritten,
       Media.MediaType   AS mediatype,
       Media.VolMounts   AS volmounts,
       Pool.Name         AS name,
       FROM_UNIXTIME(
          UNIX_TIMESTAMP(Media.LastWritten) 
        + (Media.VolRetention)
       ) AS expire
FROM Media 
 INNER JOIN Pool ON (Pool.PoolId = Media.PoolId) 

WHERE Media.InChanger <> 1
  AND Media.VolStatus IN ('Purged', 'Full', 'Append')
  AND Media.Recycle = 1

-- if you want only expired media
AND (    UNIX_TIMESTAMP(Media.LastWritten) 
       + (Media.VolRetention)
    ) < NOW()

AND Media.MediaType IN ('File','SDLT') 
AND Pool.Name IN ('Default','Journee','Mois','Scratch','Semaine') 
ORDER BY Media.VolUseDuration DESC, Media.VolMounts ASC, expire ASC 
LIMIT 10

it's a part of Bweb, a new bacula web interface (see 
http://brestore.webhop.info/web
for old screen shot) which will be available in few days.
This new tool will help you to load/unload volumes in you autochanger.

Bye

>I'm still looking for a way to predict which tapes bacula will try to 
recycle,
>so that I can pre-load our autochanger instead of having all backups halt 
with
>the "intervention needed" message. For example, I've got ~50 volumes in the 
>"incremental" pool that are "full", but I don't know which ones to load into 
the
>changer to be recycled.

>I understand that there's currently no way to run the recycle algorithm
>manually.

>I was considering the querying the database to produce a list of full 
volumes,
>reverse sorted by the age of the newest backup per volume. This list would 
tell
>me which are the "oldest" tapes (where the age is given by the newest backup 
per
>volume, not the first use of a volume).

>Does this seem like a reasonable approximation of the order in which bacula
>would recycle tapes (assuming that they are all in the changer, and assuming
>that all jobs per volume have the same retention period)?

>If so, I'd really appreciate some help with the SQL query to extract this 
data.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to