Script for 100% full tapes

Jpro409

ADSM.ORG Member
Joined
Oct 24, 2007
Messages
43
Reaction score
0
Points
0
I am not the best at scripting and I was wondering if anybody has a script that would allow me to eject the 100% full tapes from the tape library automatically.

Currently, I am ejecting the 100% full tapes manually by entering the following command ([FONT=&quot]checkout libvol 3584lib Tapenumber checklabel=yes remove=bulk)[/FONT] on the 100% full tapes. We have unlimited retention on all tapes and that is why the tapes are going to 100% full.

Ultimately, I want to have a admin schedule that allows me to eject the 100% full tapes one time a week.

Any help would be greatly appreciated.

Thank You
 
from you onsite pool or offsite... cause i dont know why you want to do this cause when reclamation will start... The toaster mahem will start. it will ask for the tape that you eject it
 
It would be for our onsite pool. When a tape becomes 100% full (unlimited retention, data never expires), we make the tape unavailable, eject the tape and then put the tape on a rack in the data center. Reclamation is and still running fine but TSM cannot reclaim a 100% full tape\unavailable and that is the reason why we eject the tape.
 
Last edited:
could you use an overflow location for a stgpool and then move media commands to eject the full tapes to relocate elsewhere out of the library?

This is what I've done/do when my library fills up and I have full tapes. You need to be careful they (the removed tapes) aren't needed for replication but from what you've said that might not be an issue anyway...
 
I use a script to do this so our offsite tapes only get checked out when FULL. (I KNOW, I KNOW...IT'S CRAZY! I'M ONLY DOING IT BECAUSE I AM TOLD TO!)

Here is my process....I run a select that finds all copy pool tapes marked as FULL and redirect it to a list.

dsmadmc -id=$ADSMID -pa=$ADSMPASS -dataonly=yes "select volume_name from volumes where stgpool_name like '%COPY' and LOCATION is NULL and status='FULL' " > $VOLS

Then I process that list in a while statement to set their state, but I don't have the tapes checked out. I do this because MOVE DRM does not support processing a list so this works.

while read LINE
do
dsmadmc -id=$ADSMID -pa=$ADSMPASS move drmedia $LINE tostate=vault remove=no
done < $VOLS

Then I run a checkout using the list to actually remove them from the library.

dsmadmc -id=$ADSMID -pa=$ADSMPASS 'checkout libvol <library name> vollist=FILE:$VOLS
 
Here's another crazy script...
We use to check out tapes that have not been touch for more than 100 days...


select varchar(volume_name,6) as "Volume",-
cast(last_write_date as date) as "Write Date",-
cast(last_read_date as date) as "Read Date" from volumes -
where devclass_name not like upper('%copy') and -
(cast((current_timestamp-last_write_date)days as decimal)>=10 -
and cast((current_timestamp-last_read_date)days as decimal)>=10) and -
varchar(volume_name,6) in (select volume_name from libvolumes) > c:\lto_tapes_to_be_ejected.txt
 
I use a script to do this so our offsite tapes only get checked out when FULL. (I KNOW, I KNOW...IT'S CRAZY! I'M ONLY DOING IT BECAUSE I AM TOLD TO!)

Here is my process....I run a select that finds all copy pool tapes marked as FULL and redirect it to a list.



Then I process that list in a while statement to set their state, but I don't have the tapes checked out. I do this because MOVE DRM does not support processing a list so this works.



Then I run a checkout using the list to actually remove them from the library.

Chad,

Since you have support for "while" you can use a "for" loop and complete this process in less steps.

Code:
for TAPE in `dsmadmc -id=$ADSMID -pa=$ADSMPASS -dataonly=yes "select volume_name from volumes where stgpool_name like '%COPY' and LOCATION is NULL and status='FULL' " `
do
   dsmadmc -id=$ADSMID -pa=$ADSMPASS move drmedia $TAPE tostate=vault remove=no
   dsmadmc -id=$ADSMID -pa=$ADSMPASS 'checkout libvol <library name> $TAPE'
done
 
