Reclaim Underutilized OFFSITE Volumes in TSM

I have a customer that has a reasonable size TSM environment, however the daily change rate is really low. This causes the DRM media that is sent offsite to be utilized at roughly 1-5%. Since the data doesn’t expire quickly they aren’t reclaimed and the volumes tend to sit offsite without being rotated. Using LTO5 media you can imagine that it’s a huge waste of media space.

I put this together to be run periodically either manually or via cron and allow it to run until completion. It will start with the least utilized volumes and work to the ones that are the most utilized. Of course if you use collocation or will never fill a volume to 80% you will need to change the values accordingly.

use strict;
use warnings;
my $login = "/usr/bin/dsmadmc -id=ADMINUSER -password=ADMINPASS";
my @volumes;
sub getVolumeList {
    my @tempVolumes = ();
    @tempVolumes = $login -dataonly=yes &quot;<span style="color: #8b0000">select volume_name from volumes where access='OFFSITE' and pct_utilized&gt;0 and pct_utilized&lt;80 order by pct_utilized</span>&quot;;
    foreach (@tempVolumes) {
        push @volumes, substr($, -9);
foreach (@volumes) {
    print "$_\n";
    my $result = `$login -noconfirm "move data $ wait=yes`;