Networker

Re: [Networker] last written to

2005-12-06 14:50:18
Subject: Re: [Networker] last written to
From: Darren Dunham <ddunham AT TAOS DOT COM>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Tue, 6 Dec 2005 10:49:04 -0800
> Is there a way to find all the volumes in a pool that haven't been
> written to in the last x amount of time?

In one tight line, maybe not.  But we can probably get there.

> I know I can reference volaccess, but that is written to or read from.
> I want be able to recycle all the media in a pool that has not been
> written to in 30 days.

> I also know I can use sscreate to find out all the volumes that have
> been written to in the last x number of days, but that doesn't work in
> the reverse.

(or even sscomp...)

> Incidentally is there even a way to do some think like " -q
> 'volaccess!>30 days ago' ".

Well, it's pretty simple with 'volaccess', because that's a single
figure for a volume.  You can easily reverse the comparison to
'volaccess < 30 days ago' for the older ones.

However using sscreate/sscomp is different because you can have savesets
in both states on the same volume.  So you'll really need to have a
script find it all.

> I suppose I can get a list of all the volumes in a pool then a list of
> the volumes written to in the last thirty days and do a diff.  But there
> seems like there should be a more elegant way to do this.

The problem is really a combination of (1) there's no equivalent to
volaccess for writing and (2) the workaround isn't a volume field but a
saveset field.  'mminfo' isn't a full query/logic language, so sometimes
you just have to parse the output.

I'd probably write a perl program to do it (little more flexible, better
control of output), but you're right that you should be able to just
'diff' it.

pool=<your pool here>
mminfo -av -q "pool=$pool" -r 'volume' | sort -u > /tmp/pool_all.out 
# One report field, so no header line...
mminfo -av -q "pool=$pool,sscomp>30 days ago' -r 'volume' | sort -u > 
/tmp/pool_recent.out
diff /tmp/pool_all.out /tmp/pool_recent.out

-- 
Darren Dunham                                           ddunham AT taos DOT com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

To sign off this list, send email to listserv AT listserv.temple DOT edu and 
type "signoff networker" in the
body of the email. Please write to networker-request AT listserv.temple DOT edu 
if you have any problems
wit this list. You can access the archives at 
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

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