>> On Thu, 9 Jul 2009 17:12:10 +0100, "Costa, Justino" <justino.costa AT LOGICA
>> DOT COM> said:
> As each path must match the machine device, manually redefining a
> drive and it's paths (due to serial number change) it's an headache
> and, most importantly, a very time consuming task.
> So, I manage this with a script that reads a config file, with
> server, sta, libs and drive's characteristics and it outputs all the
> define, delete, update drive and update path commands (among
> others).
Amen! Preach it.
In AIX, I do this with the following snippets:
I have a config file [1] to connect the drive name with the serial
number. The other fields are comments to assist my discussion with the
CEs.
Then I run a script [2] in a temp dir to collect the current
correlation between rmt devices and serial numbers. This way I can
blow away all the RMT devices, and rescan, and not care that they may
be helter-skelter all around the town.
Then I run another script, which does the moral equivalent (full of
local conventions, so I'm not quoting it here)
foreach (server on this library manager)
foreach (drive)
print "update path ... [ or define, or whatever].
- Allen S. Rout
-[1]------
DRIVE0,000007892730,460,new
DRIVE1,000007892835,470,new
DRIVE2,000007892870,480,new
----------
-[2]-------
#!/usr/local/bin/perl
use FileHandle;
use Data::Dumper;
my $verbose =1;
my $in = new FileHandle;
my $drives = {};
my $out = {};
$in->open("/var/tsm/system/device-correspondence.csv");
while (<$in>)
{
# print;
chomp;
my ($tsm,$sn) = split(/,/);
$drives->{$sn} = $tsm;
}
# print Dumper($drives);
$in->open("/usr/sbin/lscfg | grep rmt |");
while (<$in>)
{
my ($junk,$rmt,@junk) = split;
# print $rmt,"\n";
my (@tape) = `/usr/sbin/lscfg -vl $rmt`;
my ($snline) = grep{/Serial Number\.+(\d+)$/} @tape;
# print $snline;
my ($sn) = $snline =~ /Serial Number\.+(\d+)$/;
my $drive = $drives->{$sn};
$verbose && print "$rmt:\tNew entry for '$drive'\n";
$out->{$sn} = new FileHandle(">./serial-$sn-$drive") unless
defined($out->{$sn});
$out->{$sn}->print(@tape);
$out->{$sn}->print( `/usr/sbin/lsdev -l $rmt` );
}
-------
|