Amanda-Users

Re: How to check when tapes can be reused?

2003-07-22 07:54:02
Subject: Re: How to check when tapes can be reused?
From: Roland Schützner <roli AT ains DOT at>
To: Jack Twilley <jmt AT twilley DOT org>
Date: Tue, 22 Jul 2003 13:51:18 +0200
Hi Jack and Eric!

I had the same requirements some weeks/months ago. After searching around in the man-pages, FAQs, WiKis and mailing list, the only thing that was repeatedly pointed out to was the sorted tapelist (descending after backup date). However, it seems that no one has released a script yet. So I had to browse through the C-sources and see what is done in the "amadmin <config> tape" command. As a result I wrote a small perl-script with the following syntax:

amnexttapes <config> <number of runs>

which shows the next reusable tapes for the next <number of runs> amdumps for a given config. It also makes some sanity checks (according to the C-sources) and takes runspercycle and runtapes into account.


--- if you have a library, there a some more scripts ---

Since I have a library (using the chg-zd-mtx changer) I wrote a small script `amtx <config>` whih combines the normal mtx (linux) with the barcodes-file and the tapelist to see the labels and backup dates. This gives a nice overview whats in the library. Furthermore is used by another script "scan-library".

The `scan-library <config> <number of days ahead to scan for>` shell script gives an output like the following:

25 backup@data:scan-library DailySet1 5
requested: 5
slots: 8
tapesfound: 8
free: 4
needed: 1

So, there are 8 slots reserved for the DailySet1 config, all 8 slots are filled with tapes with the respective label (tapesfound), 4 tapes are free (reusable) for the next runs and since I wanted to know if I could make it for the next 5 runs (=days in my case as I have runtapes set to 1) I get a difference of 1 tape that is needed to fulfill the requirement.

I use a "dailyscan" script run per cron every day which simply calls `scan-library DailySet1 1` with some output that is mailed to me, if there's no tape left for the next day. But this script doesn't really provide something new since an amcheck -t <config> does it better, because it not only checks the next tape, but also if the tape has an amanda-header and the right label.

-> Another script `weekendscan` run by cron gets the "current" day of the week via `date +%w` (with monday=1 .. sunday=7) and is handy because a `scan-libary DailySet1 (8-$dow) |grep "needed"|awk '{print $2}'` gives me the number of tapes that are neccessary for the backup to run unattended on the weekend. (If needed=0 -> OK, otherwise send a mail to backupadmin)

----------------- end of library script stuff -------------

If you'd like to have one or more scripts, send me a note.
BTW, did you find some scripts/progs in that matter so far (and where?). I would be interested to enhance and/or fix bugs, share infos on the topic. I could also set up a small amanda web-page with my scripts if there is no such thing (tm) till now :)

Cheers,

-Roli


Jack Twilley wrote:
"Eric" == Eric Sproul <esproul AT ntelos DOT net> writes:


Jack> I looked through the manual pages for amtape and amadmin but
Jack> couldn't find a command to tell me which of the tapes in my
Jack> tapelist were able to be reused at that time -- all of my tapes
Jack> are labeled "reuse" in the tapelist, but there's nothing to tell

Jack> Jack> Am I missing something painfully obvious?

Eric> Well, I'm not sure.  :)

Eric> The tapelist also contains the date on which the tape was last
Eric> written, with the most recent at the top (the list is ordered by
Eric> date in descending order).  So the oldest tape will be at the
Eric> bottom of the list.

Well, actually, the bottom of the list was an unused tape.

Eric> Is that what you wanted to know?

What I was hoping for was something like this:

Run the command "amsomething <config> <somethingelse>" to list all
tapes that are eligible for immediate reuse.

Eric> Eric

Jack.

--
DI Roland Schützner
All Information Network & Services GmbH
email: roland.schuetzner AT ains DOT at
phone: +43/662/45 23 35-20
fax:   +43/662/45 23 35-90


<Prev in Thread] Current Thread [Next in Thread>