TSM Script to Free up tapes which are almost empty

cozcol

ADSM.ORG Member
Joined
Sep 11, 2008
Messages
107
Reaction score
0
Points
0
Location
Auckland, New Zealand
Hi Guys and girls,

I am trying to get this script working which will free up almost empty tapes.

Free up tapes which are almost empty

for volume in $(dsmadmc -id=xxxx -pass=xxxx -outfile "select 'MARKER', volume_name from volumes where pct_utilized <10 " | grep '^MARKER' | cut -b 12-) ; do dsmadmc -id=xxxx -pass=xxxx -outfile 'move data ${volume}' ; done


BUT ( The BIG BUT)

Not quite working as desired yet!!!

Script is logging in and the grep and cut are working ok.

BUT the TSM server has some confusion over the variable for volumes.

Any ideas chaps?

ANS8000I Server command: 'move data ${volume}'
ANR2401E MOVE DATA: Volume ${volume} is not defined in a storage pool.
ANS8001I Return code 11.
 
Reclamation not doing it for you?

You've got a single quote around the 'move data ${volume}' chunk...use double rather than single quotes and shell expansion will occur...

T
 
As TonyB said, is there any reasons not to use reclamation ?

If you have volumes where pct_utilized <10 but there are no other volumes in filling status in this storage pool/collocation group you're just going to move the data around without any benefit.
 
Hi,

I have modified the script slightly to suit my needs. I had 100s of virtual volumes that had 100% util, but was only a few Mb in size. Each of these volumes eat up a 40Gb chunk on my tapes.

Replace StanzaName with your own
Replace XXXXXX with your password
Replace DestStgPool with your own STG
Replace SrcStgPool with your own STG


Code:
#!/bin/bash
for volume in $(dsmadmc -se=StanzaName  -id=admin -pa=XXXXXXXXX  -tab  -dataonly=yes  "select 'MARKER',volume_name from volumes where stgpool_name='SrcStgPool' and EST_CAPACITY_MB<10" |grep '^MARKER' | cut -b 8-); do
dsmadmc -se=StanzaName -id=admin -pa=XXXXXXX move data ${volume} stg=DestStgPool wait=yes
done
 
Hi Guys and girls,

I am trying to get this script working which will free up almost empty tapes.

Free up tapes which are almost empty

for volume in $(dsmadmc -id=xxxx -pass=xxxx -outfile "select 'MARKER', volume_name from volumes where pct_utilized <10 " | grep '^MARKER' | cut -b 12-) ; do dsmadmc -id=xxxx -pass=xxxx -outfile 'move data ${volume}' ; done


BUT ( The BIG BUT)

Not quite working as desired yet!!!

Script is logging in and the grep and cut are working ok.

BUT the TSM server has some confusion over the variable for volumes.

Any ideas chaps?

ANS8000I Server command: 'move data ${volume}'
ANR2401E MOVE DATA: Volume ${volume} is not defined in a storage pool.
ANS8001I Return code 11.

Not completely sure what you are trying to achieve or why you have the MARKER option etc etc.. but basically the following should do what you are looking to do.. but remember there may be other reasons why your data is storing like that. So if they are all 10% or less written to, but 90%+ free. Have you checked the collocation settings etc to make sure you are not going to do all of this processing for no gain?


#!/usr/bin/ksh
tsm="dsmadmc -id=xxxx -pass=xxxx -dataonly=yes -comma"
volumes=`$tsm "select volume_name from volumes where pct_utilized <10"`
for volume in $volumes
do
$tsm "move data $volume"
done
 
No Reclamation just isn't doing it's whole job for me.

I have soo many volumes which are <10% utilised and 0% utilised on many, but these are never getting recalled back from offsite tape storage.

Good point on the Collocation, may have to check through this.

But TSM is reporting tapes which need to go offsite but is not requesting tapes back.
 
You many have your offsite reclamation set too high. Try running reclaim with the threshold of 95 for example
Code:
reclaim stg copypool th=95 du=100
That will target those those "highly reclaimable" tapes
 
Hi,

I have modified the script again.

This time it will take the volumes with the least amount of data on it, and move it to another stgpool. This script works well for me, and saves me for a lot of half used tapes.



Replace StanzaName with your own
Replace XXXXXX with your password
Replace DestStgPool with your own STG
Replace SrcStgPool with your own STG


Code:
#!/bin/bash
dsmadmc -se=StanzaName -id=admin -pa=XXXXXX  -tab  -dataonly=yes  "select count(volume_name) from volumes where stgpool_name='SrcStgPool' and EST_CAPACITY_MB*PCT_UTILIZED/100<4000 and STATUS='FULL'"
for volume in $(dsmadmc -se=StanzaName -id=admin -pa=XXXXXX  -tab  -dataonly=yes  "select 'MARKER',volume_name from volumes where stgpool_name='SrcStgPool' and EST_CAPACITY_MB*PCT_UTILIZED/100<4000 and STATUS='FULL'" |grep '^MARKER' | cut -b 8-); do
echo ${volume}
dsmadmc -se=StanzaName -id=admin -pa=XXXXXX move data ${volume} stg=DestStgPool wait=yes
done
 
Reuse Delay

Offsite volume won't come back even though utilization is 0%, until 'reuse delay' is met. So, Check 'reuse delay' configuration on the storage pool



No Reclamation just isn't doing it's whole job for me.

I have soo many volumes which are <10% utilised and 0% utilised on many, but these are never getting recalled back from offsite tape storage.

Good point on the Collocation, may have to check through this.

But TSM is reporting tapes which need to go offsite but is not requesting tapes back.
 
HI can I add a condition where volumes to be moved are inside the library?

#!/bin/bash
dsmadmc -se=StanzaName -id=admin -pa=XXXXXX -tab -dataonly=yes "select count(volume_name) from volumes where stgpool_name='SrcStgPool' and STATUS='FULLING' and STATUS='FULL'"
for volume in $(dsmadmc -se=StanzaName -id=admin -pa=XXXXXX -tab -dataonly=yes "select 'MARKER',volume_name from volumes where stgpool_name='SrcStgPool' and STATUS='FULLING' and STATUS='FULL'" |grep '^MARKER' | cut -b :cool:; do
echo ${volume}
dsmadmc -se=StanzaName -id=admin -pa=XXXXXX move data ${volume} stg=DestStgPool wait=yes
done
 
My script for move data does 1 tape at a time, sleeps then checks if the existing move is done prior to starting another. Its pretty cool. But yeah it can screw up your collocation, keep plenty of scratch tapes to avoid this. Reclamation only does full tapes that have %reclaimable above the threshold, its does not do filling tapes that have reclaimable space as far as I know, so many dudes use move data.
 
HI can I add a condition where volumes to be moved are inside the library?

#!/bin/bash
dsmadmc -se=StanzaName -id=admin -pa=XXXXXX -tab -dataonly=yes "select count(volume_name) from volumes where stgpool_name='SrcStgPool' and STATUS='FULLING' and STATUS='FULL'"
for volume in $(dsmadmc -se=StanzaName -id=admin -pa=XXXXXX -tab -dataonly=yes "select 'MARKER',volume_name from volumes where stgpool_name='SrcStgPool' and STATUS='FULLING' and STATUS='FULL'" |grep '^MARKER' | cut -b :cool:; do
echo ${volume}
dsmadmc -se=StanzaName -id=admin -pa=XXXXXX move data ${volume} stg=DestStgPool wait=yes
done
Hi,
Could you please help me on this script as i want to initiate 5-6 process of move data.
 
Back
Top