On Tue, 6 Jan 2009, Jonathan Larsen wrote:
> Is there away to tell it to recycle regardless? That would help me better
> determine which tapes i need to put into my autochanger.
You can do it manually but I really recommend NOT doing this.
I wrote a couple of "query" snippets to find tapes which needed adding or
removing from the changer based on expiry dates and status:
# 15
:List Volumes Bacula thinks are in changer
SELECT VolumeName AS Volume,ROUND(VolBytes/(1024*1024*1024)) AS GB,Slot,
VolStatus AS Status,LEFT(LastWritten,10) AS LastWritten,
LEFT(FROM_UNIXTIME(UNIX_TIMESTAMP(Media.LastWritten) +
Media.VolRetention),10)
AS Expiry
FROM Media,Pool,Storage
WHERE Media.PoolId=Pool.PoolId
AND Slot>0 AND InChanger=1
AND Media.StorageId=Storage.StorageId
ORDER BY MediaType ASC, VolumeName ASC, Slot ASC;
# 18
:List Volumes Bacula thinks should be removed from changer
SELECT Slot, VolumeName,VolStatus AS Status,
ROUND(VolBytes/(1024*1024*1024)) AS
GB,
LEFT(LastWritten,10) AS LastWritten,
LEFT(FROM_UNIXTIME(UNIX_TIMESTAMP(Media.LastWritten) +
Media.VolRetention),10)
AS Expiry
##,Storage.Name AS Location
FROM Media,Pool,Storage
WHERE Media.PoolId=Pool.PoolId
AND Slot>0 AND InChanger=1
AND Media.StorageId=Storage.StorageId
AND ((DATEDIFF(FROM_UNIXTIME(UNIX_TIMESTAMP(LastWritten)
+ (Media.VolRetention * .98)), NOW()) > 5
AND ((VolStatus='Used') OR (VolStatus='Full')))
OR (VolStatus='Disabled')
OR (VolStatus='Error'))
ORDER BY Slot ASC ;
# 19
:List Volumes Bacula thinks are eligible for the changer
SELECT VolumeName,VolStatus as Status,
###Storage.Name AS Location,
ROUND(VolBytes/(1024*1024*1024)) AS GB,LEFT(LastWritten,10) AS
LastWritten,
LEFT(FROM_UNIXTIME(UNIX_TIMESTAMP(Media.LastWritten) +
Media.VolRetention),10)
AS Expiry
FROM Media,Pool,Storage
WHERE Media.PoolId=Pool.PoolId
# AND Media.StorageId=Storage.StorageId
AND InChanger=0
AND Storage.Name='MSL6000-changer'
AND ((VolStatus='Purged') OR (VolStatus='Append') OR
(VolStatus='Recycle')
OR DATEDIFF(FROM_UNIXTIME(UNIX_TIMESTAMP(Media.LastWritten)
+ (Media.VolRetention * .98)), NOW()) <= 5)
ORDER BY VolumeName ASC, Pool.Name ASC, VolMounts ASC
All wrapped up in this nasty shell script
#!/bin/sh
#checklibrary
date
echo
echo Run updateslots after any changes to library contents
echo or bad things will happen
echo
/usr/sbin/mtx -f /dev/changer status | grep ^Data
echo
echo Do not place anything in the slots occupied by the tapes listed
echo above. They are in the tape drives. If they are listed to be
echo removed then you must \"release\" the drive in bconsole to force
echo an unload and then rerun checklibrary.
echo
echo Tapes to remove from changer:
echo -e query\\\n18 | /usr/sbin/bconsole -c /etc/bacula/bconsole.conf | grep
-B1 -C1 \|
echo
echo Any tapes in status Error MUST be dealt with immediately.
echo
echo Add any tapes required for restores at this point. If they won\'t
echo fit then remove tapes until they do. TAPES WIH STATUS \"Append\" OR
echo \"Error\" MUST NOT BE REMOVED FROM THE LIBRARY
echo
echo Tapes to add to changer:
echo -e query\\\n19 | /usr/sbin/bconsole -c /etc/bacula/bconsole.conf | grep
-B1 -C1 \|
echo
echo Tapes currently in changer:
echo -e query\\\n15 | /usr/sbin/bconsole -c /etc/bacula/bconsole.conf | grep
-B1 -C1 \|
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
|