[CLUE-Tech] Slow DLT performance

Dan Harris coronadh at coronasolutions.com
Fri Oct 24 12:30:28 MDT 2003


I use mt to get device status as well as manually control the tape.  It 
hasn't given me any clues, though.  Reading from the tape seems normal, 
but I don't know exactly what 'normal' should be.  I haven't actually 
tried to restore all 30 gigs yet.  But I have catataloged the tape and 
that seems to go fairly quick. The tape drive is not rewinding in the 
middle of the tar, I've watched it and it seems to be happily writing 
away, it just takes forever to do.

I've included the perl program I wrote to manage the backup for me.  
Maybe there's something obvious here that I haven't noticed and someone 
else can spot it.

******* begin script **********

#!/usr/bin/perl
use Mail::Sendmail;
use POSIX;
use strict;


### GLOBAL CONFIG OPTIONS ###

my $LOGFILE     = '/root/backup.log';
my $TAPE_DEV    = '/dev/nst0';
my $TAR_CMD     = '/usr/bin/tar -cjf';
my $PG_DUMP     = 'pg_dump -U postgres';
my $SMB_MOUNT   = 'mount -t smbfs -o 
username=<username>,password=<password>';
my $DUMP_DIR    = '/usr/backup';

#############################

### DEFINE BACKUP SESSIONS ###

my %SESSIONS = ();

$SESSIONS{pikes}->{HOSTNAME} = 'pikes';
$SESSIONS{pikes}->{DATABASES} = [qw( corona timeman geodata parch )];
$SESSIONS{pikes}->{DIRS} = [qw(
                                /etc
                                /usr
                                /usr/www
                                /home
                                /root
                                /usr/corona
                                /usr/backup
                        )];

$SESSIONS{harvard}->{DATABASES} = [qw( sac football )];       
$SESSIONS{harvard}->{DIRS} = [qw( 
                                /etc
                                /usr/www
                                /usr/cad_data
                                /usr
                                /usr/scripts
                                /usr/corona
                                /usr/backup
                                /mnt/elbert/Inetpub/cadmine
                        )];

$SESSIONS{crestone}->{HOSTNAME} = 'crestone';
$SESSIONS{crestone}->{DIRS} = [qw(
                                /usr/corona
                                /usr/devel
                        )];
#############################

open (LOG, ">$LOGFILE");

#############################
my $date = `date`;
print LOG "$date **** Beginning backup script ****\n";

$date = `date`;
print LOG "$date Rewinding tape...\n";
`mt -f $TAPE_DEV rewind >> $LOGFILE 2>&1`; # // rewind the tape

$date = `date`;
print LOG "$date Mounting samba share...\n";
`$SMB_MOUNT //elbert/f /mnt/elbert >> $LOGFILE 2>&1`;

foreach my $key ( keys %SESSIONS ) {
        $date = `date`;
        my $db_cmd;
        print LOG "$date Dumping databases on $key...\n";

        if ( $SESSIONS{$key}->{HOSTNAME} ) {
                if ( $SESSIONS{$key}->{DATABASES} ) {
                        foreach my $db ( @{$SESSIONS{$key}->{DATABASES}} ) {
                                print LOG "$date Dumping database: 
$db...\n";
                                $db_cmd = "ssh 
$SESSIONS{$key}->{HOSTNAME} '$PG_DUMP $db' > $DUMP_DIR/$db.bak 2>>$LOGF
                                `$db_cmd`;
                                print "$db_cmd\n";
                        }
                }
        } else {
                if ( $SESSIONS{$key}->{DATABASES} ) {
                        foreach my $db ( @{$SESSIONS{$key}->{DATABASES}} ) {
                                print LOG "$date Dumping database: 
$db...\n";
                                $db_cmd = "$PG_DUMP $db > 
$DUMP_DIR/$db.bak 2>>$LOGFILE";
                                `$db_cmd`;
                                print "$db_cmd\n";
                        }
                }
        }
}



foreach my $key ( keys %SESSIONS ) {
        $date = `date`;
        my $file_cmd;

        print LOG "$date Backing up files on $key...\n";

        my $dir_string = join(' ', @{$SESSIONS{$key}->{DIRS}});

        if ( $SESSIONS{$key}->{HOSTNAME} ) {
                $file_cmd = "ssh $SESSIONS{$key}->{HOSTNAME} '$TAR_CMD - 
$dir_string' | dd of=$TAPE_DEV >> $LOGFILE 2>
        } else {
                $file_cmd = "$TAR_CMD $TAPE_DEV $dir_string >> $LOGFILE 
2>&1";
        }

        print "$file_cmd\n";
        `$file_cmd`;
}

$date = `date`;
print LOG "$date Unmounting samba share...\n";
`umount /mnt/elbert >> $LOGFILE 2>&1`;

#########################################################################

close LOG;

my %mail = (
        To              => 'coronadh at coronasolutions.com',
        From            => 'cadmine at coronasolutions.com',
        Subject         => 'Backup Log',
        'X-Mailer'      => 'CADmine Mail Service'
);
$mail{Smtp} = 'coronasolutions.com';
$mail{'message :'} = `cat $LOGFILE`;

if ( sendmail %mail ) {
        #mail sent OK
} else {
        print "Error sending mail";
}





>
> ADIC sent me the mt program compiled for Windows to troubleshoot a 
> Sony AIT drive.  It seems you can get it from the cpio or mt-st 
> packages.  mt does various tape operations (eject, rewind, read, 
> write, etc.).  It may be the thing to use to talk to the tape drive.  
> I think it will tell you bytes written and elapsed time...
>
> Does reading from the tape go any faster?
>
> I'd think that dd or cat or such would work with the tape block 
> device, but since they don't understand rewinding and so on maybe mt 
> is better.
>
> Dave
>
> _______________________________________________
> CLUE-Tech mailing list
> Post messages to: CLUE-Tech at clue.denver.co.us
> Unsubscribe or manage your options: 
> http://clue.denver.co.us/mailman/listinfo/clue-tech





More information about the clue-tech mailing list