[FONT=&quot]We want to eject the 100% full tapes and then make those tapes unavailable. Those tapes are apart of a onsite tapepool called "tapepool" Below is what I am thinking we need to accomplish this. Also, I am unsure of what statement to use to get those 100% full tapes to a unavailable state. But I tried my best below. I would create this script in the ISC console and then create an Admin schedule to run one time a week. Like I said I am not good at scripting :rolleyes:

select volume_name from volumes where tapepool and status='FULL' " > $UNAVA

while read LINE
do
Update volume acc=unavailable
done < $UNAVA


checkout libvol 3584lib vollist=FILE:$UNAVA


[/FONT]
 
sorry to be a numb-nut here but in my newbie mind i'm thinking its better to use the "built-in" functionality of an overflow location so you can check out only the onsite fulls and have them stored outside of the library. this process is then pretty streamlined and easy to follow....

Or is it better to script and search for full onsite tapes, check out and make unavailable? i.e. what am i missing?

cheers...
 
itcsge,

The process would use an overflow location but he only wants to move full tapes there and wants the process automated. There is no built-in process that will automatically move onsite, full tapes to an overflow location. Hence the need for this script.

-Aaron
 
So far I got this to work...
[FONT=&quot]select volume_name, access from volumes where stgpool_name = 'TAPEPOOL' and access = 'READWRITE' and status = 'FULL' > c:\dump\test.txt


I still need to (1) get those readwrite tapes in that text file to a [/FONT][FONT=&quot]unavailable state[/FONT][FONT=&quot], (2) eject those [/FONT][FONT=&quot]unavailable tapes from the tape library.


Thank you for all your help.
[/FONT]
 
Jpro409,

I think since you are working with a fairly complex process that your best option will be to write this script at the OS level and then schedule it there (cron, winat, etc).

-Aaron
 
Hi,

Why don't you try this from the TSM server :
select 'chechout libv 3584lib ',volume_name, ' remove=bulk checkl=no' from volumes where stgpool_name = 'TAPEPOOL' and access = 'READWRITE' and status = 'FULL' > c:\... your server directory...\macro.mac
Next you make a schedule to run this marco :
define schedule XXXX type=macro obj=c:\... your server directory...\macro.mac

Then, you make a second select for the update :
select 'update vol ',volume_name, ' access=unavailable' from volumes where stgpool_name = 'TAPEPOOL' and access = 'READWRITE' and status = 'FULL' > c:\... your server directory...\macro2.mac
and run a second schedule whith this macro..
I've try a script like this for the copy tapes, and it is working fine.

Bye,

Yves.
 
Yves.M thanks for all your help here... This is what I got so far.

1. It runs successfully and outputted the Macro file


select 'checkout libv 3584lib ',volume_name, ' remove=bulk checklabel=no' from volumes where stgpool_name = 'TAPEPOOL' and access = 'READWRITE' and status = 'FULL' > c:\test2\macro.mac
[FONT=&quot]Output of command redirected to file 'C:\TEST2\MACRO.MAC'

2. I try to define the schedule and I get the following:

[/FONT] define schedule test type=macro obj=c:\test2\macro.mac
ANR2647E DEFINE SCHEDULE: Invalid type - MACRO.
[FONT=&quot]ANS8001I Return code 3.[/FONT]
[FONT=&quot]


[/FONT]
 
I replaced the type with action and I am still missing a certain parameter. I am trying to run the schedule now, as you can tell by the below.




define schedule test action=macro obj=c:\test2\macro.mac=starttime NOW
ANR2022E DEFINE SCHEDULE: One or more parameters are missing.
[FONT=&quot]ANS8001I Return code 3.


Thanks again for all your help
[/FONT]
 
Yes of course the syntax is not complete it's only an exemple. To have the correct syntax You will need the domain etc...
Here is an other example more complete :
DEFine SCHedule domain_name schedule_name ACTion=Macro OBJects=c:\test2\macro.mac STARTTime=The_time_you_want PERiod=1 PERUnits=Weeks
 
Back
Top